[Pkg-shadow-commits] r306 - in trunk/debian: . patches

Alexander Gattin pkg-shadow-devel@lists.alioth.debian.org
Sun, 26 Jun 2005 21:41:55 +0000


Author: xrgtn-guest
Date: 2005-06-26 21:41:54 +0000 (Sun, 26 Jun 2005)
New Revision: 306

Added:
   trunk/debian/patches/357_newgrp-stop_cont-proxy
Modified:
   trunk/debian/changelog
   trunk/debian/patches/series
Log:
added "SIGSTOP/SIGCONT proxy" patch for newgrp


Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2005-06-26 21:40:42 UTC (rev 305)
+++ trunk/debian/changelog	2005-06-26 21:41:54 UTC (rev 306)
@@ -32,12 +32,12 @@
     - debian/add-shell.sh, debian/remove-shell.sh, debian/shadowconfig.sh,
       debian/passwd.config, debian/passwd.postinst:
       - checked for bashisms, replaced "#!/bin/bash" with "#!/bin/sh",
-	Closes: #315767
+        Closes: #315767
       - replaced "test XXX -a YYY" XSI:isms with "test XXX && test YYY",
         for rationale see:
         http://www.opengroup.org/onlinepubs/009695399/utilities/test.html
       - replaced all unneeded "egrep"s with basic "grep"s
-        Closes: #256732
+      Closes: #256732
     - debian/rules:
       Remove the setuid bit on login
       Closes: #298060
@@ -95,6 +95,8 @@
     - Corrected typos in shadow.5. Closes: #312430
     - Corrected typos in grpck.8. Closes: #312431
     - Added patch (356th) for su to propagate SIGSTOP up and SIGCONT down.
+      Added similar patch (357th) for newgrp. Both changes only affect
+      operation with CLOSE_SESSION set to yes (in /etc/login.defs).
       Closes: #314727
   * Translation updates:
     - debian/patches/010_more-i18ned-messages

Added: trunk/debian/patches/357_newgrp-stop_cont-proxy
===================================================================
--- trunk/debian/patches/357_newgrp-stop_cont-proxy	2005-06-26 21:40:42 UTC (rev 305)
+++ trunk/debian/patches/357_newgrp-stop_cont-proxy	2005-06-26 21:41:54 UTC (rev 306)
@@ -0,0 +1,38 @@
+Goal:	When newgrp process sits between parent and child shells, it should
+	propagate STOPs from child to parent and CONTs from parent to child,
+	otherwise e.g. bash's "suspend" command won't work.
+
+Status wrt upstream: Not yet fixed in upstream, while "su" is fixed since 4.0.5
+
+Notes:	Affects only operation with CLOSE_SESSIONS=yes. When it's set to "no",
+	newgrp doesn't fork and create child process, it just calls exec(),
+	so there won't be "newgrp" process between parent and child shells.
+
+	Closes: 314727
+	(suspend command from su shell fails to return to parent shell)
+
+Index: shadow-4.0.3/src/newgrp.c
+===================================================================
+--- shadow-4.0.3.orig/src/newgrp.c	2005-06-26 21:57:50.000000000 +0300
++++ shadow-4.0.3/src/newgrp.c	2005-06-26 22:00:07.000000000 +0300
+@@ -437,9 +437,18 @@
+ 				exit (1);
+ 			} else if (child) {
+ 				/* parent - wait for child to finish, then log session close */
++				int cst = 0;
+ 				do {
+-					pid = waitpid (child, NULL, 0);
+-				} while (pid != child);
++					errno = 0;
++					pid = waitpid (child, &cst, WUNTRACED);
++					if (pid == child && WIFSTOPPED(cst)) {
++						/* stop when child stops */
++						raise(SIGSTOP);
++						/* wake child when resumed */
++						kill(child, SIGCONT);
++					}
++				} while (pid == child && WIFSTOPPED(cst) ||
++						pid != child && errno == EINTR);
+ 				SYSLOG ((LOG_INFO,
+ 					 "user `%s' (login `%s' on %s) returned to group `%s'",
+ 					 name, loginname, tty,

Modified: trunk/debian/patches/series
===================================================================
--- trunk/debian/patches/series	2005-06-26 21:40:42 UTC (rev 305)
+++ trunk/debian/patches/series	2005-06-26 21:41:54 UTC (rev 306)
@@ -125,4 +125,5 @@
 423_su_pass_args_without_concatenation
 424_pwck.8_quiet_option
 425_lastlog_8_sparse
+357_newgrp-stop_cont-proxy
 #426_grpck_group-gshadow_members_consistency