]> granicus.if.org Git - shadow/commitdiff
* src/chsh.c: Even for root, warn if an invalid shell is
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Thu, 18 Mar 2010 23:21:00 +0000 (23:21 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Thu, 18 Mar 2010 23:21:00 +0000 (23:21 +0000)
specified.

ChangeLog
src/chsh.c

index ea4f40aa1aee0605d331a93bfa975e328d99f094..7c6d8776c968f87f85bfda465a68283c14264622 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-03-18  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * src/chsh.c: Even for root, warn if an invalid shell is
+       specified.
+
 2010-03-18  Nicolas François  <nicolas.francois@centraliens.net>
 
        * man/limits.5.xml: Document the selection of the limits when
index c0dc948c73b5d996ff9664fce8aa79d4ff61add6..21d3b8b4d9071807c6f364e8966b74922c01a199 100644 (file)
@@ -535,10 +535,17 @@ int main (int argc, char **argv)
        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));