50 lines
1.5 KiB
Diff
50 lines
1.5 KiB
Diff
From 9084c1b032161cdb53d5f66132a91bdc207faecf Mon Sep 17 00:00:00 2001
|
|
From: Noel Kuntze <noel.kuntze@thermi.consulting>
|
|
Date: Mon, 24 May 2021 14:15:34 +0200
|
|
Subject: [PATCH] pam_pwquality.c: Use pam_modutil_check_user_in_passwd instead
|
|
of fgetpwent_r (not available on musl)
|
|
|
|
---
|
|
configure.ac | 5 +++++
|
|
src/pam_pwquality.c | 4 ++++
|
|
2 files changed, 9 insertions(+)
|
|
|
|
diff --git a/configure.ac b/configure.ac
|
|
index 201a2e6..f995294 100644
|
|
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -97,6 +97,11 @@ if test "$enable_pam" != "no"; then
|
|
test $fail = 1 &&
|
|
AC_MSG_ERROR([You must install the PAM development package in order to compile libpwquality])
|
|
fi
|
|
+ AC_CHECK_FUNC(
|
|
+ [pam_modutil_check_user_in_passwd],
|
|
+ [AC_DEFINE([HAVE_PAM_CHECK_USER_IN_PASSWD], [], [have pam_modutil_check_user_in_passwd])],
|
|
+ []
|
|
+ )
|
|
fi
|
|
|
|
if test "$enable_pam" = "yes"; then
|
|
diff --git a/src/pam_pwquality.c b/src/pam_pwquality.c
|
|
index 53a9b66..5c09bc7 100644
|
|
--- a/src/pam_pwquality.c
|
|
+++ b/src/pam_pwquality.c
|
|
@@ -98,6 +98,9 @@ static int
|
|
check_local_user (pam_handle_t *pamh,
|
|
const char *user)
|
|
{
|
|
+#ifdef HAVE_PAM_CHECK_USER_IN_PASSWD
|
|
+ return pam_modutil_check_user_in_passwd(pamh, user, NULL) == PAM_SUCCESS;
|
|
+#else
|
|
struct passwd pw, *pwp;
|
|
char buf[4096];
|
|
int found = 0;
|
|
@@ -136,6 +139,7 @@ check_local_user (pam_handle_t *pamh,
|
|
} else {
|
|
return found;
|
|
}
|
|
+#endif
|
|
}
|
|
|
|
PAM_EXTERN int
|