From: Todd C. Miller Date: Tue, 1 Jul 2008 11:57:55 +0000 (+0000) Subject: Error out in -i mode if the user has no shell. This can happen when X-Git-Tag: SUDO_1_7_0~98 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0cf7172b1ad9fe05740c0a31aa9511cb1174ed6b;p=sudo Error out in -i mode if the user has no shell. This can happen when running commands as a uid with no password entry. --- diff --git a/sudo.c b/sudo.c index a188bb53b..0f094a527 100644 --- 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) {