From 01052674bd9cd2de028c4c476a70fa10439f5e6a Mon Sep 17 00:00:00 2001 From: brian Date: Thu, 4 Sep 1997 00:38:22 +0000 Subject: Install as group ``network'' Insist that uid == 0 for client ppp Disallow client sockets if no password is specified Don't exit on failure to open client socket for listening Allow specification of null local password Use reasonable size (smaller) ``vector''s in auth.c Fix "passwd ..." usage message Insist on "all" as arg to "quit" (if any) Drop client socket connection before Cleanup() when "quit all" --- usr.sbin/ppp/auth.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'usr.sbin/ppp/auth.c') diff --git a/usr.sbin/ppp/auth.c b/usr.sbin/ppp/auth.c index 38e29cc..1ea18c9 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.14 1997/06/09 03:27:13 brian Exp $ + * $Id: auth.c,v 1.15 1997/08/25 00:29:05 brian Exp $ * * TODO: * o Implement check against with registered IP addresses. @@ -34,22 +34,22 @@ extern FILE *OpenSecret(); extern void CloseSecret(); -LOCAL_AUTH_VALID +void LocalAuthInit() { - char *p; if (gethostname(VarShortHost, sizeof(VarShortHost))) { - return (NOT_FOUND); + VarLocalAuth = LOCAL_DENY; + return; } + p = strchr(VarShortHost, '.'); if (p) *p = '\0'; - VarLocalAuth = LOCAL_NO_AUTH; - return LocalAuthValidate(SECRETFILE, VarShortHost, ""); - + VarLocalAuth = LocalAuthValidate(SECRETFILE, VarShortHost, "") == NOT_FOUND ? + LOCAL_DENY : LOCAL_NO_AUTH; } LOCAL_AUTH_VALID @@ -57,8 +57,8 @@ LocalAuthValidate(char *fname, char *system, char *key) { FILE *fp; int n; - char *vector[20]; /* XXX */ - char buff[200]; /* XXX */ + char *vector[3]; + char buff[200]; LOCAL_AUTH_VALID rc; rc = NOT_FOUND; /* No system entry */ @@ -74,7 +74,8 @@ LocalAuthValidate(char *fname, char *system, char *key) if (n < 1) continue; if (strcmp(vector[0], system) == 0) { - if (vector[1] != (char *) NULL && strcmp(vector[1], key) == 0) { + if ((vector[1] == (char *) NULL && (key == NULL || *key == '\0')) || + (vector[1] != (char *) NULL && strcmp(vector[1], key) == 0)) { rc = VALID; /* Valid */ } else { rc = INVALID; /* Invalid */ @@ -91,7 +92,7 @@ AuthValidate(char *fname, char *system, char *key) { FILE *fp; int n; - char *vector[20]; + char *vector[4]; char buff[200]; char passwd[100]; @@ -134,7 +135,7 @@ AuthGetSecret(char *fname, char *system, int len, int setaddr) { FILE *fp; int n; - char *vector[20]; + char *vector[4]; char buff[200]; static char passwd[100]; -- cgit v1.1