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

Diff for /src/usr.bin/ssh/servconf.c between version 1.219 and 1.220

version 1.219, 2011/05/23 03:30:07 version 1.220, 2011/06/17 21:47:35
Line 632 
Line 632 
   
 #define WHITESPACE " \t\r\n"  #define WHITESPACE " \t\r\n"
   
   /* Multistate option parsing */
   struct multistate {
           char *key;
           int value;
   };
   static const struct multistate multistate_addressfamily[] = {
           { "inet",                       AF_INET },
           { "inet6",                      AF_INET6 },
           { "any",                        AF_UNSPEC },
           { NULL, -1 }
   };
   static const struct multistate multistate_permitrootlogin[] = {
           { "without-password",           PERMIT_NO_PASSWD },
           { "forced-commands-only",       PERMIT_FORCED_ONLY },
           { "yes",                        PERMIT_YES },
           { "no",                         PERMIT_NO },
           { NULL, -1 }
   };
   static const struct multistate multistate_compression[] = {
           { "delayed",                    COMP_DELAYED },
           { "yes",                        COMP_ZLIB },
           { "no",                         COMP_NONE },
           { NULL, -1 }
   };
   static const struct multistate multistate_gatewayports[] = {
           { "clientspecified",            2 },
           { "yes",                        1 },
           { "no",                         0 },
           { NULL, -1 }
   };
   
 int  int
 process_server_config_line(ServerOptions *options, char *line,  process_server_config_line(ServerOptions *options, char *line,
     const char *filename, int linenum, int *activep, const char *user,      const char *filename, int linenum, int *activep, const char *user,
Line 645 
Line 676 
         int port;          int port;
         u_int i, flags = 0;          u_int i, flags = 0;
         size_t len;          size_t len;
           const struct multistate *multistate_ptr;
   
         cp = line;          cp = line;
         if ((arg = strdelim(&cp)) == NULL)          if ((arg = strdelim(&cp)) == NULL)
Line 754 
Line 786 
                 break;                  break;
   
         case sAddressFamily:          case sAddressFamily:
                   intptr = &options->address_family;
                   multistate_ptr = multistate_addressfamily;
                   if (options->listen_addrs != NULL)
                           fatal("%s line %d: address family must be specified "
                               "before ListenAddress.", filename, linenum);
    parse_multistate:
                 arg = strdelim(&cp);                  arg = strdelim(&cp);
                 if (!arg || *arg == '\0')                  if (!arg || *arg == '\0')
                         fatal("%s line %d: missing address family.",                          fatal("%s line %d: missing argument.",
                             filename, linenum);                              filename, linenum);
                 intptr = &options->address_family;                  value = -1;
                 if (options->listen_addrs != NULL)                  for (i = 0; multistate_ptr[i].key != NULL; i++) {
                         fatal("%s line %d: address family must be specified before "                          if (strcasecmp(arg, multistate_ptr[i].key) == 0) {
                             "ListenAddress.", filename, linenum);                                  value = multistate_ptr[i].value;
                 if (strcasecmp(arg, "inet") == 0)                                  break;
                         value = AF_INET;                          }
                 else if (strcasecmp(arg, "inet6") == 0)                  }
                         value = AF_INET6;                  if (value == -1)
                 else if (strcasecmp(arg, "any") == 0)                          fatal("%s line %d: unsupported option \"%s\".",
                         value = AF_UNSPEC;  
                 else  
                         fatal("%s line %d: unsupported address family \"%s\".",  
                             filename, linenum, arg);                              filename, linenum, arg);
                 if (*intptr == -1)                  if (*activep && *intptr == -1)
                         *intptr = value;                          *intptr = value;
                 break;                  break;
   
Line 810 
Line 845 
   
         case sPermitRootLogin:          case sPermitRootLogin:
                 intptr = &options->permit_root_login;                  intptr = &options->permit_root_login;
                 arg = strdelim(&cp);                  multistate_ptr = multistate_permitrootlogin;
                 if (!arg || *arg == '\0')                  goto parse_multistate;
                         fatal("%s line %d: missing yes/"  
                             "without-password/forced-commands-only/no "  
                             "argument.", filename, linenum);  
                 value = 0;      /* silence compiler */  
                 if (strcmp(arg, "without-password") == 0)  
                         value = PERMIT_NO_PASSWD;  
                 else if (strcmp(arg, "forced-commands-only") == 0)  
                         value = PERMIT_FORCED_ONLY;  
                 else if (strcmp(arg, "yes") == 0)  
                         value = PERMIT_YES;  
                 else if (strcmp(arg, "no") == 0)  
                         value = PERMIT_NO;  
                 else  
                         fatal("%s line %d: Bad yes/"  
                             "without-password/forced-commands-only/no "  
                             "argument: %s", filename, linenum, arg);  
                 if (*activep && *intptr == -1)  
                         *intptr = value;  
                 break;  
   
         case sIgnoreRhosts:          case sIgnoreRhosts:
                 intptr = &options->ignore_rhosts;                  intptr = &options->ignore_rhosts;
Line 961 
Line 977 
   
         case sCompression:          case sCompression:
                 intptr = &options->compression;                  intptr = &options->compression;
                 arg = strdelim(&cp);                  multistate_ptr = multistate_compression;
                 if (!arg || *arg == '\0')                  goto parse_multistate;
                         fatal("%s line %d: missing yes/no/delayed "  
                             "argument.", filename, linenum);  
                 value = 0;      /* silence compiler */  
                 if (strcmp(arg, "delayed") == 0)  
                         value = COMP_DELAYED;  
                 else if (strcmp(arg, "yes") == 0)  
                         value = COMP_ZLIB;  
                 else if (strcmp(arg, "no") == 0)  
                         value = COMP_NONE;  
                 else  
                         fatal("%s line %d: Bad yes/no/delayed "  
                             "argument: %s", filename, linenum, arg);  
                 if (*intptr == -1)  
                         *intptr = value;  
                 break;  
   
         case sGatewayPorts:          case sGatewayPorts:
                 intptr = &options->gateway_ports;                  intptr = &options->gateway_ports;
                 arg = strdelim(&cp);                  multistate_ptr = multistate_gatewayports;
                 if (!arg || *arg == '\0')                  goto parse_multistate;
                         fatal("%s line %d: missing yes/no/clientspecified "  
                             "argument.", filename, linenum);  
                 value = 0;      /* silence compiler */  
                 if (strcmp(arg, "clientspecified") == 0)  
                         value = 2;  
                 else if (strcmp(arg, "yes") == 0)  
                         value = 1;  
                 else if (strcmp(arg, "no") == 0)  
                         value = 0;  
                 else  
                         fatal("%s line %d: Bad yes/no/clientspecified "  
                             "argument: %s", filename, linenum, arg);  
                 if (*activep && *intptr == -1)  
                         *intptr = value;  
                 break;  
   
         case sUseDNS:          case sUseDNS:
                 intptr = &options->use_dns;                  intptr = &options->use_dns;

Legend:
Removed from v.1.219  
changed lines
  Added in v.1.220