|
Packit |
6bd9ab |
/*
|
|
Packit |
6bd9ab |
pam_compat.h - provide a replacement definitions for some pam functions
|
|
Packit |
6bd9ab |
|
|
Packit |
6bd9ab |
Copyright (C) 2009-2017 Arthur de Jong
|
|
Packit |
6bd9ab |
|
|
Packit |
6bd9ab |
This library is free software; you can redistribute it and/or
|
|
Packit |
6bd9ab |
modify it under the terms of the GNU Lesser General Public
|
|
Packit |
6bd9ab |
License as published by the Free Software Foundation; either
|
|
Packit |
6bd9ab |
version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
6bd9ab |
|
|
Packit |
6bd9ab |
This library is distributed in the hope that it will be useful,
|
|
Packit |
6bd9ab |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
6bd9ab |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
6bd9ab |
Lesser General Public License for more details.
|
|
Packit |
6bd9ab |
|
|
Packit |
6bd9ab |
You should have received a copy of the GNU Lesser General Public
|
|
Packit |
6bd9ab |
License along with this library; if not, write to the Free Software
|
|
Packit |
6bd9ab |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
Packit |
6bd9ab |
02110-1301 USA
|
|
Packit |
6bd9ab |
*/
|
|
Packit |
6bd9ab |
|
|
Packit |
6bd9ab |
#ifndef COMPAT__PAM_COMPAT_H
|
|
Packit |
6bd9ab |
#define COMPAT__PAM_COMPAT_H 1
|
|
Packit |
6bd9ab |
|
|
Packit |
6bd9ab |
#ifdef HAVE_SECURITY_PAM_APPL_H
|
|
Packit |
6bd9ab |
#include <security/pam_appl.h>
|
|
Packit |
6bd9ab |
#endif /* HAVE_SECURITY_PAM_APPL_H */
|
|
Packit |
6bd9ab |
#ifndef HAVE_PAM_PAM_MODULES_H
|
|
Packit |
6bd9ab |
#include <security/pam_modules.h>
|
|
Packit |
6bd9ab |
#ifdef HAVE_SECURITY_PAM_EXT_H
|
|
Packit |
6bd9ab |
#include <security/pam_ext.h>
|
|
Packit |
6bd9ab |
#endif /* HAVE_SECURITY_PAM_EXT_H */
|
|
Packit |
6bd9ab |
#else /* not HAVE_PAM_PAM_MODULES_H */
|
|
Packit |
6bd9ab |
#include <pam/pam_modules.h>
|
|
Packit |
6bd9ab |
#endif /* not HAVE_PAM_PAM_MODULES_H */
|
|
Packit |
6bd9ab |
#ifdef HAVE_SECURITY_PAM_MODUTIL_H
|
|
Packit |
6bd9ab |
#include <security/pam_modutil.h>
|
|
Packit |
6bd9ab |
#endif /* HAVE_SECURITY_PAM_MODUTIL_H */
|
|
Packit |
6bd9ab |
|
|
Packit |
6bd9ab |
/* find value of PAM_AUTHTOK_RECOVERY_ERR */
|
|
Packit |
6bd9ab |
#ifndef PAM_AUTHTOK_RECOVERY_ERR
|
|
Packit |
6bd9ab |
#ifdef PAM_AUTHTOK_RECOVER_ERR
|
|
Packit |
6bd9ab |
#define PAM_AUTHTOK_RECOVERY_ERR PAM_AUTHTOK_RECOVER_ERR
|
|
Packit |
6bd9ab |
#else
|
|
Packit |
6bd9ab |
#define PAM_AUTHTOK_RECOVERY_ERR 21 /* not defined anywhere */
|
|
Packit |
6bd9ab |
#endif
|
|
Packit |
6bd9ab |
#endif /* not PAM_AUTHTOK_RECOVERY_ERR */
|
|
Packit |
6bd9ab |
|
|
Packit |
6bd9ab |
/* define our own replacement pam_get_authtok() if it wasn't found */
|
|
Packit |
6bd9ab |
#ifndef HAVE_PAM_GET_AUTHTOK
|
|
Packit |
6bd9ab |
int pam_get_authtok(pam_handle_t *pamh, int item, const char **authtok,
|
|
Packit |
6bd9ab |
const char *prompt);
|
|
Packit |
6bd9ab |
#endif /* not HAVE_PAM_GET_AUTHTOK */
|
|
Packit |
6bd9ab |
|
|
Packit |
6bd9ab |
/* replace pam_prompt() if needed */
|
|
Packit |
6bd9ab |
#ifndef HAVE_PAM_PROMPT
|
|
Packit |
6bd9ab |
int pam_prompt(pam_handle_t *pamh, int style, char **response,
|
|
Packit |
6bd9ab |
const char *format, ...)
|
|
Packit |
6bd9ab |
LIKE_PRINTF(4, 5);
|
|
Packit |
6bd9ab |
#endif /* not HAVE_PAM_PROMPT */
|
|
Packit |
6bd9ab |
|
|
Packit |
6bd9ab |
/* provide pam_info() if needed */
|
|
Packit |
6bd9ab |
#if !HAVE_DECL_PAM_INFO
|
|
Packit |
6bd9ab |
#define pam_info(pamh, format...) \
|
|
Packit |
6bd9ab |
pam_prompt(pamh, PAM_TEXT_INFO, NULL, ##format)
|
|
Packit |
6bd9ab |
#endif /* not HAVE_DECL_PAM_INFO */
|
|
Packit |
6bd9ab |
|
|
Packit |
6bd9ab |
/* provide pam_error() if needed */
|
|
Packit |
6bd9ab |
#if !HAVE_DECL_PAM_ERROR
|
|
Packit |
6bd9ab |
#define pam_error(pamh, format...) \
|
|
Packit |
6bd9ab |
pam_prompt(pamh, PAM_ERROR_MSG, NULL, ##format)
|
|
Packit |
6bd9ab |
#endif /* not HAVE_DECL_PAM_ERROR */
|
|
Packit |
6bd9ab |
|
|
Packit |
6bd9ab |
/* fall back to using getpwnam() if pam_modutil_getpwnam() isn't defined */
|
|
Packit |
6bd9ab |
#ifndef HAVE_PAM_MODUTIL_GETGWNAM
|
|
Packit |
6bd9ab |
#include <sys/types.h>
|
|
Packit |
6bd9ab |
#include <pwd.h>
|
|
Packit |
6bd9ab |
#define pam_modutil_getpwnam(pamh, user) \
|
|
Packit |
6bd9ab |
getpwnam(user)
|
|
Packit |
6bd9ab |
#endif /* not HAVE_PAM_MODUTIL_GETGWNAM */
|
|
Packit |
6bd9ab |
|
|
Packit |
6bd9ab |
/* fall back to using syslog() if pam_syslog() doesn't exist */
|
|
Packit |
6bd9ab |
#ifndef HAVE_PAM_SYSLOG
|
|
Packit |
6bd9ab |
#ifndef LOG_AUTHPRIV
|
|
Packit |
6bd9ab |
#define LOG_AUTHPRIV LOG_AUTH
|
|
Packit |
6bd9ab |
#endif /* not LOG_AUTHPRIV */
|
|
Packit |
6bd9ab |
#define pam_syslog(pamh, priority, format...) \
|
|
Packit |
6bd9ab |
syslog(LOG_AUTHPRIV|(priority), ##format)
|
|
Packit |
6bd9ab |
#endif /* not HAVE_PAM_SYSLOG */
|
|
Packit |
6bd9ab |
|
|
Packit |
6bd9ab |
#endif /* _COMPAT_LDAP_COMPAT_H */
|