[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.26 and 1.27

version 1.26, 2001/06/27 04:48:52 version 1.27, 2001/07/11 18:26:15
Line 311 
Line 311 
     char *err, size_t errlen)      char *err, size_t errlen)
 {  {
         uid_t uid = pw->pw_uid;          uid_t uid = pw->pw_uid;
         char homedir[MAXPATHLEN];  
         char buf[MAXPATHLEN];          char buf[MAXPATHLEN];
         char *cp;          char *cp;
         struct stat st;          struct stat st;
   
         strlcpy(homedir, dirname(pw->pw_dir), sizeof(homedir));  
   
         if (realpath(file, buf) == NULL) {          if (realpath(file, buf) == NULL) {
                 snprintf(err, errlen, "realpath %s failed: %s", file,                  snprintf(err, errlen, "realpath %s failed: %s", file,
                     strerror(errno));                      strerror(errno));
Line 333 
Line 330 
                 return -1;                  return -1;
         }          }
   
         debug3("secure_filename: terminating check at '%s'", homedir);  
   
         /* for each component of the canonical path, walking upwards */          /* for each component of the canonical path, walking upwards */
         for (;;) {          for (;;) {
                 if ((cp = dirname(buf)) == NULL) {                  if ((cp = dirname(buf)) == NULL) {
Line 343 
Line 338 
                 }                  }
                 strlcpy(buf, cp, sizeof(buf));                  strlcpy(buf, cp, sizeof(buf));
   
                 /* If are passed the homedir then we can stop */  
                 if (strcmp(buf, homedir) == 0)  
                         break;  
   
                 debug3("secure_filename: checking '%s'", buf);                  debug3("secure_filename: checking '%s'", buf);
                 if (stat(buf, &st) < 0 ||                  if (stat(buf, &st) < 0 ||
                     (st.st_uid != 0 && st.st_uid != uid) ||                      (st.st_uid != 0 && st.st_uid != uid) ||
Line 356 
Line 347 
                         return -1;                          return -1;
                 }                  }
   
                   /* If are passed the homedir then we can stop */
                   if (strcmp(pw->pw_dir, buf) == 0) {
                           debug3("secure_filename: terminating check at '%s'",
                               buf);
                           break;
                   }
                 /*                  /*
                  * dirname should always complete with a "/" path,                   * dirname should always complete with a "/" path,
                  * but we can be paranoid and check for "." too                   * but we can be paranoid and check for "." too

Legend:
Removed from v.1.26  
changed lines
  Added in v.1.27