Группа :: Система/Основа
Пакет: checkpassword-pam
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: checkpassword-pam-0.99-alt2-alt-changes.patch
Скачать
Скачать
configure.ac | 18 ++++++++++++++++++
pam-support.c | 15 +++++++++++++++
2 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/configure.ac b/configure.ac
index 6ccb74c..ad0096f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,6 +22,24 @@ AC_C_CONST
AC_CHECK_LIB(dl, dlopen)
AC_CHECK_LIB(pam, pam_start)
+AC_ARG_ENABLE(pam_userpass,
+ AC_HELP_STRING([--enable-pam_userpass], [enable pam_userpass]),
+ [_pam_userpass=$enableval],
+ [_pam_userpass=no]
+)
+if test "$_pam_userpass" = "yes"; then
+ AC_MSG_CHECKING([for pam_userpass])
+ AC_TRY_LINK(
+ [#include <security/pam_userpass.h>],
+ [pam_userpass_t userpass; struct pam_conv conv = { pam_userpass_conv, &userpass };],
+ [
+ AC_MSG_RESULT([yes]);
+ LIBS="-lpam_userpass $LIBS"
+ AC_DEFINE([USE_PAM_USERPASS], 1, [Compile with pam_userpass support])
+ ],
+ [AC_MSG_ERROR([no])]
+ )
+fi
AC_SUBST(PREVIOUS_VERSION, previous_version())
diff --git a/pam-support.c b/pam-support.c
index 04b40c9..295cbd4 100644
--- a/pam-support.c
+++ b/pam-support.c
@@ -25,6 +25,10 @@
#include <stdlib.h>
#include <string.h>
+#ifdef USE_PAM_USERPASS
+#include <security/pam_userpass.h>
+static pam_userpass_t userpass;
+#else
static const char* global_password;
static int
@@ -80,6 +84,7 @@ conversation (int num_msg, const struct pam_message **msgs,
return PAM_SUCCESS;
}
+#endif
@@ -88,13 +93,23 @@ authenticate_using_pam (const char* service_name,
const char* username,
const char* password)
{
+#ifdef USE_PAM_USERPASS
+ struct pam_conv pam_conversation = { pam_userpass_conv, &userpass };
+#else
struct pam_conv pam_conversation = { conversation, NULL };
+#endif
pam_handle_t* pamh;
int retval;
char *remoteip;
+#ifdef USE_PAM_USERPASS
+ userpass.user = username;
+ userpass.pass = password;
+#else
/* to be used later from conversation() */
global_password = password;
+#endif
+
/* initialize the PAM library */
debugging("Initializing PAM library using service name '%s'", service_name);