[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.92 and 1.93

version 1.92, 2002/05/25 18:51:07 version 1.93, 2002/05/31 11:35:15
Line 42 
Line 42 
 extern int session_id2_len;  extern int session_id2_len;
   
 Authctxt *x_authctxt = NULL;  Authctxt *x_authctxt = NULL;
 static int one = 1;  
   
 typedef struct Authmethod Authmethod;  /* methods */
 struct Authmethod {  
         char    *name;  extern Authmethod method_none;
         int     (*userauth)(Authctxt *authctxt);  extern Authmethod method_pubkey;
         int     *enabled;  extern Authmethod method_passwd;
   extern Authmethod method_kbdint;
   extern Authmethod method_hostbased;
   
   Authmethod *authmethods[] = {
           &method_none,
           &method_pubkey,
           &method_passwd,
           &method_kbdint,
           &method_hostbased,
           NULL
 };  };
   
 /* protocol */  /* protocol */
Line 62 
Line 71 
 int user_key_allowed(struct passwd *, Key *);  int user_key_allowed(struct passwd *, Key *);
 int hostbased_key_allowed(struct passwd *, const char *, char *, Key *);  int hostbased_key_allowed(struct passwd *, const char *, char *, Key *);
   
 /* auth */  
   
 Authmethod authmethods[] = {  
         {"none",  
                 userauth_none,  
                 &one},  
         {"publickey",  
                 userauth_pubkey,  
                 &options.pubkey_authentication},  
         {"password",  
                 userauth_passwd,  
                 &options.password_authentication},  
         {"keyboard-interactive",  
                 userauth_kbdint,  
                 &options.kbd_interactive_authentication},  
         {"hostbased",  
                 userauth_hostbased,  
                 &options.hostbased_authentication},  
         {NULL, NULL, NULL}  
 };  
   
 /*  /*
  * loop until authctxt->success == TRUE   * loop until authctxt->success == TRUE
  */   */
Line 252 
Line 240 
 static char *  static char *
 authmethods_get(void)  authmethods_get(void)
 {  {
         Authmethod *method = NULL;  
         Buffer b;          Buffer b;
         char *list;          char *list;
           int i;
   
         buffer_init(&b);          buffer_init(&b);
         for (method = authmethods; method->name != NULL; method++) {          for (i = 0; authmethods[i] != NULL; i++) {
                 if (strcmp(method->name, "none") == 0)                  if (strcmp(authmethods[i]->name, "none") == 0)
                         continue;                          continue;
                 if (method->enabled != NULL && *(method->enabled) != 0) {                  if (authmethods[i]->enabled != NULL &&
                       *(authmethods[i]->enabled) != 0) {
                         if (buffer_len(&b) > 0)                          if (buffer_len(&b) > 0)
                                 buffer_append(&b, ",", 1);                                  buffer_append(&b, ",", 1);
                         buffer_append(&b, method->name, strlen(method->name));                          buffer_append(&b, authmethods[i]->name,
                               strlen(authmethods[i]->name));
                 }                  }
         }          }
         buffer_append(&b, "\0", 1);          buffer_append(&b, "\0", 1);
Line 275 
Line 265 
 static Authmethod *  static Authmethod *
 authmethod_lookup(const char *name)  authmethod_lookup(const char *name)
 {  {
         Authmethod *method = NULL;          int i;
   
         if (name != NULL)          if (name != NULL)
                 for (method = authmethods; method->name != NULL; method++)                  for (i = 0; authmethods[i] != NULL; i++)
                         if (method->enabled != NULL &&                          if (authmethods[i]->enabled != NULL &&
                             *(method->enabled) != 0 &&                              *(authmethods[i]->enabled) != 0 &&
                             strcmp(name, method->name) == 0)                              strcmp(name, authmethods[i]->name) == 0)
                                 return method;                                  return authmethods[i];
         debug2("Unrecognized authentication method name: %s", name ? name : "NULL");          debug2("Unrecognized authentication method name: %s",
               name ? name : "NULL");
         return NULL;          return NULL;
 }  }

Legend:
Removed from v.1.92  
changed lines
  Added in v.1.93