]> granicus.if.org Git - sudo/commitdiff
Error out in -i mode if the user has no shell. This can happen when
authorTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 1 Jul 2008 11:57:55 +0000 (11:57 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 1 Jul 2008 11:57:55 +0000 (11:57 +0000)
running commands as a uid with no password entry.

sudo.c

diff --git a/sudo.c b/sudo.c
index a188bb53b589204b353f442325907b527fed3872..0f094a527d0a44384fc5f6c9a6cd3827b0629510 100644 (file)
--- a/sudo.c
+++ b/sudo.c
@@ -297,8 +297,11 @@ main(argc, argv, envp)
     set_loginclass(sudo_user.pw);
 
     /* Update initial shell now that runas is set. */
-    if (ISSET(sudo_mode, MODE_LOGIN_SHELL))
+    if (ISSET(sudo_mode, MODE_LOGIN_SHELL)) {
+       if (runas_pw->pw_shell == NULL)
+           errorx(1, "no login shell for user %s!", runas_pw->pw_name);
        NewArgv[0] = runas_pw->pw_shell;
+    }
 
     /* This goes after sudoers is parsed since it may have timestamp options. */
     if (sudo_mode == MODE_KILL || sudo_mode == MODE_INVALIDATE) {