]> andersk Git - openssh.git/commitdiff
- markus@cvs.openbsd.org 2001/07/11 18:26:15
authordjm <djm>
Sat, 14 Jul 2001 02:21:34 +0000 (02:21 +0000)
committerdjm <djm>
Sat, 14 Jul 2001 02:21:34 +0000 (02:21 +0000)
     [auth.c]
     no need to call dirname(pw->pw_dir).
     note that dirname(3) modifies its argument on some systems.

ChangeLog
auth.c

index 6897652aff19226978b7404d002a1656c4ea0daa..7b9e65c62491e7cba6ec8e81ffeedb1d1ab3b3f9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
      dugsong ok
      XXX isn't it sensitive to the order of -I/usr/include/kerberosIV and
      -I/usr/include/kerberosV?
+   - markus@cvs.openbsd.org 2001/07/11 16:29:59
+     [ssh.c]
+     sort options string, fix -p, add -k
+   - markus@cvs.openbsd.org 2001/07/11 18:26:15
+     [auth.c]
+     no need to call dirname(pw->pw_dir).
+     note that dirname(3) modifies its argument on some systems.
 
 20010711
  - (djm) dirname(3) may modify its argument on glibc and other systems. 
diff --git a/auth.c b/auth.c
index 84e0be76152647435eabea5c04a643cb46afe6ad..9d4f4abfe9d6495eafb90010c2e56ed0c58e7a9e 100644 (file)
--- a/auth.c
+++ b/auth.c
@@ -23,7 +23,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: auth.c,v 1.26 2001/06/27 04:48:52 markus Exp $");
+RCSID("$OpenBSD: auth.c,v 1.27 2001/07/11 18:26:15 markus Exp $");
 
 #ifdef HAVE_LOGIN_H
 #include <login.h>
@@ -363,13 +363,10 @@ secure_filename(FILE *f, const char *file, struct passwd *pw,
     char *err, size_t errlen)
 {
        uid_t uid = pw->pw_uid;
-       char homedir[MAXPATHLEN];
        char buf[MAXPATHLEN];
        char *cp;
        struct stat st;
 
-       strlcpy(homedir, dirname(pw->pw_dir), sizeof(homedir));
-
        if (realpath(file, buf) == NULL) {
                snprintf(err, errlen, "realpath %s failed: %s", file,
                    strerror(errno));
@@ -385,8 +382,6 @@ secure_filename(FILE *f, const char *file, struct passwd *pw,
                return -1;
        }
 
-       debug3("secure_filename: terminating check at '%s'", homedir);
-
        /* for each component of the canonical path, walking upwards */
        for (;;) {
                if ((cp = dirname(buf)) == NULL) {
@@ -395,10 +390,6 @@ secure_filename(FILE *f, const char *file, struct passwd *pw,
                }
                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);
                if (stat(buf, &st) < 0 ||
                    (st.st_uid != 0 && st.st_uid != uid) ||
@@ -408,6 +399,12 @@ secure_filename(FILE *f, const char *file, struct passwd *pw,
                        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,
                 * but we can be paranoid and check for "." too
This page took 0.086077 seconds and 5 git commands to generate.