=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/auth.c,v retrieving revision 1.41.2.4 retrieving revision 1.41.2.5 diff -u -r1.41.2.4 -r1.41.2.5 --- src/usr.bin/ssh/auth.c 2002/10/11 14:51:51 1.41.2.4 +++ src/usr.bin/ssh/auth.c 2003/04/03 22:35:16 1.41.2.5 @@ -23,7 +23,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: auth.c,v 1.41.2.4 2002/10/11 14:51:51 miod Exp $"); +RCSID("$OpenBSD: auth.c,v 1.41.2.5 2003/04/03 22:35:16 miod Exp $"); #include @@ -340,6 +340,7 @@ uid_t uid = pw->pw_uid; char buf[MAXPATHLEN], homedir[MAXPATHLEN]; char *cp; + int comparehome = 0; struct stat st; if (realpath(file, buf) == NULL) { @@ -347,11 +348,8 @@ strerror(errno)); return -1; } - if (realpath(pw->pw_dir, homedir) == NULL) { - snprintf(err, errlen, "realpath %s failed: %s", pw->pw_dir, - strerror(errno)); - return -1; - } + if (realpath(pw->pw_dir, homedir) != NULL) + comparehome = 1; /* check the open file to avoid races */ if (fstat(fileno(f), &st) < 0 || @@ -380,7 +378,7 @@ } /* If are passed the homedir then we can stop */ - if (strcmp(homedir, buf) == 0) { + if (comparehome && strcmp(homedir, buf) == 0) { debug3("secure_filename: terminating check at '%s'", buf); break;