]> andersk Git - openssh.git/commitdiff
- (dtucker) [session.c openbsd-compat/port-aix.h] Bugs #1249 and #1567: move
authordtucker <dtucker>
Thu, 20 Aug 2009 06:20:50 +0000 (06:20 +0000)
committerdtucker <dtucker>
Thu, 20 Aug 2009 06:20:50 +0000 (06:20 +0000)
   the setpcred call on AIX to immediately before the permanently_set_uid().
   Ensures that we still have privileges when we call chroot and
   pam_open_sesson.  Based on a patch from David Leonard.

ChangeLog
openbsd-compat/port-aix.h
session.c

index 056240f390c25f0366b3418f6c4a67fd75c0901d..58cb16454f642df67df54711c286d9d627be5e55 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,10 @@
  - (dtucker) [includes.h] Bug #1634: do not include system glob.h if we're not
    using it since the type conflicts can cause problems on FreeBSD.  Patch
    from Jonathan Chen.
+ - (dtucker) [session.c openbsd-compat/port-aix.h] Bugs #1249 and #1567: move
+   the setpcred call on AIX to immediately before the permanently_set_uid().
+   Ensures that we still have privileges when we call chroot and
+   pam_open_sesson.  Based on a patch from David Leonard.
 
 20090817
  - (dtucker) [configure.ac] Check for headers before libraries for openssl an
index 8b891faf8b1ec3590dd8c9236597259627c48080..8bacc5d8487352071b85e563fb12c35077439dec 100644 (file)
@@ -71,6 +71,11 @@ int passwdexpired(char *, char **);
 # include <sys/timers.h>
 #endif
 
+/* for setpcred and friends */
+#ifdef HAVE_USERSEC_H
+# include <usersec.h>
+#endif
+
 /*
  * According to the setauthdb man page, AIX password registries must be 15
  * chars or less plus terminating NUL.
index cdbf88ab7965e79d0b00c5342bc1073990408e00..f4a3635437aad786eaa33325efa0686613eb31d5 100644 (file)
--- a/session.c
+++ b/session.c
@@ -1466,11 +1466,6 @@ do_setusercontext(struct passwd *pw)
        if (getuid() == 0 || geteuid() == 0)
 #endif /* HAVE_CYGWIN */
        {
-
-#ifdef HAVE_SETPCRED
-               if (setpcred(pw->pw_name, (char **)NULL) == -1)
-                       fatal("Failed to set process credentials");
-#endif /* HAVE_SETPCRED */
 #ifdef HAVE_LOGIN_CAP
 # ifdef __bsdi__
                setpgid(0, 0);
@@ -1538,6 +1533,10 @@ do_setusercontext(struct passwd *pw)
                        free(chroot_path);
                }
 
+#ifdef HAVE_SETPCRED
+               if (setpcred(pw->pw_name, (char **)NULL) == -1)
+                       fatal("Failed to set process credentials");
+#endif /* HAVE_SETPCRED */
 #ifdef HAVE_LOGIN_CAP
                if (setusercontext(lc, pw, pw->pw_uid, LOGIN_SETUSER) < 0) {
                        perror("unable to set user context (setuser)");
This page took 0.149731 seconds and 5 git commands to generate.