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

Nicolas FRANÇOIS nekral-guest at alioth.debian.org
Thu Mar 18 23:21:01 UTC 2010


Author: nekral-guest
Date: 2010-03-18 23:21:00 +0000 (Thu, 18 Mar 2010)
New Revision: 3164

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/src/chsh.c
Log:
	* src/chsh.c: Even for root, warn if an invalid shell is
	specified.

Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2010-03-18 23:20:41 UTC (rev 3163)
+++ upstream/trunk/ChangeLog	2010-03-18 23:21:00 UTC (rev 3164)
@@ -1,5 +1,10 @@
 2010-03-18  Nicolas François  <nicolas.francois at centraliens.net>
 
+	* src/chsh.c: Even for root, warn if an invalid shell is
+	specified.
+
+2010-03-18  Nicolas François  <nicolas.francois at centraliens.net>
+
 	* man/limits.5.xml: Document the selection of the limits when
 	multiple lines match the user.
 

Modified: upstream/trunk/src/chsh.c
===================================================================
--- upstream/trunk/src/chsh.c	2010-03-18 23:20:41 UTC (rev 3163)
+++ upstream/trunk/src/chsh.c	2010-03-18 23:21:00 UTC (rev 3164)
@@ -535,10 +535,17 @@
 	if (   !amroot
 	    && (   is_restricted_shell (loginsh)
 	        || (access (loginsh, X_OK) != 0))) {
-		fprintf (stderr, _("%s: %s is an invalid shell.\n"), Prog, loginsh);
+		fprintf (stderr, _("%s: %s is an invalid shell\n"), Prog, loginsh);
 		fail_exit (1);
 	}
 
+	/* Even for root, warn if an invalid shell is specified. */
+	if (access (loginsh, F_OK) != 0) {
+		fprintf (stderr, _("%s: Warning: %s does not exist\n"), Prog, loginsh);
+	} else if (access (loginsh, X_OK) != 0) {
+		fprintf (stderr, _("%s: Warning: %s is not executable\n"), Prog, loginsh);
+	}
+
 	update_shell (user, loginsh);
 
 	SYSLOG ((LOG_INFO, "changed user '%s' shell to '%s'", user, loginsh));




More information about the Pkg-shadow-commits mailing list