X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Fauth.c;h=b0bcdcf4a9d59349dd2872f344a4450c7bb0fdae;hb=39c06d616dd4c9443ed390969e58cd53ca1e314d;hp=a92d9e93be1869de4a0687c1a0dfd019718414d8;hpb=a6821a67474c981767ba5c1ca1d1f85a77037c2d;p=ppp.git diff --git a/pppd/auth.c b/pppd/auth.c index a92d9e9..b0bcdcf 100644 --- a/pppd/auth.c +++ b/pppd/auth.c @@ -73,7 +73,7 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define RCSID "$Id: auth.c,v 1.91 2003/02/16 22:25:49 paulus Exp $" +#define RCSID "$Id: auth.c,v 1.94 2003/03/09 09:52:19 etbe Exp $" #include #include @@ -428,7 +428,8 @@ setupapfile(argv) /* get username */ if (fgets(u, MAXNAMELEN - 1, ufile) == NULL - || fgets(p, MAXSECRETLEN - 1, ufile) == NULL){ + || fgets(p, MAXSECRETLEN - 1, ufile) == NULL) { + fclose(ufile); option_error("unable to read user login data file %s", fname); return 0; } @@ -606,7 +607,7 @@ link_established(unit) (*protp->lowerup)(unit); if (!auth_required && noauth_addrs != NULL) - set_allowed_addrs(unit, NULL, NULL) + set_allowed_addrs(unit, NULL, NULL); if (auth_required && !(go->neg_upap || go->neg_chap || go->neg_eap)) { /* @@ -1149,6 +1150,14 @@ auth_check_options() exit(1); } + + /* + * Early check for remote number authorization. + */ + if (!auth_number()) { + warn("calling number %q is not authorized", remote_number); + exit(EXIT_CNID_AUTH_FAILED); + } } /* @@ -1977,7 +1986,7 @@ set_allowed_addrs(unit, addrs, opts) } else { np = getnetbyname (ptr_word); if (np != NULL && np->n_addrtype == AF_INET) { - a = htonl (*(u_int32_t *)np->n_net); + a = htonl ((u_int32_t)np->n_net); if (ptr_mask == NULL) { /* calculate appropriate mask for net */ ah = ntohl(a);