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

Diff for /src/usr.bin/ssh/auth.c between version 1.86 and 1.87

version 1.86, 2010/03/05 02:58:11 version 1.87, 2010/05/07 11:30:29
Line 276 
Line 276 
         return expand_authorized_keys(options.authorized_keys_file2, pw);          return expand_authorized_keys(options.authorized_keys_file2, pw);
 }  }
   
   char *
   authorized_principals_file(struct passwd *pw)
   {
           if (options.authorized_principals_file == NULL)
                   return NULL;
           return expand_authorized_keys(options.authorized_principals_file, pw);
   }
   
 /* return ok if key exists in sysfile or userfile */  /* return ok if key exists in sysfile or userfile */
 HostStatus  HostStatus
 check_key_in_hostfiles(struct passwd *pw, Key *key, const char *host,  check_key_in_hostfiles(struct passwd *pw, Key *key, const char *host,
Line 387 
Line 395 
         return 0;          return 0;
 }  }
   
 FILE *  static FILE *
 auth_openkeyfile(const char *file, struct passwd *pw, int strict_modes)  auth_openfile(const char *file, struct passwd *pw, int strict_modes,
       int log_missing, char *file_type)
 {  {
         char line[1024];          char line[1024];
         struct stat st;          struct stat st;
         int fd;          int fd;
         FILE *f;          FILE *f;
   
         /*  
          * Open the file containing the authorized keys  
          * Fail quietly if file does not exist  
          */  
         if ((fd = open(file, O_RDONLY|O_NONBLOCK)) == -1) {          if ((fd = open(file, O_RDONLY|O_NONBLOCK)) == -1) {
                 if (errno != ENOENT)                  if (log_missing || errno != ENOENT)
                         debug("Could not open keyfile '%s': %s", file,                          debug("Could not open %s '%s': %s", file_type, file,
                            strerror(errno));                             strerror(errno));
                 return NULL;                  return NULL;
         }          }
Line 411 
Line 416 
                 return NULL;                  return NULL;
         }          }
         if (!S_ISREG(st.st_mode)) {          if (!S_ISREG(st.st_mode)) {
                 logit("User %s authorized keys %s is not a regular file",                  logit("User %s %s %s is not a regular file",
                     pw->pw_name, file);                      pw->pw_name, file_type, file);
                 close(fd);                  close(fd);
                 return NULL;                  return NULL;
         }          }
Line 429 
Line 434 
         }          }
   
         return f;          return f;
   }
   
   
   FILE *
   auth_openkeyfile(const char *file, struct passwd *pw, int strict_modes)
   {
           return auth_openfile(file, pw, strict_modes, 1, "authorized keys");
   }
   
   FILE *
   auth_openprincipals(const char *file, struct passwd *pw, int strict_modes)
   {
           return auth_openfile(file, pw, strict_modes, 0,
               "authorized principals");
 }  }
   
 struct passwd *  struct passwd *

Legend:
Removed from v.1.86  
changed lines
  Added in v.1.87