diff options
Diffstat (limited to 'usr.sbin/ppp')
-rw-r--r-- | usr.sbin/ppp/auth.c | 8 | ||||
-rw-r--r-- | usr.sbin/ppp/chat.c | 4 | ||||
-rw-r--r-- | usr.sbin/ppp/command.c | 2 | ||||
-rw-r--r-- | usr.sbin/ppp/defs.c | 15 | ||||
-rw-r--r-- | usr.sbin/ppp/defs.h | 4 | ||||
-rw-r--r-- | usr.sbin/ppp/exec.c | 2 | ||||
-rw-r--r-- | usr.sbin/ppp/systems.c | 2 |
7 files changed, 20 insertions, 17 deletions
diff --git a/usr.sbin/ppp/auth.c b/usr.sbin/ppp/auth.c index 7c66fcd..cc22b5e 100644 --- a/usr.sbin/ppp/auth.c +++ b/usr.sbin/ppp/auth.c @@ -117,7 +117,7 @@ auth_SetPhoneList(const char *name, char *phone, int phonelen) continue; buff[strlen(buff) - 1] = '\0'; memset(vector, '\0', sizeof vector); - if ((n = MakeArgs(buff, vector, VECSIZE(vector))) < 0) + if ((n = MakeArgs(buff, vector, VECSIZE(vector), 1)) < 0) log_Printf(LogWARN, "%s: %d: Invalid line\n", SECRETFILE, lineno); if (n < 5) continue; @@ -168,7 +168,7 @@ auth_Select(struct bundle *bundle, const char *name) continue; buff[strlen(buff) - 1] = '\0'; memset(vector, '\0', sizeof vector); - if ((n = MakeArgs(buff, vector, VECSIZE(vector))) < 0) + if ((n = MakeArgs(buff, vector, VECSIZE(vector), 1)) < 0) log_Printf(LogWARN, "%s: %d: Invalid line\n", SECRETFILE, lineno); if (n < 2) continue; @@ -227,7 +227,7 @@ auth_Validate(struct bundle *bundle, const char *name, continue; buff[strlen(buff) - 1] = 0; memset(vector, '\0', sizeof vector); - if ((n = MakeArgs(buff, vector, VECSIZE(vector))) < 0) + if ((n = MakeArgs(buff, vector, VECSIZE(vector), 1)) < 0) log_Printf(LogWARN, "%s: %d: Invalid line\n", SECRETFILE, lineno); if (n < 2) continue; @@ -271,7 +271,7 @@ auth_GetSecret(struct bundle *bundle, const char *name, int len, if (buff[n] == '\n') buff[n] = '\0'; /* Trim the '\n' */ memset(vector, '\0', sizeof vector); - if ((n = MakeArgs(buff, vector, VECSIZE(vector))) < 0) + if ((n = MakeArgs(buff, vector, VECSIZE(vector), 1)) < 0) log_Printf(LogWARN, "%s: %d: Invalid line\n", SECRETFILE, lineno); if (n < 2) continue; diff --git a/usr.sbin/ppp/chat.c b/usr.sbin/ppp/chat.c index ce7899e..499bc98 100644 --- a/usr.sbin/ppp/chat.c +++ b/usr.sbin/ppp/chat.c @@ -561,7 +561,7 @@ chat_Setup(struct chat *c, const char *data, const char *phone) } else { strncpy(c->script, data, sizeof c->script - 1); c->script[sizeof c->script - 1] = '\0'; - c->argc = MakeArgs(c->script, c->argv, VECSIZE(c->argv)); + c->argc = MakeArgs(c->script, c->argv, VECSIZE(c->argv), 0); } c->arg = -1; @@ -702,7 +702,7 @@ ExecStr(struct physical *physical, char *command, char *out, int olen) int stat, nb, argc, i; log_Printf(LogCHAT, "Exec: %s\n", command); - if ((argc = MakeArgs(command, vector, VECSIZE(vector))) <= 0) { + if ((argc = MakeArgs(command, vector, VECSIZE(vector), 1)) <= 0) { if (argc < 0) log_Printf(LogWARN, "Syntax error in exec command\n"); *out = '\0'; diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c index dd045d4..5ec071a 100644 --- a/usr.sbin/ppp/command.c +++ b/usr.sbin/ppp/command.c @@ -913,7 +913,7 @@ command_Interpret(char *buff, int nb, char *argv[MAXARGS]) cp = buff + strcspn(buff, "\r\n"); if (cp) *cp = '\0'; - return MakeArgs(buff, argv, MAXARGS); + return MakeArgs(buff, argv, MAXARGS, 1); } return 0; } diff --git a/usr.sbin/ppp/defs.c b/usr.sbin/ppp/defs.c index b7ee588..67472c4 100644 --- a/usr.sbin/ppp/defs.c +++ b/usr.sbin/ppp/defs.c @@ -264,13 +264,16 @@ IntToSpeed(int nspeed) } char * -findblank(char *p, int instring) +findblank(char *p, int instring, int reduce) { while (*p) { if (*p == '\\') { - memmove(p, p + 1, strlen(p)); - if (!*p) - break; + if (reduce) { + memmove(p, p + 1, strlen(p)); + if (!*p) + break; + } else + p++; } else if ((instring && *p == '"') || (!instring && (issep(*p) || *p == '#'))) return p; @@ -281,7 +284,7 @@ findblank(char *p, int instring) } int -MakeArgs(char *script, char **pvect, int maxargs) +MakeArgs(char *script, char **pvect, int maxargs, int reduce) { int nargs, nb; int instring; @@ -303,7 +306,7 @@ MakeArgs(char *script, char **pvect, int maxargs) break; *pvect++ = script; nargs++; - script = findblank(script, instring); + script = findblank(script, instring, reduce); if (script == NULL) return -1; else if (*script == '#') diff --git a/usr.sbin/ppp/defs.h b/usr.sbin/ppp/defs.h index 0a51081..c218427 100644 --- a/usr.sbin/ppp/defs.h +++ b/usr.sbin/ppp/defs.h @@ -98,5 +98,5 @@ extern int Nam2mode(const char *); extern struct in_addr GetIpAddr(const char *); extern int SpeedToInt(speed_t); extern speed_t IntToSpeed(int); -extern char *findblank(char *, int); -extern int MakeArgs(char *, char **, int); +extern char *findblank(char *, int, int); +extern int MakeArgs(char *, char **, int, int); diff --git a/usr.sbin/ppp/exec.c b/usr.sbin/ppp/exec.c index 0ded3cb..cc89964 100644 --- a/usr.sbin/ppp/exec.c +++ b/usr.sbin/ppp/exec.c @@ -141,7 +141,7 @@ exec_Create(struct physical *p) log_Printf(LogDEBUG, "Exec'ing ``%s''\n", p->name.base); - if ((argc = MakeArgs(p->name.base, argv, VECSIZE(argv))) < 0) { + if ((argc = MakeArgs(p->name.base, argv, VECSIZE(argv), 1)) < 0) { log_Printf(LogWARN, "Syntax error in exec command\n"); _exit(127); } diff --git a/usr.sbin/ppp/systems.c b/usr.sbin/ppp/systems.c index 935e871..85be3a5 100644 --- a/usr.sbin/ppp/systems.c +++ b/usr.sbin/ppp/systems.c @@ -320,7 +320,7 @@ ReadSystem(struct bundle *bundle, const char *name, const char *file, break; default: - if ((wp = findblank(cp, 0)) != NULL) { + if ((wp = findblank(cp, 0, 1)) != NULL) { while (issep(*wp)) *wp++ = '\0'; if (*wp == '#') |