]> granicus.if.org Git - shadow/commitdiff
* src/login.c: Move update_utmp() after the PID or session ID
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Mon, 27 Apr 2009 20:25:23 +0000 (20:25 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Mon, 27 Apr 2009 20:25:23 +0000 (20:25 +0000)
changed in order to get more accurate data in UTMP. This also
fixes "exec login" when login in installed setuid.

ChangeLog
src/login.c

index 7e82e26b85f6de04174eaf83df527a9259f1f5a8..565a04c53056064c5490b7dbec0bf831849b193b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-04-27  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * src/login.c: Move update_utmp() after the PID or session ID
+       changed in order to get more accurate data in UTMP. This also
+       fixes "exec login" when login in installed setuid.
+
 2009-04-27  Nicolas François  <nicolas.francois@centraliens.net>
 
        * src/login.c: Reuse a string and avoid an untranslated message
index e8eae79557d1df6caf9f4544546efa949b86e1db..c27aadbb5576d425ad142651decf7fd01344aa64 100644 (file)
@@ -1109,8 +1109,6 @@ int main (int argc, char **argv)
                addenv ("IFS= \t\n", NULL);     /* ... instead, set a safe IFS */
        }
 
-       update_utmp (username, tty, hostname, utent);
-
        if (pwd->pw_shell[0] == '*') {  /* subsystem root */
                pwd->pw_shell++;        /* skip the '*' */
                subsystem (pwd);        /* figure out what to execute */
@@ -1198,6 +1196,7 @@ int main (int argc, char **argv)
        }
        /* child */
 #endif
+
        /* If we were init, we need to start a new session */
        if (getppid() == 1) {
                setsid();
@@ -1206,6 +1205,11 @@ int main (int argc, char **argv)
                }
        }
 
+       /*
+        * The utmp entry needs to be updated to indicate the new status
+        * of the session, the new PID and SID.
+        */
+       update_utmp (username, tty, hostname, utent);
 
        /* The pwd and spwd entries for the user have been copied.
         *