include: move pamfail.h to auth.c

This removes one small header file, and makes inline function to static to
only file it is used in.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2017-07-30 11:32:37 +01:00
parent a6b1ec864a
commit 6766397932
No known key found for this signature in database
GPG Key ID: A9553245FDE9B739
3 changed files with 18 additions and 28 deletions

View File

@ -33,7 +33,6 @@ dist_noinst_HEADERS += \
include/nls.h \
include/optutils.h \
include/pager.h \
include/pamfail.h \
include/partx.h \
include/path.h \
include/pathnames.h \

View File

@ -1,26 +0,0 @@
/*
* No copyright is claimed. This code is in the public domain; do with
* it what you wish.
*
* Written by Karel Zak <kzak@redhat.com>
*/
#ifndef UTIL_LINUX_PAMFAIL_H
#include <security/pam_appl.h>
#ifdef HAVE_SECURITY_PAM_MISC_H
# include <security/pam_misc.h>
#elif defined(HAVE_SECURITY_OPENPAM_H)
# include <security/openpam.h>
#endif
#include "c.h"
static inline int
pam_fail_check(pam_handle_t *pamh, int retcode)
{
if (retcode == PAM_SUCCESS)
return 0;
warnx("%s", pam_strerror(pamh, retcode));
pam_end(pamh, retcode);
return 1;
}
#endif /* UTIL_LINUX_PAMFAIL_H */

View File

@ -7,8 +7,25 @@
* there is no warranty.
*
*/
#include <security/pam_appl.h>
#ifdef HAVE_SECURITY_PAM_MISC_H
# include <security/pam_misc.h>
#elif defined(HAVE_SECURITY_OPENPAM_H)
# include <security/openpam.h>
#endif
#include "c.h"
#include "auth.h"
#include "pamfail.h"
static int pam_fail_check(pam_handle_t *pamh, int retcode)
{
if (retcode == PAM_SUCCESS)
return 0;
warnx("%s", pam_strerror(pamh, retcode));
pam_end(pamh, retcode);
return 1;
}
int auth_pam(const char *service_name, uid_t uid, const char *username)
{