diff options
author | Brian Somers <brian@FreeBSD.org> | 1998-04-24 19:16:15 +0000 |
---|---|---|
committer | Brian Somers <brian@FreeBSD.org> | 1998-04-24 19:16:15 +0000 |
commit | 643f49047ececa129a0e3f5e08ff3bfad942cb0c (patch) | |
tree | 79f9079096873749d6ea9099d51d04ca6e50829d /usr.sbin/ppp/auth.c | |
parent | d47dceb8ab559ef2bdfb22ce45ee6e7560dbd039 (diff) | |
download | src-643f49047ececa129a0e3f5e08ff3bfad942cb0c.tar.gz src-643f49047ececa129a0e3f5e08ff3bfad942cb0c.zip |
o Defer setting up pap/chap based IP numbers & labels until after
we've determined if we're going to join another ppp invocation.
o Make ``show link'' show all link details, and ``show links''
just give a list of links and their current status.
o Show our current label in ``show bundle''.
o Allow link cloning and removal as soon as our MRRU is set.
o Make ``show lcp'' require context as nothing will ever change
in our MP LCP (it's auto-configured as per rfc1990).
o Initialise our LQM owner in hdlc_Init().
o Store our endpoint discriminator and authentication name at both
the datalink and multilink level and compare them when we've
finished AUTHENTICATE phase and before entering NETWORK phase.
If they don't match, close the link again.
Display the information in the appropriate ``show'' command.
o Initialise datalink::phone and datalink::fsmp.object properly
when we're cloning the link.
o Show which link we're passing LQRs on in our diagnostics.
o Reject endpoint discriminator REQs at the logical multilink
level.
o Remove the rest of our CARRIER and LINK logging setup.
Notes
Notes:
svn path=/cvs2svn/branches/MP/; revision=35432
Diffstat (limited to 'usr.sbin/ppp/auth.c')
-rw-r--r-- | usr.sbin/ppp/auth.c | 91 |
1 files changed, 60 insertions, 31 deletions
diff --git a/usr.sbin/ppp/auth.c b/usr.sbin/ppp/auth.c index 1aa6a6ef70bc..aeda3072a10e 100644 --- a/usr.sbin/ppp/auth.c +++ b/usr.sbin/ppp/auth.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: auth.c,v 1.27.2.22 1998/04/19 15:24:34 brian Exp $ + * $Id: auth.c,v 1.27.2.23 1998/04/23 03:22:43 brian Exp $ * * TODO: * o Implement check against with registered IP addresses. @@ -86,7 +86,56 @@ auth_CheckPasswd(const char *name, const char *data, const char *key) } int -AuthValidate(struct bundle *bundle, const char *fname, const char *system, +AuthSelect(struct bundle *bundle, const char *name, struct physical *physical) +{ + FILE *fp; + int n; + char *vector[5]; + char buff[LINE_LEN]; + + if (*name == '\0') { + ipcp_Setup(&bundle->ncp.ipcp); + return 1; + } + + fp = OpenSecret(SECRETFILE); + if (fp != NULL) { + while (fgets(buff, sizeof buff, fp)) { + if (buff[0] == '#') + continue; + buff[strlen(buff) - 1] = 0; + memset(vector, '\0', sizeof vector); + n = MakeArgs(buff, vector, VECSIZE(vector)); + if (n < 2) + continue; + if (strcmp(vector[0], name) == 0) + CloseSecret(fp); +/* + memset(&bundle->ncp.ipcp.cfg.peer_range, '\0', + sizeof bundle->ncp.ipcp.cfg.peer_range); +*/ + if (n > 2 && !UseHisaddr(bundle, vector[2], 1)) + return 0; + ipcp_Setup(&bundle->ncp.ipcp); + if (n > 3) + bundle_SetLabel(bundle, vector[3]); + return 1; /* Valid */ + } + CloseSecret(fp); + } + +#ifndef NOPASSWDAUTH + /* Let 'em in anyway - they must have been in the passwd file */ + ipcp_Setup(&bundle->ncp.ipcp); + return 1; +#else + /* Disappeared from ppp.secret ? */ + return 0; +#endif +} + +int +AuthValidate(struct bundle *bundle, const char *system, const char *key, struct physical *physical) { /* Used by PAP routines */ @@ -96,7 +145,7 @@ AuthValidate(struct bundle *bundle, const char *fname, const char *system, char *vector[5]; char buff[LINE_LEN]; - fp = OpenSecret(fname); + fp = OpenSecret(SECRETFILE); if (fp != NULL) { while (fgets(buff, sizeof buff, fp)) { if (buff[0] == '#') @@ -106,20 +155,10 @@ AuthValidate(struct bundle *bundle, const char *fname, const char *system, n = MakeArgs(buff, vector, VECSIZE(vector)); if (n < 2) continue; - if (strcmp(vector[0], system) == 0) - if (auth_CheckPasswd(vector[0], vector[1], key)) { - CloseSecret(fp); - if (n > 2 && !UseHisaddr(bundle, vector[2], 1)) - return (0); - /* XXX This should be deferred - we may join an existing bundle ! */ - ipcp_Setup(&bundle->ncp.ipcp); - if (n > 3) - bundle_SetLabel(bundle, vector[3]); - return 1; /* Valid */ - } else { - CloseSecret(fp); - return 0; /* Invalid */ - } + if (strcmp(vector[0], system) == 0) { + CloseSecret(fp); + return auth_CheckPasswd(vector[0], vector[1], key); + } } CloseSecret(fp); } @@ -133,8 +172,8 @@ AuthValidate(struct bundle *bundle, const char *fname, const char *system, } char * -AuthGetSecret(struct bundle *bundle, const char *fname, const char *system, - int len, int setaddr, struct physical *physical) +AuthGetSecret(struct bundle *bundle, const char *system, int len, + struct physical *physical) { /* Used by CHAP routines */ @@ -143,7 +182,7 @@ AuthGetSecret(struct bundle *bundle, const char *fname, const char *system, char *vector[5]; static char buff[LINE_LEN]; - fp = OpenSecret(fname); + fp = OpenSecret(SECRETFILE); if (fp == NULL) return (NULL); @@ -156,17 +195,7 @@ AuthGetSecret(struct bundle *bundle, const char *fname, const char *system, if (n < 2) continue; if (strlen(vector[0]) == len && strncmp(vector[0], system, len) == 0) { - if (setaddr) - memset(&bundle->ncp.ipcp.cfg.peer_range, '\0', - sizeof bundle->ncp.ipcp.cfg.peer_range); - if (n > 2 && setaddr) - if (UseHisaddr(bundle, vector[2], 1)) - /* XXX This should be deferred - we may join an existing bundle ! */ - ipcp_Setup(&bundle->ncp.ipcp); - else - return NULL; - if (n > 3) - bundle_SetLabel(bundle, vector[3]); + CloseSecret(fp); return vector[1]; } } |