aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoel Kuntze <noel.kuntze@thermi.consulting>2021-04-19 17:34:08 +0200
committerRasmus Thomsen <oss@cogitri.dev>2021-05-29 14:09:03 +0000
commitc2bec59e7e2ba379299f68a10cb537c859baa90c (patch)
tree6bdc0209293cb2455a44aa973c59084c98fbef40
parentec52eb80637548e088c3da2f51ca4184f20b218a (diff)
downloadaports-c2bec59e7e2ba379299f68a10cb537c859baa90c.tar.gz
aports-c2bec59e7e2ba379299f68a10cb537c859baa90c.tar.bz2
aports-c2bec59e7e2ba379299f68a10cb537c859baa90c.tar.xz
libpwquality: Fix bug with incorrect linking and issue with _pam_parse (replace internals with pam helper function)
-rw-r--r--community/libpwquality/0001-fix-musl-build.patch57
-rw-r--r--community/libpwquality/APKBUILD10
2 files changed, 64 insertions, 3 deletions
diff --git a/community/libpwquality/0001-fix-musl-build.patch b/community/libpwquality/0001-fix-musl-build.patch
new file mode 100644
index 0000000000..ceb1c288ec
--- /dev/null
+++ b/community/libpwquality/0001-fix-musl-build.patch
@@ -0,0 +1,57 @@
+--- a/src/pam_pwquality.c 2021-04-14 22:11:31.763901505 +0200
++++ b/src/pam_pwquality.c 2021-04-14 22:14:18.145189196 +0200
+@@ -43,8 +43,6 @@
+
+ #define CO_RETRY_TIMES 1
+
+-#define PATH_PASSWD "/etc/passwd"
+-
+ static int
+ _pam_parse (pam_handle_t *pamh, struct module_options *opt,
+ int argc, const char **argv)
+@@ -98,44 +96,7 @@
+ check_local_user (pam_handle_t *pamh,
+ const char *user)
+ {
+- struct passwd pw, *pwp;
+- char buf[4096];
+- int found = 0;
+- FILE *fp;
+- int errn;
+-
+- fp = fopen(PATH_PASSWD, "r");
+- if (fp == NULL) {
+- pam_syslog(pamh, LOG_ERR, "unable to open %s: %s",
+- PATH_PASSWD, pam_strerror(pamh, errno));
+- return -1;
+- }
+-
+- for (;;) {
+- errn = fgetpwent_r(fp, &pw, buf, sizeof (buf), &pwp);
+- if (errn == ERANGE) {
+- pam_syslog(pamh, LOG_WARNING, "%s contains very long lines; corrupted?",
+- PATH_PASSWD);
+- /* we can continue here as next call will read further */
+- continue;
+- }
+- if (errn != 0)
+- break;
+- if (strcmp(pwp->pw_name, user) == 0) {
+- found = 1;
+- break;
+- }
+- }
+-
+- fclose (fp);
+-
+- if (errn != 0 && errn != ENOENT) {
+- pam_syslog(pamh, LOG_ERR, "unable to enumerate local accounts: %s",
+- pam_strerror(pamh, errn));
+- return -1;
+- } else {
+- return found;
+- }
++ return pam_modutil_check_user_in_passwd(pamh, user, NULL) == PAM_SUCCESS;
+ }
+
+ PAM_EXTERN int
diff --git a/community/libpwquality/APKBUILD b/community/libpwquality/APKBUILD
index ad908026da..d3c5b1f6a8 100644
--- a/community/libpwquality/APKBUILD
+++ b/community/libpwquality/APKBUILD
@@ -1,7 +1,7 @@
# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=libpwquality
pkgver=1.4.4
-pkgrel=1
+pkgrel=2
pkgdesc="Password quality checking library"
url="https://github.com/libpwquality/libpwquality"
arch="all"
@@ -10,9 +10,12 @@ depends="cracklib-words"
makedepends="cracklib-dev python3-dev linux-pam-dev"
options="!check" # no tests
subpackages="$pkgname-static $pkgname-dev $pkgname-doc py3-$pkgname:_py3 $pkgname-lang"
-source="https://github.com/libpwquality/libpwquality/releases/download/libpwquality-$pkgver/libpwquality-$pkgver.tar.bz2"
+source="https://github.com/libpwquality/libpwquality/releases/download/libpwquality-$pkgver/libpwquality-$pkgver.tar.bz2
+ 0001-fix-musl-build.patch
+ "
build() {
+ LDFLAGS="$LDFLAGS -lintl" \
./configure \
--build=$CBUILD \
--host=$CHOST \
@@ -39,4 +42,5 @@ _py3() {
mv "$pkgdir"/usr/lib/python* "$subpkgdir"/usr/lib/
}
-sha512sums="2d49b79105361663f009f7183fde9123e6f1e63bd678dfe5418143f611e763af8dd44374b826b3c22a00e721047c539741dc44d99a2289b9ab229791768d6e76 libpwquality-1.4.4.tar.bz2"
+sha512sums="2d49b79105361663f009f7183fde9123e6f1e63bd678dfe5418143f611e763af8dd44374b826b3c22a00e721047c539741dc44d99a2289b9ab229791768d6e76 libpwquality-1.4.4.tar.bz2
+c0b01bbb798a13b706668bdad028334ca6b4bb384dee5d6aefabbd0f4c1946c7e73e50197ced65c959655623570660ed06ef760599e02b770f1d4e4042117912 0001-fix-musl-build.patch"