version 1.1.1.2, 2012/05/29 12:26:49
|
version 1.1.1.3, 2013/07/22 10:46:12
|
Line 1
|
Line 1
|
/* |
/* |
* Copyright (c) 2000-2005, 2007-2008, 2010-2011 | * Copyright (c) 2000-2005, 2007-2008, 2010-2013 |
* Todd C. Miller <Todd.Miller@courtesan.com> |
* Todd C. Miller <Todd.Miller@courtesan.com> |
* |
* |
* Permission to use, copy, modify, and distribute this software for any |
* Permission to use, copy, modify, and distribute this software for any |
Line 22
|
Line 22
|
#include <config.h> |
#include <config.h> |
|
|
#include <sys/types.h> |
#include <sys/types.h> |
#include <sys/param.h> |
|
#include <stdio.h> |
#include <stdio.h> |
#ifdef STDC_HEADERS |
#ifdef STDC_HEADERS |
# include <stdlib.h> |
# include <stdlib.h> |
Line 74 bsdauth_init(struct passwd *pw, sudo_auth *auth)
|
Line 73 bsdauth_init(struct passwd *pw, sudo_auth *auth)
|
else |
else |
state.lc = login_getclass(pw->pw_uid ? LOGIN_DEFCLASS : LOGIN_DEFROOTCLASS); |
state.lc = login_getclass(pw->pw_uid ? LOGIN_DEFCLASS : LOGIN_DEFROOTCLASS); |
if (state.lc == NULL) { |
if (state.lc == NULL) { |
log_error(USE_ERRNO|NO_MAIL, | log_warning(USE_ERRNO|NO_MAIL, |
_("unable to get login class for user %s"), pw->pw_name); | N_("unable to get login class for user %s"), pw->pw_name); |
debug_return_int(AUTH_FATAL); |
debug_return_int(AUTH_FATAL); |
} |
} |
|
|
if ((state.as = auth_open()) == NULL) { |
if ((state.as = auth_open()) == NULL) { |
log_error(USE_ERRNO|NO_MAIL, | log_warning(USE_ERRNO|NO_MAIL, |
_("unable to begin bsd authentication")); | N_("unable to begin bsd authentication")); |
login_close(state.lc); |
login_close(state.lc); |
debug_return_int(AUTH_FATAL); |
debug_return_int(AUTH_FATAL); |
} |
} |
Line 89 bsdauth_init(struct passwd *pw, sudo_auth *auth)
|
Line 88 bsdauth_init(struct passwd *pw, sudo_auth *auth)
|
/* XXX - maybe sanity check the auth style earlier? */ |
/* XXX - maybe sanity check the auth style earlier? */ |
login_style = login_getstyle(state.lc, login_style, "auth-sudo"); |
login_style = login_getstyle(state.lc, login_style, "auth-sudo"); |
if (login_style == NULL) { |
if (login_style == NULL) { |
log_error(NO_MAIL, _("invalid authentication type")); | log_warning(NO_MAIL, N_("invalid authentication type")); |
auth_close(state.as); |
auth_close(state.as); |
login_close(state.lc); |
login_close(state.lc); |
debug_return_int(AUTH_FATAL); |
debug_return_int(AUTH_FATAL); |
Line 98 bsdauth_init(struct passwd *pw, sudo_auth *auth)
|
Line 97 bsdauth_init(struct passwd *pw, sudo_auth *auth)
|
if (auth_setitem(state.as, AUTHV_STYLE, login_style) < 0 || |
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_NAME, pw->pw_name) < 0 || |
auth_setitem(state.as, AUTHV_CLASS, login_class) < 0) { |
auth_setitem(state.as, AUTHV_CLASS, login_class) < 0) { |
log_error(NO_MAIL, _("unable to setup authentication")); | log_warning(NO_MAIL, N_("unable to setup authentication")); |
auth_close(state.as); |
auth_close(state.as); |
login_close(state.lc); |
login_close(state.lc); |
debug_return_int(AUTH_FATAL); |
debug_return_int(AUTH_FATAL); |
Line 170 bsdauth_verify(struct passwd *pw, char *prompt, sudo_a
|
Line 169 bsdauth_verify(struct passwd *pw, char *prompt, sudo_a
|
debug_return_int(AUTH_INTR); |
debug_return_int(AUTH_INTR); |
|
|
if ((s = auth_getvalue(as, "errormsg")) != NULL) |
if ((s = auth_getvalue(as, "errormsg")) != NULL) |
log_error(NO_MAIL, "%s", s); | log_warning(NO_MAIL, "%s", s); |
debug_return_int(AUTH_FAILURE); |
debug_return_int(AUTH_FAILURE); |
} |
} |
|
|