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

Diff for /src/usr.bin/ssh/sshkey.c between version 1.10 and 1.11

version 1.10, 2015/01/12 20:13:27 version 1.11, 2015/01/13 07:39:19
Line 50 
Line 50 
 #include "digest.h"  #include "digest.h"
 #define SSHKEY_INTERNAL  #define SSHKEY_INTERNAL
 #include "sshkey.h"  #include "sshkey.h"
   #include "match.h"
   
 /* openssh private key file format */  /* openssh private key file format */
 #define MARK_BEGIN              "-----BEGIN OPENSSH PRIVATE KEY-----\n"  #define MARK_BEGIN              "-----BEGIN OPENSSH PRIVATE KEY-----\n"
Line 207 
Line 208 
 }  }
   
 int  int
 sshkey_names_valid2(const char *names)  sshkey_names_valid2(const char *names, int allow_wildcard)
 {  {
         char *s, *cp, *p;          char *s, *cp, *p;
           const struct keytype *kt;
           int type;
   
         if (names == NULL || strcmp(names, "") == 0)          if (names == NULL || strcmp(names, "") == 0)
                 return 0;                  return 0;
Line 217 
Line 220 
                 return 0;                  return 0;
         for ((p = strsep(&cp, ",")); p && *p != '\0';          for ((p = strsep(&cp, ",")); p && *p != '\0';
             (p = strsep(&cp, ","))) {              (p = strsep(&cp, ","))) {
                 switch (sshkey_type_from_name(p)) {                  type = sshkey_type_from_name(p);
                 case KEY_RSA1:                  if (type == KEY_RSA1) {
                 case KEY_UNSPEC:                          free(s);
                           return 0;
                   }
                   if (type == KEY_UNSPEC) {
                           if (allow_wildcard) {
                                   /*
                                    * Try matching key types against the string.
                                    * If any has a positive or negative match then
                                    * the component is accepted.
                                    */
                                   for (kt = keytypes; kt->type != -1; kt++) {
                                           if (kt->type == KEY_RSA1)
                                                   continue;
                                           if (match_pattern_list(kt->name,
                                               p, strlen(p), 0) != 0)
                                                   break;
                                   }
                                   if (kt->type != -1)
                                           continue;
                           }
                         free(s);                          free(s);
                         return 0;                          return 0;
                 }                  }

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11