From 0cf7172b1ad9fe05740c0a31aa9511cb1174ed6b Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Tue, 1 Jul 2008 11:57:55 +0000 Subject: [PATCH] Error out in -i mode if the user has no shell. This can happen when running commands as a uid with no password entry. --- sudo.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) { -- 2.40.0