[Pkg-shadow-commits] r1500 - in upstream/trunk: . src

nekral-guest at alioth.debian.org nekral-guest at alioth.debian.org
Wed Dec 26 22:36:54 UTC 2007


Author: nekral-guest
Date: 2007-12-26 22:36:54 +0000 (Wed, 26 Dec 2007)
New Revision: 1500

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/NEWS
   upstream/trunk/src/login.c
   upstream/trunk/src/sulogin.c
Log:
If started as init, login and sulogin need to start a new session.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2007-12-26 22:17:13 UTC (rev 1499)
+++ upstream/trunk/ChangeLog	2007-12-26 22:36:54 UTC (rev 1500)
@@ -1,5 +1,10 @@
 2007-12-26  Nicolas François  <nicolas.francois at centraliens.net>
 
+	Merge Debian's patch 496_login_init_session
+	* src/login.c, src/sulogin.c: If started as init, start a new session.
+
+2007-12-26  Nicolas François  <nicolas.francois at centraliens.net>
+
 	Merge Debian's patch 408_passwd_check_arguments
 	* NEWS, src/passwd.c: Make sure that no more than one username
 	argument was provided.

Modified: upstream/trunk/NEWS
===================================================================
--- upstream/trunk/NEWS	2007-12-26 22:17:13 UTC (rev 1499)
+++ upstream/trunk/NEWS	2007-12-26 22:36:54 UTC (rev 1500)
@@ -18,6 +18,10 @@
     user-, user1-user2).
 - passwd
   * Make sure that no more than one username argument was provided.
+- su
+  * If started as init, start a new session.
+- sulogin
+  * If started as init, start a new session.
 
 shadow-4.0.18.2 -> shadow-4.1.0						09-12-2008
 

Modified: upstream/trunk/src/login.c
===================================================================
--- upstream/trunk/src/login.c	2007-12-26 22:17:13 UTC (rev 1499)
+++ upstream/trunk/src/login.c	2007-12-26 22:36:54 UTC (rev 1500)
@@ -41,6 +41,7 @@
 #include <signal.h>
 #include <stdio.h>
 #include <sys/stat.h>
+#include <sys/ioctl.h>
 #include "defines.h"
 #include "faillog.h"
 #include "failure.h"
@@ -1039,6 +1040,12 @@
 	}
 	/* child */
 #endif
+	/* If we were init, we need to start a new session */
+	if (getppid() == 1) {
+		setsid();
+		if (ioctl(0, TIOCSCTTY, 1))
+			fprintf(stderr,_("TIOCSCTTY failed on %s"),tty);
+	}
 
 	/* We call set_groups() above because this clobbers pam_groups.so */
 #ifndef USE_PAM

Modified: upstream/trunk/src/sulogin.c
===================================================================
--- upstream/trunk/src/sulogin.c	2007-12-26 22:17:13 UTC (rev 1499)
+++ upstream/trunk/src/sulogin.c	2007-12-26 22:36:54 UTC (rev 1500)
@@ -35,6 +35,7 @@
 #include <pwd.h>
 #include <signal.h>
 #include <stdio.h>
+#include <sys/ioctl.h>
 #include "defines.h"
 #include "getdef.h"
 #include "prototypes.h"
@@ -142,6 +143,12 @@
 #endif
 		exit (1);	/* must be a terminal */
 	}
+	/* If we were init, we need to start a new session */
+	if (getppid() == 1) {
+		setsid();
+		if (ioctl(0, TIOCSCTTY, 1))
+			fprintf(stderr,_("TIOCSCTTY failed"));
+	}
 	while (*envp)		/* add inherited environment, */
 		addenv (*envp++, NULL);	/* some variables change later */
 




More information about the Pkg-shadow-commits mailing list