diff mbox series

[meta-oe,06/55] pam-plugin-ldapdb: upgrade 1.3.1 -> 2.0.0

Message ID 20261125080732.2419614-12-khem.raj@oss.qualcomm.com
State New
Headers show
Series [meta-multimedia] clightd: Port ALS sensor to libiio 1.0 | expand

Commit Message

Khem Raj Nov. 25, 2026, 8:06 a.m. UTC
- Security: reject usernames containing DN metacharacters so they cannot
  alter the generated binddn, and disable LDAP referral chasing so
  credentials are not sent to referred hosts
- Use LDAPv3 explicitly and ldap_sasl_bind_s instead of the deprecated
  ldap_simple_bind_s
- New timeout= option for connection and bind timeouts (default 10 s);
  unknown, duplicate or malformed module arguments are logged
- Behavior change: uri and binddn are required, binddn must contain %s,
  and directory errors return PAM_AUTHINFO_UNAVAIL
- Fix LDAP handle and file-descriptor leaks per authentication, range-
  check minimum_uid/maximum_uid, and stop exceptions crossing the PAM C
  interface
- Makefile honors CXXFLAGS, adds hardening flags and detects the PAM
  module directory

The project moved to github.com/smackysnacks/pam_ldapdb. Fetch the
v2.0.0 tag and add an upstream check.

2.0.0 uses struct timeval without including <sys/time.h>, which breaks the musl build; add a patch for it. Anchor UPSTREAM_CHECK_GITTAGREGEX to release tags.

AI-Generated: Uses Claude Code
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
---
 ...nclude-sys-time.h-for-struct-timeval.patch | 32 +++++++++++++++++++
 .../pam/pam-plugin-ldapdb_1.3.1.bb            | 21 ------------
 .../pam/pam-plugin-ldapdb_2.0.0.bb            | 25 +++++++++++++++
 3 files changed, 57 insertions(+), 21 deletions(-)
 create mode 100644 meta-oe/recipes-extended/pam/pam-plugin-ldapdb/0001-Include-sys-time.h-for-struct-timeval.patch
 delete mode 100644 meta-oe/recipes-extended/pam/pam-plugin-ldapdb_1.3.1.bb
 create mode 100644 meta-oe/recipes-extended/pam/pam-plugin-ldapdb_2.0.0.bb
diff mbox series

Patch

diff --git a/meta-oe/recipes-extended/pam/pam-plugin-ldapdb/0001-Include-sys-time.h-for-struct-timeval.patch b/meta-oe/recipes-extended/pam/pam-plugin-ldapdb/0001-Include-sys-time.h-for-struct-timeval.patch
new file mode 100644
index 0000000000..8d0025e0e7
--- /dev/null
+++ b/meta-oe/recipes-extended/pam/pam-plugin-ldapdb/0001-Include-sys-time.h-for-struct-timeval.patch
@@ -0,0 +1,32 @@ 
+From ac86beda314368dead44083a99cece306e72fed7 Mon Sep 17 00:00:00 2001
+From: Khem Raj <khem.raj@oss.qualcomm.com>
+Date: Mon, 23 Nov 2026 01:10:11 -0800
+Subject: [PATCH] Include sys/time.h for struct timeval
+
+pam_ldapdb.cpp uses struct timeval for the LDAP network timeout.
+glibc headers pull in <sys/time.h> indirectly, musl does not, so
+the build fails with:
+
+  pam_ldapdb.cpp:55:20: error: variable has incomplete type 'struct timeval'
+
+Include it explicitly.
+
+Upstream-Status: Submitted [https://github.com/smackysnacks/pam_ldapdb/pull/15]
+AI-Generated: Uses Claude Code
+Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
+---
+ pam_ldapdb.cpp | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/pam_ldapdb.cpp b/pam_ldapdb.cpp
+index 6b73ca5..cccc33b 100644
+--- a/pam_ldapdb.cpp
++++ b/pam_ldapdb.cpp
+@@ -3,6 +3,7 @@
+ #include <pwd.h>
+ #include <stdexcept>
+ #include <string>
++#include <sys/time.h>
+ #include <syslog.h>
+ #include <utility>
+ 
diff --git a/meta-oe/recipes-extended/pam/pam-plugin-ldapdb_1.3.1.bb b/meta-oe/recipes-extended/pam/pam-plugin-ldapdb_1.3.1.bb
deleted file mode 100644
index 2886137b7d..0000000000
--- a/meta-oe/recipes-extended/pam/pam-plugin-ldapdb_1.3.1.bb
+++ /dev/null
@@ -1,21 +0,0 @@ 
-SUMMARY = "PAM searchless LDAP authentication module"
-HOMEPAGE = "https://github.com/rmbreak/pam_ldapdb"
-BUGTRACKER = "https://github.com/rmbreak/pam_ldapdb/issues"
-SECTION = "libs"
-LICENSE = "MIT"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=41ab94182d94be9bb35e2a8b933f1e7d"
-
-DEPENDS = "libpam openldap"
-
-inherit features_check
-REQUIRED_DISTRO_FEATURES = "pam"
-
-SRCREV = "3e026863cad1fd45c760ee1bc93ef4f0606cc852"
-SRC_URI = "git://github.com/rmbreak/pam_ldapdb;branch=master;protocol=https"
-
-
-do_install () {
-    oe_runmake install DESTDIR=${D} PAMDIR=${base_libdir}/security
-}
-
-FILES:${PN} += "${base_libdir}/security/pam_ldapdb.so"
diff --git a/meta-oe/recipes-extended/pam/pam-plugin-ldapdb_2.0.0.bb b/meta-oe/recipes-extended/pam/pam-plugin-ldapdb_2.0.0.bb
new file mode 100644
index 0000000000..709d798133
--- /dev/null
+++ b/meta-oe/recipes-extended/pam/pam-plugin-ldapdb_2.0.0.bb
@@ -0,0 +1,25 @@ 
+SUMMARY = "PAM searchless LDAP authentication module"
+HOMEPAGE = "https://github.com/smackysnacks/pam_ldapdb"
+BUGTRACKER = "https://github.com/smackysnacks/pam_ldapdb/issues"
+SECTION = "libs"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=41ab94182d94be9bb35e2a8b933f1e7d"
+
+DEPENDS = "libpam openldap"
+
+inherit features_check
+REQUIRED_DISTRO_FEATURES = "pam"
+
+SRCREV = "f8ad9921f94d683d9cd40566694709308a12ae71"
+SRC_URI = "git://github.com/smackysnacks/pam_ldapdb;branch=master;protocol=https;tag=v${PV} \
+           file://0001-Include-sys-time.h-for-struct-timeval.patch \
+           "
+
+UPSTREAM_CHECK_GITTAGREGEX = "^v(?P<pver>\d+(\.\d+)+)$"
+
+
+do_install () {
+    oe_runmake install DESTDIR=${D} PAMDIR=${base_libdir}/security
+}
+
+FILES:${PN} += "${base_libdir}/security/pam_ldapdb.so"