]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
- (dtucker) [platform.c session.c] Move the AIX setpcred+chroot hack into
authorDarren Tucker <dtucker@zip.com.au>
Fri, 5 Nov 2010 01:41:13 +0000 (12:41 +1100)
committerDarren Tucker <dtucker@zip.com.au>
Fri, 5 Nov 2010 01:41:13 +0000 (12:41 +1100)
   platform.c

ChangeLog
platform.c
session.c

index d1a0cd0fdb9d8b0bc8e344df0fe41c728729c651..cf6e00f6b49fdb7ec50f62d5d4595ec5e4d1cbd2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -26,6 +26,8 @@
    ok djm@
  - (dtucker) [platform.c platform.h session.c] Add a platform hook to run
    after the user's groups are established and move the selinux calls into it.
+ - (dtucker) [platform.c session.c] Move the AIX setpcred+chroot hack into
+   platform.c
 
 20101025
  - (tim) [openbsd-compat/glob.h] Remove sys/cdefs.h include that came with
index 730e7b718c13bcb3fd4c70c09536e38b5f0ecd02..1604f8b59d453f473efcb73a5fb6e7e78529eccd 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: platform.c,v 1.5 2010/11/05 01:36:15 dtucker Exp $ */
+/* $Id: platform.c,v 1.6 2010/11/05 01:41:13 dtucker Exp $ */
 
 /*
  * Copyright (c) 2006 Darren Tucker.  All rights reserved.
@@ -83,6 +83,24 @@ platform_setusercontext(struct passwd *pw)
 void
 platform_setusercontext_post_groups(struct passwd *pw)
 {
+#ifdef HAVE_SETPCRED
+       /*
+        * If we have a chroot directory, we set all creds except real
+        * uid which we will need for chroot.  If we don't have a
+        * chroot directory, we don't override anything.
+        */
+       {
+               char **creds = NULL, *chroot_creds[] =
+                   { "REAL_USER=root", NULL };
+
+               if (options.chroot_directory != NULL &&
+                   strcasecmp(options.chroot_directory, "none") != 0)
+                       creds = chroot_creds;
+
+               if (setpcred(pw->pw_name, creds) == -1)
+                       fatal("Failed to set process credentials");
+       }
+#endif /* HAVE_SETPCRED */
 #ifdef WITH_SELINUX
        ssh_selinux_setup_exec_context(pw->pw_name);
 #endif
index 7994dd60ba2c009af22333e83baf645ae44bd4d0..78e7c5f504c07cf4dcd6a580bab6f800dc347389 100644 (file)
--- a/session.c
+++ b/session.c
@@ -1530,24 +1530,6 @@ do_setusercontext(struct passwd *pw)
                }
 # endif /* USE_LIBIAF */
 #endif
-#ifdef HAVE_SETPCRED
-               /*
-                * If we have a chroot directory, we set all creds except real
-                * uid which we will need for chroot.  If we don't have a
-                * chroot directory, we don't override anything.
-                */
-               {
-                       char **creds = NULL, *chroot_creds[] =
-                           { "REAL_USER=root", NULL };
-
-                       if (options.chroot_directory != NULL &&
-                           strcasecmp(options.chroot_directory, "none") != 0)
-                               creds = chroot_creds;
-
-                       if (setpcred(pw->pw_name, creds) == -1)
-                               fatal("Failed to set process credentials");
-               }
-#endif /* HAVE_SETPCRED */
 
                platform_setusercontext_post_groups(pw);