]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
- (dtucker) [platform.c session.c] Move the PAM credential establishment for
authorDarren Tucker <dtucker@zip.com.au>
Fri, 5 Nov 2010 02:00:05 +0000 (13:00 +1100)
committerDarren Tucker <dtucker@zip.com.au>
Fri, 5 Nov 2010 02:00:05 +0000 (13:00 +1100)
   the LOGIN_CAP case into platform.c.

ChangeLog
platform.c
session.c

index 3f415d7dc749237df5fe86242f176b38d2482702..909b9fc597c4d651bae4aac393dfb93c1a4e7300 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -31,6 +31,8 @@
  - (dtucker) [platform.c session.c] Move the BSDI setpgrp into platform.c.
  - (dtucker) [platform.c] Only call setpgrp on BSDI if running as root to
    retain previous behavior.
+ - (dtucker) [platform.c session.c] Move the PAM credential establishment for
+   the LOGIN_CAP case into platform.c.
 
 20101025
  - (tim) [openbsd-compat/glob.h] Remove sys/cdefs.h include that came with
index 570f130aeb69e35711bd801ee9a8852d223d08a9..0335eaae619b2b9091e9499b9b9f68c1ce662eb6 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: platform.c,v 1.8 2010/11/05 01:50:41 dtucker Exp $ */
+/* $Id: platform.c,v 1.9 2010/11/05 02:00:05 dtucker Exp $ */
 
 /*
  * Copyright (c) 2006 Darren Tucker.  All rights reserved.
@@ -21,6 +21,8 @@
 
 #include "openbsd-compat/openbsd-compat.h"
 
+extern int use_privsep;
+
 void
 platform_pre_listen(void)
 {
@@ -79,6 +81,18 @@ platform_setusercontext(struct passwd *pw)
        if (getuid() == 0 || geteuid() == 0)
                setpgid(0, 0);
 # endif
+
+#if defined(HAVE_LOGIN_CAP) && defined(USE_PAM)
+       /*
+        * If we have both LOGIN_CAP and PAM, we want to establish creds
+        * before calling setusercontext (in session.c:do_setusercontext).
+        */
+       if (getuid() == 0 || geteuid() == 0) {
+               if (options.use_pam) {
+                       do_pam_setcred(use_privsep);
+               }
+       }
+# endif /* USE_PAM */
 }
 
 /*
index 0775d78d2e27280b012dfcdd7ec6d9fa7cc72068..a2d8bec8bfd6e3ab879c0013a89e076668eeea65 100644 (file)
--- a/session.c
+++ b/session.c
@@ -1476,11 +1476,6 @@ do_setusercontext(struct passwd *pw)
 #endif /* HAVE_CYGWIN */
        {
 #ifdef HAVE_LOGIN_CAP
-# ifdef USE_PAM
-               if (options.use_pam) {
-                       do_pam_setcred(use_privsep);
-               }
-# endif /* USE_PAM */
                if (setusercontext(lc, pw, pw->pw_uid,
                    (LOGIN_SETALL & ~(LOGIN_SETPATH|LOGIN_SETUSER))) < 0) {
                        perror("unable to set user context");