[Pkg-shadow-devel] patches for su synchronisation

Nicolas François nicolas.francois at centraliens.net
Sat Dec 17 17:15:03 UTC 2005


Hello,

Here is a patch that:
 * fixes the su.1 man page (I forgot the SHELL argument).
 * fixes some comments in su.c
 * replaces getuid() by !amroot (this remove a system call and may be more
   readable)

-- 
Nekral
-------------- next part --------------
Index: man/su.1.xml
===================================================================
RCS file: /cvsroot/shadow/man/su.1.xml,v
retrieving revision 1.18
diff -u -r1.18 su.1.xml
--- man/su.1.xml	15 Dec 2005 14:45:25 -0000	1.18
+++ man/su.1.xml	17 Dec 2005 17:11:01 -0000
@@ -100,6 +100,7 @@
       <varlistentry>
 	<term>
 	  <option>-s</option>, <option>--shell</option>
+	  <replaceable>SHELL</replaceable>
 	</term>
 	<listitem>
 	  <para>The shell that will be invoked.</para>
Index: src/su.c
===================================================================
RCS file: /cvsroot/shadow/src/su.c,v
retrieving revision 1.55
diff -u -r1.55 su.c
--- src/su.c	13 Dec 2005 14:03:05 -0000	1.55
+++ src/su.c	17 Dec 2005 17:11:02 -0000
@@ -271,9 +271,6 @@
  *	su changes the user's ids to the values for the specified user.  if
  *	no new user name is specified, "root" is used by default.
  *
- *	The only valid option is a "-" character, which is interpreted as
- *	requiring a new login session to be simulated.
- *
  *	Any additional arguments are passed to the user's shell. In
  *	particular, the argument "-c" will cause the next argument to be
  *	interpreted as a command by the common shell programs.
@@ -566,7 +563,7 @@
 	/* For users with non null UID, if this user has a restricted
 	 * shell, the shell must be the one specified in /etc/passwd
 	 */
-	if (shellstr != NULL && getuid () && restricted_shell (pwent.pw_shell))
+	if (shellstr != NULL && !amroot && restricted_shell (pwent.pw_shell))
 		shellstr = NULL;
 	/* If the shell is not set at this time, use the shell specified
 	 * in /etc/passwd.
@@ -811,7 +808,7 @@
 		/* Position argv to the remaining arguments */
 		argv += optind;
 		/*
-		 * Use new user's shell from /etc/passwd and create an argv
+		 * Use the shell and create an argv
 		 * with the rest of the command line included.
 		 */
 		argv[-1] = shellstr;


More information about the Pkg-shadow-devel mailing list