[BACK]Return to readconf.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/readconf.c between version 1.41 and 1.42

version 1.41, 2000/07/11 19:17:44 version 1.42, 2000/07/13 22:53:21
Line 164 
Line 164 
         { NULL, 0 }          { NULL, 0 }
 };  };
   
 /* Characters considered whitespace in strsep calls. */  
 #define WHITESPACE " \t\r\n="  
   
   
 /*  /*
  * Adds a local TCP/IP port forward to options.  Never returns if there is an   * Adds a local TCP/IP port forward to options.  Never returns if there is an
  * error.   * error.
Line 241 
Line 237 
         int opcode, *intptr, value;          int opcode, *intptr, value;
         u_short fwd_port, fwd_host_port;          u_short fwd_port, fwd_host_port;
   
         /* Skip leading whitespace. */          s = line;
         s = line + strspn(line, WHITESPACE);          /* Get the keyword. (Each line is supposed to begin with a keyword). */
         if (!*s || *s == '\n' || *s == '#')          keyword = strdelim(&s);
           /* Ignore leading whitespace. */
           if (*keyword == '\0')
                   keyword = s;
           if (!*keyword || *keyword == '\n' || *keyword == '#')
                 return 0;                  return 0;
   
         /* Get the keyword. (Each line is supposed to begin with a keyword). */  
         keyword = strsep(&s, WHITESPACE);  
         opcode = parse_token(keyword, filename, linenum);          opcode = parse_token(keyword, filename, linenum);
   
         switch (opcode) {          switch (opcode) {
Line 258 
Line 256 
         case oForwardAgent:          case oForwardAgent:
                 intptr = &options->forward_agent;                  intptr = &options->forward_agent;
 parse_flag:  parse_flag:
                 arg = strsep(&s, WHITESPACE);                  arg = strdelim(&s);
                 if (!arg || *arg == '\0')                  if (!arg || *arg == '\0')
                         fatal("%.200s line %d: Missing yes/no argument.", filename, linenum);                          fatal("%.200s line %d: Missing yes/no argument.", filename, linenum);
                 value = 0;      /* To avoid compiler warning... */                  value = 0;      /* To avoid compiler warning... */
Line 344 
Line 342 
   
         case oStrictHostKeyChecking:          case oStrictHostKeyChecking:
                 intptr = &options->strict_host_key_checking;                  intptr = &options->strict_host_key_checking;
                 arg = strsep(&s, WHITESPACE);                  arg = strdelim(&s);
                 if (!arg || *arg == '\0')                  if (!arg || *arg == '\0')
                         fatal("%.200s line %d: Missing yes/no argument.",                          fatal("%.200s line %d: Missing yes/no argument.",
                               filename, linenum);                                filename, linenum);
Line 379 
Line 377 
   
         case oIdentityFile:          case oIdentityFile:
         case oIdentityFile2:          case oIdentityFile2:
                 arg = strsep(&s, WHITESPACE);                  arg = strdelim(&s);
                 if (!arg || *arg == '\0')                  if (!arg || *arg == '\0')
                         fatal("%.200s line %d: Missing argument.", filename, linenum);                          fatal("%.200s line %d: Missing argument.", filename, linenum);
                 if (*activep) {                  if (*activep) {
Line 404 
Line 402 
         case oUser:          case oUser:
                 charptr = &options->user;                  charptr = &options->user;
 parse_string:  parse_string:
                 arg = strsep(&s, WHITESPACE);                  arg = strdelim(&s);
                 if (!arg || *arg == '\0')                  if (!arg || *arg == '\0')
                         fatal("%.200s line %d: Missing argument.", filename, linenum);                          fatal("%.200s line %d: Missing argument.", filename, linenum);
                 if (*activep && *charptr == NULL)                  if (*activep && *charptr == NULL)
Line 434 
Line 432 
         case oProxyCommand:          case oProxyCommand:
                 charptr = &options->proxy_command;                  charptr = &options->proxy_command;
                 string = xstrdup("");                  string = xstrdup("");
                 while ((arg = strsep(&s, WHITESPACE)) != NULL && *arg != '\0') {                  while ((arg = strdelim(&s)) != NULL && *arg != '\0') {
                         string = xrealloc(string, strlen(string) + strlen(arg) + 2);                          string = xrealloc(string, strlen(string) + strlen(arg) + 2);
                         strcat(string, " ");                          strcat(string, " ");
                         strcat(string, arg);                          strcat(string, arg);
Line 448 
Line 446 
         case oPort:          case oPort:
                 intptr = &options->port;                  intptr = &options->port;
 parse_int:  parse_int:
                 arg = strsep(&s, WHITESPACE);                  arg = strdelim(&s);
                 if (!arg || *arg == '\0')                  if (!arg || *arg == '\0')
                         fatal("%.200s line %d: Missing argument.", filename, linenum);                          fatal("%.200s line %d: Missing argument.", filename, linenum);
                 if (arg[0] < '0' || arg[0] > '9')                  if (arg[0] < '0' || arg[0] > '9')
Line 468 
Line 466 
   
         case oCipher:          case oCipher:
                 intptr = &options->cipher;                  intptr = &options->cipher;
                 arg = strsep(&s, WHITESPACE);                  arg = strdelim(&s);
                 if (!arg || *arg == '\0')                  if (!arg || *arg == '\0')
                         fatal("%.200s line %d: Missing argument.", filename, linenum);                          fatal("%.200s line %d: Missing argument.", filename, linenum);
                 value = cipher_number(arg);                  value = cipher_number(arg);
Line 480 
Line 478 
                 break;                  break;
   
         case oCiphers:          case oCiphers:
                 arg = strsep(&s, WHITESPACE);                  arg = strdelim(&s);
                 if (!arg || *arg == '\0')                  if (!arg || *arg == '\0')
                         fatal("%.200s line %d: Missing argument.", filename, linenum);                          fatal("%.200s line %d: Missing argument.", filename, linenum);
                 if (!ciphers_valid(arg))                  if (!ciphers_valid(arg))
Line 492 
Line 490 
   
         case oProtocol:          case oProtocol:
                 intptr = &options->protocol;                  intptr = &options->protocol;
                 arg = strsep(&s, WHITESPACE);                  arg = strdelim(&s);
                 if (!arg || *arg == '\0')                  if (!arg || *arg == '\0')
                         fatal("%.200s line %d: Missing argument.", filename, linenum);                          fatal("%.200s line %d: Missing argument.", filename, linenum);
                 value = proto_spec(arg);                  value = proto_spec(arg);
Line 505 
Line 503 
   
         case oLogLevel:          case oLogLevel:
                 intptr = (int *) &options->log_level;                  intptr = (int *) &options->log_level;
                 arg = strsep(&s, WHITESPACE);                  arg = strdelim(&s);
                 value = log_level_number(arg);                  value = log_level_number(arg);
                 if (value == (LogLevel) - 1)                  if (value == (LogLevel) - 1)
                         fatal("%.200s line %d: unsupported log level '%s'\n",                          fatal("%.200s line %d: unsupported log level '%s'\n",
Line 515 
Line 513 
                 break;                  break;
   
         case oRemoteForward:          case oRemoteForward:
                 arg = strsep(&s, WHITESPACE);                  arg = strdelim(&s);
                 if (!arg || *arg == '\0')                  if (!arg || *arg == '\0')
                         fatal("%.200s line %d: Missing argument.", filename, linenum);                          fatal("%.200s line %d: Missing argument.", filename, linenum);
                 if (arg[0] < '0' || arg[0] > '9')                  if (arg[0] < '0' || arg[0] > '9')
                         fatal("%.200s line %d: Badly formatted port number.",                          fatal("%.200s line %d: Badly formatted port number.",
                               filename, linenum);                                filename, linenum);
                 fwd_port = atoi(arg);                  fwd_port = atoi(arg);
                 arg = strsep(&s, WHITESPACE);                  arg = strdelim(&s);
                 if (!arg || *arg == '\0')                  if (!arg || *arg == '\0')
                         fatal("%.200s line %d: Missing second argument.",                          fatal("%.200s line %d: Missing second argument.",
                               filename, linenum);                                filename, linenum);
Line 534 
Line 532 
                 break;                  break;
   
         case oLocalForward:          case oLocalForward:
                 arg = strsep(&s, WHITESPACE);                  arg = strdelim(&s);
                 if (!arg || *arg == '\0')                  if (!arg || *arg == '\0')
                         fatal("%.200s line %d: Missing argument.", filename, linenum);                          fatal("%.200s line %d: Missing argument.", filename, linenum);
                 if (arg[0] < '0' || arg[0] > '9')                  if (arg[0] < '0' || arg[0] > '9')
                         fatal("%.200s line %d: Badly formatted port number.",                          fatal("%.200s line %d: Badly formatted port number.",
                               filename, linenum);                                filename, linenum);
                 fwd_port = atoi(arg);                  fwd_port = atoi(arg);
                 arg = strsep(&s, WHITESPACE);                  arg = strdelim(&s);
                 if (!arg || *arg == '\0')                  if (!arg || *arg == '\0')
                         fatal("%.200s line %d: Missing second argument.",                          fatal("%.200s line %d: Missing second argument.",
                               filename, linenum);                                filename, linenum);
Line 554 
Line 552 
   
         case oHost:          case oHost:
                 *activep = 0;                  *activep = 0;
                 while ((arg = strsep(&s, WHITESPACE)) != NULL && *arg != '\0')                  while ((arg = strdelim(&s)) != NULL && *arg != '\0')
                         if (match_pattern(host, arg)) {                          if (match_pattern(host, arg)) {
                                 debug("Applying options for %.100s", arg);                                  debug("Applying options for %.100s", arg);
                                 *activep = 1;                                  *activep = 1;
                                 break;                                  break;
                         }                          }
                 /* Avoid garbage check below, as strsep is done. */                  /* Avoid garbage check below, as strdelim is done. */
                 return 0;                  return 0;
   
         case oEscapeChar:          case oEscapeChar:
                 intptr = &options->escape_char;                  intptr = &options->escape_char;
                 arg = strsep(&s, WHITESPACE);                  arg = strdelim(&s);
                 if (!arg || *arg == '\0')                  if (!arg || *arg == '\0')
                         fatal("%.200s line %d: Missing argument.", filename, linenum);                          fatal("%.200s line %d: Missing argument.", filename, linenum);
                 if (arg[0] == '^' && arg[2] == 0 &&                  if (arg[0] == '^' && arg[2] == 0 &&
Line 590 
Line 588 
         }          }
   
         /* Check that there is no garbage at end of line. */          /* Check that there is no garbage at end of line. */
         if ((arg = strsep(&s, WHITESPACE)) != NULL && *arg != '\0')          if ((arg = strdelim(&s)) != NULL && *arg != '\0')
         {          {
                 fatal("%.200s line %d: garbage at end of line; \"%.200s\".",                  fatal("%.200s line %d: garbage at end of line; \"%.200s\".",
                       filename, linenum, arg);                        filename, linenum, arg);

Legend:
Removed from v.1.41  
changed lines
  Added in v.1.42