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

Diff for /src/usr.bin/ssh/auth2.c between version 1.162 and 1.163

version 1.162, 2021/12/19 22:12:07 version 1.163, 2021/12/26 23:34:41
Line 89 
Line 89 
 static int input_userauth_request(int, u_int32_t, struct ssh *);  static int input_userauth_request(int, u_int32_t, struct ssh *);
   
 /* helper */  /* helper */
   static Authmethod *authmethod_byname(const char *);
 static Authmethod *authmethod_lookup(Authctxt *, const char *);  static Authmethod *authmethod_lookup(Authctxt *, const char *);
 static char *authmethods_get(Authctxt *authctxt);  static char *authmethods_get(Authctxt *authctxt);
   
Line 345 
Line 346 
                 }                  }
                 if (authctxt->postponed)                  if (authctxt->postponed)
                         fatal("INTERNAL ERROR: authenticated and postponed");                          fatal("INTERNAL ERROR: authenticated and postponed");
                 if ((m = authmethod_lookup(authctxt, method)) == NULL)                  /* prefer primary authmethod name to possible synonym */
                   if ((m = authmethod_byname(method)) == NULL)
                         fatal("INTERNAL ERROR: bad method %s", method);                          fatal("INTERNAL ERROR: bad method %s", method);
                 method = m->name; /* prefer primary name to possible synonym */                  method = m->name;
         }          }
   
         /* Special handling for root */          /* Special handling for root */
Line 457 
Line 459 
 }  }
   
 static Authmethod *  static Authmethod *
 authmethod_lookup(Authctxt *authctxt, const char *name)  authmethod_byname(const char *name)
 {  {
         int i;          int i;
   
         if (name != NULL)          if (name == NULL)
                 for (i = 0; authmethods[i] != NULL; i++)                  fatal_f("NULL authentication method name");
                         if (authmethods[i]->enabled != NULL &&          for (i = 0; authmethods[i] != NULL; i++) {
                             *(authmethods[i]->enabled) != 0 &&                  if (strcmp(name, authmethods[i]->name) == 0 ||
                             (strcmp(name, authmethods[i]->name) == 0 ||                      (authmethods[i]->synonym != NULL &&
                             (authmethods[i]->synonym != NULL &&                      strcmp(name, authmethods[i]->synonym) == 0))
                             strcmp(name, authmethods[i]->synonym) == 0)) &&                          return authmethods[i];
                             auth2_method_allowed(authctxt,          }
                             authmethods[i]->name, NULL))          debug_f("unrecognized authentication method name: %s", name);
                                 return authmethods[i];  
         debug2("Unrecognized authentication method name: %s",  
             name ? name : "NULL");  
         return NULL;          return NULL;
   }
   
   static Authmethod *
   authmethod_lookup(Authctxt *authctxt, const char *name)
   {
           Authmethod *method;
   
           if ((method = authmethod_byname(name)) == NULL)
                   return NULL;
   
           if (method->enabled == NULL || *(method->enabled) == 0) {
                   debug3_f("method %s not enabled", name);
                   return NULL;
           }
           if (!auth2_method_allowed(authctxt, method->name, NULL)) {
                   debug3_f("method %s not allowed "
                       "by AuthenticationMethods", name);
                   return NULL;
           }
           return method;
 }  }
   
 /*  /*

Legend:
Removed from v.1.162  
changed lines
  Added in v.1.163