Patch that allows equal sign in options
Stefan Heinrichs
stheinri at hamilton1.physik.uni-konstanz.de
Sat Feb 5 07:40:27 EST 2000
Hi,
Here is a patch for release 1.2.2 that allows the use of '=' instead
of whitespace when specifying options. For options on the commandline,
it can be useful to be able to avoid whitespace in some situations.
best regards and thanks for the patch regarding segfaulting with PAM,
Stefan
-------------------------------------------------------------------
Email: Stefan.Heinrichs at uni-konstanz.de
Address: Fakulaet fuer Physik, Universitaet Konstanz,
Universitaetsstr.10, 78457 Konstanz, Germany
Phone: +49 7531 88 3814
=============================================================================
--- readconf.c.orig Mon Dec 6 01:47:29 1999
+++ readconf.c Thu Feb 3 22:37:54 2000
@@ -156,6 +156,7 @@
/* Characters considered whitespace in strtok calls. */
#define WHITESPACE " \t\r\n"
+#define WHITESPACE_EQ " \t\r\n="
/*
@@ -237,7 +238,7 @@
return 0;
/* Get the keyword. (Each line is supposed to begin with a keyword). */
- cp = strtok(cp, WHITESPACE);
+ cp = strtok(cp, WHITESPACE_EQ);
opcode = parse_token(cp, filename, linenum);
switch (opcode) {
@@ -248,7 +249,7 @@
case oForwardAgent:
intptr = &options->forward_agent;
parse_flag:
- cp = strtok(NULL, WHITESPACE);
+ cp = strtok(NULL, WHITESPACE_EQ);
if (!cp)
fatal("%.200s line %d: Missing yes/no argument.", filename, linenum);
value = 0; /* To avoid compiler warning... */
@@ -330,7 +331,7 @@
case oStrictHostKeyChecking:
intptr = &options->strict_host_key_checking;
- cp = strtok(NULL, WHITESPACE);
+ cp = strtok(NULL, WHITESPACE_EQ);
if (!cp)
fatal("%.200s line %d: Missing yes/no argument.",
filename, linenum);
@@ -364,7 +365,7 @@
goto parse_int;
case oIdentityFile:
- cp = strtok(NULL, WHITESPACE);
+ cp = strtok(NULL, WHITESPACE_EQ);
if (!cp)
fatal("%.200s line %d: Missing argument.", filename, linenum);
if (*activep) {
@@ -378,7 +379,7 @@
case oUser:
charptr = &options->user;
parse_string:
- cp = strtok(NULL, WHITESPACE);
+ cp = strtok(NULL, WHITESPACE_EQ);
if (!cp)
fatal("%.200s line %d: Missing argument.", filename, linenum);
if (*activep && *charptr == NULL)
@@ -400,7 +401,7 @@
case oProxyCommand:
charptr = &options->proxy_command;
string = xstrdup("");
- while ((cp = strtok(NULL, WHITESPACE)) != NULL) {
+ while ((cp = strtok(NULL, WHITESPACE_EQ)) != NULL) {
string = xrealloc(string, strlen(string) + strlen(cp) + 2);
strcat(string, " ");
strcat(string, cp);
@@ -414,7 +415,7 @@
case oPort:
intptr = &options->port;
parse_int:
- cp = strtok(NULL, WHITESPACE);
+ cp = strtok(NULL, WHITESPACE_EQ);
if (!cp)
fatal("%.200s line %d: Missing argument.", filename, linenum);
if (cp[0] < '0' || cp[0] > '9')
@@ -434,7 +435,7 @@
case oCipher:
intptr = &options->cipher;
- cp = strtok(NULL, WHITESPACE);
+ cp = strtok(NULL, WHITESPACE_EQ);
value = cipher_number(cp);
if (value == -1)
fatal("%.200s line %d: Bad cipher '%s'.",
@@ -445,7 +446,7 @@
case oLogLevel:
intptr = (int *) &options->log_level;
- cp = strtok(NULL, WHITESPACE);
+ cp = strtok(NULL, WHITESPACE_EQ);
value = log_level_number(cp);
if (value == (LogLevel) - 1)
fatal("%.200s line %d: unsupported log level '%s'\n",
@@ -455,14 +456,14 @@
break;
case oRemoteForward:
- cp = strtok(NULL, WHITESPACE);
+ cp = strtok(NULL, WHITESPACE_EQ);
if (!cp)
fatal("%.200s line %d: Missing argument.", filename, linenum);
if (cp[0] < '0' || cp[0] > '9')
fatal("%.200s line %d: Badly formatted port number.",
filename, linenum);
fwd_port = atoi(cp);
- cp = strtok(NULL, WHITESPACE);
+ cp = strtok(NULL, WHITESPACE_EQ);
if (!cp)
fatal("%.200s line %d: Missing second argument.",
filename, linenum);
@@ -474,14 +475,14 @@
break;
case oLocalForward:
- cp = strtok(NULL, WHITESPACE);
+ cp = strtok(NULL, WHITESPACE_EQ);
if (!cp)
fatal("%.200s line %d: Missing argument.", filename, linenum);
if (cp[0] < '0' || cp[0] > '9')
fatal("%.200s line %d: Badly formatted port number.",
filename, linenum);
fwd_port = atoi(cp);
- cp = strtok(NULL, WHITESPACE);
+ cp = strtok(NULL, WHITESPACE_EQ);
if (!cp)
fatal("%.200s line %d: Missing second argument.",
filename, linenum);
@@ -494,7 +495,7 @@
case oHost:
*activep = 0;
- while ((cp = strtok(NULL, WHITESPACE)) != NULL)
+ while ((cp = strtok(NULL, WHITESPACE_EQ)) != NULL)
if (match_pattern(host, cp)) {
debug("Applying options for %.100s", cp);
*activep = 1;
@@ -505,7 +506,7 @@
case oEscapeChar:
intptr = &options->escape_char;
- cp = strtok(NULL, WHITESPACE);
+ cp = strtok(NULL, WHITESPACE_EQ);
if (!cp)
fatal("%.200s line %d: Missing argument.", filename, linenum);
if (cp[0] == '^' && cp[2] == 0 &&
--- readconf.c.sv Mon Dec 6 01:47:29 1999
+++ readconf.c Thu Feb 3 22:37:54 2000
@@ -156,6 +156,7 @@
/* Characters considered whitespace in strtok calls. */
#define WHITESPACE " \t\r\n"
+#define WHITESPACE_EQ " \t\r\n="
/*
@@ -237,7 +238,7 @@
return 0;
/* Get the keyword. (Each line is supposed to begin with a keyword). */
- cp = strtok(cp, WHITESPACE);
+ cp = strtok(cp, WHITESPACE_EQ);
opcode = parse_token(cp, filename, linenum);
switch (opcode) {
@@ -248,7 +249,7 @@
case oForwardAgent:
intptr = &options->forward_agent;
parse_flag:
- cp = strtok(NULL, WHITESPACE);
+ cp = strtok(NULL, WHITESPACE_EQ);
if (!cp)
fatal("%.200s line %d: Missing yes/no argument.", filename, linenum);
value = 0; /* To avoid compiler warning... */
@@ -330,7 +331,7 @@
case oStrictHostKeyChecking:
intptr = &options->strict_host_key_checking;
- cp = strtok(NULL, WHITESPACE);
+ cp = strtok(NULL, WHITESPACE_EQ);
if (!cp)
fatal("%.200s line %d: Missing yes/no argument.",
filename, linenum);
@@ -364,7 +365,7 @@
goto parse_int;
case oIdentityFile:
- cp = strtok(NULL, WHITESPACE);
+ cp = strtok(NULL, WHITESPACE_EQ);
if (!cp)
fatal("%.200s line %d: Missing argument.", filename, linenum);
if (*activep) {
@@ -378,7 +379,7 @@
case oUser:
charptr = &options->user;
parse_string:
- cp = strtok(NULL, WHITESPACE);
+ cp = strtok(NULL, WHITESPACE_EQ);
if (!cp)
fatal("%.200s line %d: Missing argument.", filename, linenum);
if (*activep && *charptr == NULL)
@@ -400,7 +401,7 @@
case oProxyCommand:
charptr = &options->proxy_command;
string = xstrdup("");
- while ((cp = strtok(NULL, WHITESPACE)) != NULL) {
+ while ((cp = strtok(NULL, WHITESPACE_EQ)) != NULL) {
string = xrealloc(string, strlen(string) + strlen(cp) + 2);
strcat(string, " ");
strcat(string, cp);
@@ -414,7 +415,7 @@
case oPort:
intptr = &options->port;
parse_int:
- cp = strtok(NULL, WHITESPACE);
+ cp = strtok(NULL, WHITESPACE_EQ);
if (!cp)
fatal("%.200s line %d: Missing argument.", filename, linenum);
if (cp[0] < '0' || cp[0] > '9')
@@ -434,7 +435,7 @@
case oCipher:
intptr = &options->cipher;
- cp = strtok(NULL, WHITESPACE);
+ cp = strtok(NULL, WHITESPACE_EQ);
value = cipher_number(cp);
if (value == -1)
fatal("%.200s line %d: Bad cipher '%s'.",
@@ -445,7 +446,7 @@
case oLogLevel:
intptr = (int *) &options->log_level;
- cp = strtok(NULL, WHITESPACE);
+ cp = strtok(NULL, WHITESPACE_EQ);
value = log_level_number(cp);
if (value == (LogLevel) - 1)
fatal("%.200s line %d: unsupported log level '%s'\n",
@@ -455,14 +456,14 @@
break;
case oRemoteForward:
- cp = strtok(NULL, WHITESPACE);
+ cp = strtok(NULL, WHITESPACE_EQ);
if (!cp)
fatal("%.200s line %d: Missing argument.", filename, linenum);
if (cp[0] < '0' || cp[0] > '9')
fatal("%.200s line %d: Badly formatted port number.",
filename, linenum);
fwd_port = atoi(cp);
- cp = strtok(NULL, WHITESPACE);
+ cp = strtok(NULL, WHITESPACE_EQ);
if (!cp)
fatal("%.200s line %d: Missing second argument.",
filename, linenum);
@@ -474,14 +475,14 @@
break;
case oLocalForward:
- cp = strtok(NULL, WHITESPACE);
+ cp = strtok(NULL, WHITESPACE_EQ);
if (!cp)
fatal("%.200s line %d: Missing argument.", filename, linenum);
if (cp[0] < '0' || cp[0] > '9')
fatal("%.200s line %d: Badly formatted port number.",
filename, linenum);
fwd_port = atoi(cp);
- cp = strtok(NULL, WHITESPACE);
+ cp = strtok(NULL, WHITESPACE_EQ);
if (!cp)
fatal("%.200s line %d: Missing second argument.",
filename, linenum);
@@ -494,7 +495,7 @@
case oHost:
*activep = 0;
- while ((cp = strtok(NULL, WHITESPACE)) != NULL)
+ while ((cp = strtok(NULL, WHITESPACE_EQ)) != NULL)
if (match_pattern(host, cp)) {
debug("Applying options for %.100s", cp);
*activep = 1;
@@ -505,7 +506,7 @@
case oEscapeChar:
intptr = &options->escape_char;
- cp = strtok(NULL, WHITESPACE);
+ cp = strtok(NULL, WHITESPACE_EQ);
if (!cp)
fatal("%.200s line %d: Missing argument.", filename, linenum);
if (cp[0] == '^' && cp[2] == 0 &&
More information about the openssh-unix-dev
mailing list