summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/auth.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1997-09-04 00:38:22 +0000
committerbrian <brian@FreeBSD.org>1997-09-04 00:38:22 +0000
commit01052674bd9cd2de028c4c476a70fa10439f5e6a (patch)
tree053c5b0cbcff9693f61532dc918acb018a8ceebf /usr.sbin/ppp/auth.c
parenta69830cd9ab89aec27c439dd58e7f6af6ff655f1 (diff)
downloadFreeBSD-src-01052674bd9cd2de028c4c476a70fa10439f5e6a.zip
FreeBSD-src-01052674bd9cd2de028c4c476a70fa10439f5e6a.tar.gz
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"
Diffstat (limited to 'usr.sbin/ppp/auth.c')
-rw-r--r--usr.sbin/ppp/auth.c25
1 files changed, 13 insertions, 12 deletions
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];
OpenPOWER on IntegriCloud