Rename log_warning flags and only send mail if SLOG_SEND_MAIL is

set instead of mailing by default like we used to.
This commit is contained in:
Todd C. Miller
2014-05-02 20:54:01 -06:00
parent 954a3e77b1
commit b0f1fa7d05
13 changed files with 144 additions and 130 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2005, 2007-2008, 2010-2013
* Copyright (c) 2000-2005, 2007-2008, 2010-2014
* Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
@@ -71,14 +71,13 @@ bsdauth_init(struct passwd *pw, sudo_auth *auth)
else
state.lc = login_getclass(pw->pw_uid ? LOGIN_DEFCLASS : LOGIN_DEFROOTCLASS);
if (state.lc == NULL) {
log_warning(NO_MAIL,
log_warning(0,
N_("unable to get login class for user %s"), pw->pw_name);
debug_return_int(AUTH_FATAL);
}
if ((state.as = auth_open()) == NULL) {
log_warning(NO_MAIL,
N_("unable to begin bsd authentication"));
log_warning(0, N_("unable to begin bsd authentication"));
login_close(state.lc);
debug_return_int(AUTH_FATAL);
}
@@ -86,7 +85,7 @@ bsdauth_init(struct passwd *pw, sudo_auth *auth)
/* XXX - maybe sanity check the auth style earlier? */
login_style = login_getstyle(state.lc, login_style, "auth-sudo");
if (login_style == NULL) {
log_warningx(NO_MAIL, N_("invalid authentication type"));
log_warningx(0, N_("invalid authentication type"));
auth_close(state.as);
login_close(state.lc);
debug_return_int(AUTH_FATAL);
@@ -95,7 +94,7 @@ bsdauth_init(struct passwd *pw, sudo_auth *auth)
if (auth_setitem(state.as, AUTHV_STYLE, login_style) < 0 ||
auth_setitem(state.as, AUTHV_NAME, pw->pw_name) < 0 ||
auth_setitem(state.as, AUTHV_CLASS, login_class) < 0) {
log_warningx(NO_MAIL, N_("unable to initialize BSD authentication"));
log_warningx(0, N_("unable to initialize BSD authentication"));
auth_close(state.as);
login_close(state.lc);
debug_return_int(AUTH_FATAL);
@@ -167,7 +166,7 @@ bsdauth_verify(struct passwd *pw, char *prompt, sudo_auth *auth)
debug_return_int(AUTH_INTR);
if ((s = auth_getvalue(as, "errormsg")) != NULL)
log_warningx(NO_MAIL, "%s", s);
log_warningx(0, "%s", s);
debug_return_int(AUTH_FAILURE);
}