diff options
Diffstat (limited to 'usr.sbin/ppp/systems.c')
| -rw-r--r-- | usr.sbin/ppp/systems.c | 44 |
1 files changed, 10 insertions, 34 deletions
diff --git a/usr.sbin/ppp/systems.c b/usr.sbin/ppp/systems.c index f786b1bc57760..e5583f661dd4b 100644 --- a/usr.sbin/ppp/systems.c +++ b/usr.sbin/ppp/systems.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: systems.c,v 1.39 1998/10/17 12:28:03 brian Exp $ + * $Id: systems.c,v 1.37 1998/06/15 19:05:47 brian Exp $ * * TODO: */ @@ -156,10 +156,7 @@ DecodeCtrlCommand(char *line, char *arg) return CTRL_UNKNOWN; } -/* - * Initialised in system_IsValid(), set in ReadSystem(), - * used by system_IsValid() - */ +/* Initialised in system_IsValid(), set in ReadSystem(), used by system_IsValid() */ static int modeok; static int userok; static int modereq; @@ -318,13 +315,8 @@ ReadSystem(struct bundle *bundle, const char *name, const char *file, if (*cp == '\0') /* empty / comment */ continue; - if (!indent) { /* start of next section */ - wp = strchr(cp, ':'); - if (doexec && (wp == NULL || wp[1] != '\0')) - log_Printf(LogWARN, "Unindented command (%s line %d) - ignored\n", - filename, linenum); + if (!indent) /* start of next section */ break; - } len = strlen(cp); argc = command_Interpret(cp, len, argv); @@ -344,38 +336,22 @@ ReadSystem(struct bundle *bundle, const char *name, const char *file, return -1; } -const char * +int system_IsValid(const char *name, struct prompt *prompt, int mode) { /* * Note: The ReadSystem() calls only result in calls to the Allow* * functions. arg->bundle will be set to NULL for these commands ! */ - int def; - - if (ID0realuid() == 0) { - userok = modeok = 1; - return NULL; - } - - def = !strcmp(name, "default"); + if (ID0realuid() == 0) + return userok = modeok = 1; userok = 0; modeok = 1; modereq = mode; - - if (ReadSystem(NULL, "default", CONFFILE, 0, prompt, NULL) != 0 && def) - return "System not found"; - - if (!def && ReadSystem(NULL, name, CONFFILE, 0, prompt, NULL) != 0) - return "System not found"; - - if (!userok) - return "Invalid user id"; - - if (!modeok) - return "Invalid mode"; - - return NULL; + ReadSystem(NULL, "default", CONFFILE, 0, prompt, NULL); + if (name != NULL) + ReadSystem(NULL, name, CONFFILE, 0, prompt, NULL); + return userok && modeok; } int |
