X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Fauth.c;h=4b68650ab4ec1f9f2e45a8e422d970eab3f546c5;hb=6d89f8d2a2b827a1165e99ea683e6c859e98693e;hp=47ecae36f341d8302ce4a7f65a91c7f868eaeaac;hpb=0bd2372fb382e377762be7cf7b97ec0e2219e5be;p=ppp.git diff --git a/pppd/auth.c b/pppd/auth.c index 47ecae3..4b68650 100644 --- a/pppd/auth.c +++ b/pppd/auth.c @@ -33,7 +33,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: auth.c,v 1.42 1999/03/02 05:33:09 paulus Exp $"; +static char rcsid[] = "$Id: auth.c,v 1.44 1999/03/08 01:47:54 paulus Exp $"; #endif #include @@ -211,14 +211,19 @@ setupapfile(argv) lcp_allowoptions[0].neg_upap = 1; /* open user info file */ - if ((ufile = fopen(*argv, "r")) == NULL) { + seteuid(getuid()); + ufile = fopen(*argv, "r"); + seteuid(0); + if (ufile == NULL) { option_error("unable to open user login data file %s", *argv); return 0; } +#if 0 /* check done by setting effective UID above */ if (!readable(fileno(ufile))) { option_error("%s: access denied", *argv); return 0; } +#endif check_access(ufile, *argv); /* get username */ @@ -1284,6 +1289,12 @@ auth_ip_addr(unit, addr) int unit; u_int32_t addr; { + + if (addresses[unit] == NULL) { + if (auth_required) + return 0; /* no addresses authorized */ + return allow_any_ip || !have_route_to(addr); + } return ip_addr_check(addr, addresses[unit]); } @@ -1302,11 +1313,8 @@ ip_addr_check(addr, addrs) if (bad_ip_adrs(addr)) return 0; - if (addrs == NULL) { - if (auth_required) - return 0; /* no addresses authorized */ - return allow_any_ip || !have_route_to(addr); - } + if (addrs == NULL) + return 0; /* no addresses authorized */ for (; addrs != NULL; addrs = addrs->next) { /* "-" means no addresses authorized, "*" means any address allowed */