done with it.
check_user(int validated, int mode)
{
struct passwd *auth_pw;
- char *prompt;
int status, rval = true;
debug_decl(check_user, SUDO_DEBUG_AUTH)
status = timestamp_status();
if (status != TS_CURRENT || ISSET(validated, FLAG_CHECK_USER)) {
+ char *prompt;
bool lectured;
/* Bail out if we are non-interactive and a password is required */
rval = verify_user(auth_pw, prompt, validated);
if (rval == true && lectured)
set_lectured();
+ efree(prompt);
}
/* Only update timestamp if user was validated. */
if (rval == true && ISSET(validated, VALIDATE_OK) &&
* allocated result. Returns the same string if there are no escapes.
*/
char *
-expand_prompt(char *old_prompt, char *user, char *host)
+expand_prompt(const char *old_prompt, const char *user, const char *host)
{
size_t len, n;
int subst;
- char *p, *np, *new_prompt, *endp;
+ const char *p;
+ char *np, *new_prompt, *endp;
debug_decl(expand_prompt, SUDO_DEBUG_AUTH)
/* How much space do we need to malloc for the prompt? */
}
*np = '\0';
} else
- new_prompt = old_prompt;
+ new_prompt = estrdup(old_prompt);
debug_return_str(new_prompt);
/* check.c */
int check_user(int validate, int mode);
bool user_is_exempt(void);
-char *expand_prompt(char *old_prompt, char *user, char *host);
+char *expand_prompt(const char *old_prompt, const char *user, const char *host);
/* timestamp.c */
void remove_timestamp(bool);