diff options
author | brian <brian@FreeBSD.org> | 1998-08-07 18:42:51 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1998-08-07 18:42:51 +0000 |
commit | f9ee8808e7fd6798eb442188b9b4b8e23c461f07 (patch) | |
tree | 4a1f01689ab26830c419f0100830cd94b3e03a62 /usr.sbin/ppp/auth.c | |
parent | da1fbd5e2562a9182735d47266f718c37ce51225 (diff) | |
download | FreeBSD-src-f9ee8808e7fd6798eb442188b9b4b8e23c461f07.zip FreeBSD-src-f9ee8808e7fd6798eb442188b9b4b8e23c461f07.tar.gz |
o Support callback types NONE, E.164, AUTH and CBCP.
(see the new ``set callback'' and ``set cbcp'' commands)
o Add a ``cbcp'' log level and mbuf type.
o Don't dump core when \T is given in ``set login'' or
``set hangup''.
o Allow ``*'' and blanks as placeholders in ppp.secret and
allow a fifth field for specifying auth/cbcp dialback
parameters.
o Remove a few extraneous #includes
o Define the default number of REQs (restart counter) in defs.h
rather than hardcoding ``5'' all over the place.
o Fix a few man page inconsistencies.
Diffstat (limited to 'usr.sbin/ppp/auth.c')
-rw-r--r-- | usr.sbin/ppp/auth.c | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/usr.sbin/ppp/auth.c b/usr.sbin/ppp/auth.c index 420a32b..811709e 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.30 1998/06/15 19:06:35 brian Exp $ + * $Id: auth.c,v 1.31 1998/07/19 21:07:24 brian Exp $ * * TODO: * o Implement check against with registered IP addresses. @@ -87,7 +87,40 @@ auth_CheckPasswd(const char *name, const char *data, const char *key) } int -auth_Select(struct bundle *bundle, const char *name, struct physical *physical) +auth_SetPhoneList(const char *name, char *phone, int phonelen) +{ + FILE *fp; + int n; + char *vector[6]; + char buff[LINE_LEN]; + + 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 < 5) + continue; + if (strcmp(vector[0], name) == 0) { + CloseSecret(fp); + if (*vector[4] == '\0') + return 0; + strncpy(phone, vector[4], phonelen - 1); + phone[phonelen - 1] = '\0'; + return 1; /* Valid */ + } + } + CloseSecret(fp); + } + *phone = '\0'; + return 0; +} + +int +auth_Select(struct bundle *bundle, const char *name) { FILE *fp; int n; @@ -111,10 +144,11 @@ auth_Select(struct bundle *bundle, const char *name, struct physical *physical) continue; if (strcmp(vector[0], name) == 0) { CloseSecret(fp); - if (n > 2 && !ipcp_UseHisaddr(bundle, vector[2], 1)) + if (n > 2 && *vector[2] && strcmp(vector[2], "*") && + !ipcp_UseHisaddr(bundle, vector[2], 1)) return 0; ipcp_Setup(&bundle->ncp.ipcp); - if (n > 3) + if (n > 3 && *vector[3] && strcmp(vector[3], "*")) bundle_SetLabel(bundle, vector[3]); return 1; /* Valid */ } |