[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.361 and 1.362

version 1.361, 2021/07/23 04:04:52 version 1.362, 2021/09/15 06:56:01
Line 1997 
Line 1997 
   
         case oCanonicalizePermittedCNAMEs:          case oCanonicalizePermittedCNAMEs:
                 value = options->num_permitted_cnames != 0;                  value = options->num_permitted_cnames != 0;
                   i = 0;
                 while ((arg = argv_next(&ac, &av)) != NULL) {                  while ((arg = argv_next(&ac, &av)) != NULL) {
                         /* Either '*' for everything or 'list:list' */                          /*
                         if (strcmp(arg, "*") == 0)                           * Either 'none' (only in first position), '*' for
                            * everything or 'list:list'
                            */
                           if (strcasecmp(arg, "none") == 0) {
                                   if (i > 0 || ac > 0) {
                                           error("%s line %d: keyword %s \"none\" "
                                               "argument must appear alone.",
                                               filename, linenum, keyword);
                                           goto out;
                                   }
                                   arg2 = "";
                           } else if (strcmp(arg, "*") == 0) {
                                 arg2 = arg;                                  arg2 = arg;
                         else {                          } else {
                                 lowercase(arg);                                  lowercase(arg);
                                 if ((arg2 = strchr(arg, ':')) == NULL ||                                  if ((arg2 = strchr(arg, ':')) == NULL ||
                                     arg2[1] == '\0') {                                      arg2[1] == '\0') {
Line 2013 
Line 2025 
                                 *arg2 = '\0';                                  *arg2 = '\0';
                                 arg2++;                                  arg2++;
                         }                          }
                           i++;
                         if (!*activep || value)                          if (!*activep || value)
                                 continue;                                  continue;
                         if (options->num_permitted_cnames >=                          if (options->num_permitted_cnames >=
Line 2267 
Line 2280 
 }  }
   
 /*  /*
    * Returns 1 if CanonicalizePermittedCNAMEs have been specified, 0 otherwise.
    * Allowed to be called on non-final configuration.
    */
   int
   config_has_permitted_cnames(Options *options)
   {
           if (options->num_permitted_cnames == 1 &&
               strcasecmp(options->permitted_cnames[0].source_list, "none") == 0 &&
               strcmp(options->permitted_cnames[0].target_list, "") == 0)
                   return 0;
           return options->num_permitted_cnames > 0;
   }
   
   /*
  * Initializes options to special values that indicate that they have not yet   * Initializes options to special values that indicate that they have not yet
  * been set.  Read_config_file will only set options with this value. Options   * been set.  Read_config_file will only set options with this value. Options
  * are processed in the following order: command line, user config file,   * are processed in the following order: command line, user config file,
Line 2627 
Line 2654 
                 free(options->jump_host);                  free(options->jump_host);
                 options->jump_host = NULL;                  options->jump_host = NULL;
         }          }
           if (options->num_permitted_cnames == 1 &&
               !config_has_permitted_cnames(options)) {
                   /* clean up CanonicalizePermittedCNAMEs=none */
                   free(options->permitted_cnames[0].source_list);
                   free(options->permitted_cnames[0].target_list);
                   memset(options->permitted_cnames, '\0',
                       sizeof(*options->permitted_cnames));
                   options->num_permitted_cnames = 0;
           }
         /* options->identity_agent distinguishes NULL from 'none' */          /* options->identity_agent distinguishes NULL from 'none' */
         /* options->user will be set in the main program if appropriate */          /* options->user will be set in the main program if appropriate */
         /* options->hostname will be set in the main program if appropriate */          /* options->hostname will be set in the main program if appropriate */
Line 3342 
Line 3378 
         printf("\n");          printf("\n");
   
         /* oCanonicalizePermittedCNAMEs */          /* oCanonicalizePermittedCNAMEs */
         if ( o->num_permitted_cnames > 0) {          printf("canonicalizePermittedcnames");
                 printf("canonicalizePermittedcnames");          if (o->num_permitted_cnames == 0)
                 for (i = 0; i < o->num_permitted_cnames; i++) {                  printf("none");
                         printf(" %s:%s", o->permitted_cnames[i].source_list,          for (i = 0; i < o->num_permitted_cnames; i++) {
                             o->permitted_cnames[i].target_list);                  printf(" %s:%s", o->permitted_cnames[i].source_list,
                 }                      o->permitted_cnames[i].target_list);
                 printf("\n");  
         }          }
           printf("\n");
   
         /* oControlPersist */          /* oControlPersist */
         if (o->control_persist == 0 || o->control_persist_timeout == 0)          if (o->control_persist == 0 || o->control_persist_timeout == 0)

Legend:
Removed from v.1.361  
changed lines
  Added in v.1.362