diff options
author | Steve Langasek <vorlon@debian.org> | 2014-01-16 00:38:42 +0000 |
---|---|---|
committer | Steve Langasek <vorlon@debian.org> | 2014-01-16 00:38:42 +0000 |
commit | 60fe4501b4194949d3117a937abdfa90d3f138e9 (patch) | |
tree | 212a6a00baa11e9d0ca7bc27b12420d1dce6f07c /libpam/pam_auth.c | |
download | pam-60fe4501b4194949d3117a937abdfa90d3f138e9.tar.gz pam-60fe4501b4194949d3117a937abdfa90d3f138e9.tar.bz2 pam-60fe4501b4194949d3117a937abdfa90d3f138e9.zip |
Import pam_1.1.8.orig.tar.gz
[dgit import orig pam_1.1.8.orig.tar.gz]
Diffstat (limited to 'libpam/pam_auth.c')
-rw-r--r-- | libpam/pam_auth.c | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/libpam/pam_auth.c b/libpam/pam_auth.c new file mode 100644 index 00000000..5984fa59 --- /dev/null +++ b/libpam/pam_auth.c @@ -0,0 +1,81 @@ +/* + * pam_auth.c -- PAM authentication + * + * $Id$ + * + */ + +#include "pam_private.h" +#include "pam_prelude.h" + +#include <stdio.h> +#include <stdlib.h> + +int pam_authenticate(pam_handle_t *pamh, int flags) +{ + int retval; + + D(("pam_authenticate called")); + + IF_NO_PAMH("pam_authenticate", pamh, PAM_SYSTEM_ERR); + + if (__PAM_FROM_MODULE(pamh)) { + D(("called from module!?")); + return PAM_SYSTEM_ERR; + } + + if (pamh->former.choice == PAM_NOT_STACKED) { + _pam_sanitize(pamh); + _pam_start_timer(pamh); /* we try to make the time for a failure + independent of the time it takes to + fail */ + } + + retval = _pam_dispatch(pamh, flags, PAM_AUTHENTICATE); + + if (retval != PAM_INCOMPLETE) { + _pam_sanitize(pamh); + _pam_await_timer(pamh, retval); /* if unsuccessful then wait now */ + D(("pam_authenticate exit")); + } else { + D(("will resume when ready")); + } + +#ifdef PRELUDE + prelude_send_alert(pamh, retval); +#endif + +#ifdef HAVE_LIBAUDIT + retval = _pam_auditlog(pamh, PAM_AUTHENTICATE, retval, flags); +#endif + + return retval; +} + +int pam_setcred(pam_handle_t *pamh, int flags) +{ + int retval; + + D(("pam_setcred called")); + + IF_NO_PAMH("pam_setcred", pamh, PAM_SYSTEM_ERR); + + if (__PAM_FROM_MODULE(pamh)) { + D(("called from module!?")); + return PAM_SYSTEM_ERR; + } + + if (! flags) { + flags = PAM_ESTABLISH_CRED; + } + + retval = _pam_dispatch(pamh, flags, PAM_SETCRED); + +#ifdef HAVE_LIBAUDIT + retval = _pam_auditlog(pamh, PAM_SETCRED, retval, flags); +#endif + + D(("pam_setcred exit")); + + return retval; +} |