Add mail_badpass option

Also modify mail_always behavior to also send mail when the password is wrong
This commit is contained in:
Todd C. Miller
2001-11-12 18:13:03 +00:00
parent 63ae9ec2ad
commit de9d655ea6
5 changed files with 74 additions and 50 deletions

View File

@@ -99,9 +99,10 @@ verify_user(pw, prompt)
struct passwd *pw;
char *prompt;
{
short counter = def_ival(I_PASSWD_TRIES) + 1;
short success = AUTH_FAILURE;
short status;
int counter = def_ival(I_PASSWD_TRIES) + 1;
int success = AUTH_FAILURE;
int status;
int flags;
char *p;
sudo_auth *auth;
@@ -213,7 +214,11 @@ cleanup:
case AUTH_SUCCESS:
return;
case AUTH_FAILURE:
log_error(NO_MAIL, "%d incorrect password attempt%s",
if (def_flag(I_MAIL_BADPASS) || def_flag(I_MAIL_ALWAYS))
flags = 0;
else
flags = NO_MAIL;
log_error(flags, "%d incorrect password attempt%s",
def_ival(I_PASSWD_TRIES) - counter,
(def_ival(I_PASSWD_TRIES) - counter == 1) ? "" : "s");
case AUTH_FATAL: