diff options
author | brian <brian@FreeBSD.org> | 1999-12-22 21:48:12 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1999-12-22 21:48:12 +0000 |
commit | baf28880b36151165091a7ac625d48a22daaf1fc (patch) | |
tree | d166f00f9abad88e11532235307232197541793c /usr.sbin | |
parent | 58518e59bd5ba53d638362dcfdbbd87ac09bf4ba (diff) | |
download | FreeBSD-src-baf28880b36151165091a7ac625d48a22daaf1fc.zip FreeBSD-src-baf28880b36151165091a7ac625d48a22daaf1fc.tar.gz |
Don't munge ``set dial|login|logout|hangup'' arguments before
ExpandString() has a chance to do its own substitutions.
Diffstat (limited to 'usr.sbin')
-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 == '#') |