Add a space after "Password:" in default password prompt so it is

easier to read when pwfeedback is enabled.
This commit is contained in:
Todd C. Miller
2014-09-27 10:24:19 -06:00
parent b7444e0f83
commit 496c2e287b
5 changed files with 85 additions and 55 deletions

View File

@@ -55,6 +55,10 @@ static char *def_prompt;
static char **sudo_argv;
static int sudo_argc;
#define PROMPT_IS_PASSWORD(_p) \
(strncmp((_p), "Password:", 9) == 0 && \
((_p)[9] == '\0' || ((_p)[9] == ' ' && (_p)[10] == '\0')))
/*
* Collection routine (callback) for limiting the timeouts in SIA
* prompts and (possibly) setting a custom prompt.
@@ -77,8 +81,8 @@ sudo_collect(int timeout, int rendition, uchar_t *title, int nprompts,
* and b) the SIA prompt is "Password:" (so we know it is safe).
* This keeps us from overwriting things like S/Key challenges.
*/
if (strcmp((char *)prompts[0].prompt, "Password:") == 0 &&
strcmp(def_prompt, "Password:") != 0)
if (!PROMPT_IS_PASSWORD(def_prompt) &&
PROMPT_IS_PASSWORD((char *)prompts[0].prompt))
prompts[0].prompt = (unsigned char *)def_prompt;
break;
default: