blob: bb83b9404a60bcb4299ced954f16b96e91ad8b49 [file] [log] [blame]
bigbiff bigbiffe60683a2013-02-22 20:55:50 -05001/*
2 * No copyright is claimed. This code is in the public domain; do with
3 * it what you wish.
4 *
5 * Written by Karel Zak <kzak@redhat.com>
6 */
7#ifndef UTIL_LINUX_PAMFAIL_H
8#include <security/pam_appl.h>
bigbiff7b4c7a62015-01-01 19:44:14 -05009#ifdef HAVE_SECURITY_PAM_MISC_H
10# include <security/pam_misc.h>
11#elif defined(HAVE_SECURITY_OPENPAM_H)
12# include <security/openpam.h>
13#endif
bigbiff bigbiffe60683a2013-02-22 20:55:50 -050014#include "c.h"
15
16static inline int
17pam_fail_check(pam_handle_t *pamh, int retcode)
18{
19 if (retcode == PAM_SUCCESS)
20 return 0;
21 warnx("%s", pam_strerror(pamh, retcode));
22 pam_end(pamh, retcode);
23 return 1;
24}
25
26#endif /* UTIL_LINUX_PAMFAIL_H */