Enable passprompt_override by default if SUDO_PROMPT is present in

the environment.  This is consistent with how "sudo -p prompt" is
handled.
This commit is contained in:
Todd C. Miller
2017-07-20 11:40:49 -06:00
parent 1918ec4a55
commit 37f591d2dd

View File

@@ -693,10 +693,12 @@ init_vars(char * const envp[])
user_path = *ep + 5;
break;
case 'S':
if (!user_prompt && strncmp("SUDO_PROMPT=", *ep, 12) == 0)
if (!user_prompt && strncmp("SUDO_PROMPT=", *ep, 12) == 0) {
user_prompt = *ep + 12;
else if (strncmp("SUDO_USER=", *ep, 10) == 0)
def_passprompt_override = true;
} else if (strncmp("SUDO_USER=", *ep, 10) == 0) {
prev_user = *ep + 10;
}
break;
}
}