libpwquality: new package
authorStefan Sørensen <stefan.sorensen@spectralink.com>
Fri, 5 May 2017 12:35:27 +0000 (14:35 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Thu, 11 May 2017 21:16:19 +0000 (23:16 +0200)
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
DEVELOPERS
package/Config.in
package/libpwquality/0001-Fix-build-with-disable-nls-on-platforms-without-libi.patch [new file with mode: 0644]
package/libpwquality/0002-Fix-memory-leak-in-settings-when-using-bad-word-list.patch [new file with mode: 0644]
package/libpwquality/Config.in [new file with mode: 0644]
package/libpwquality/libpwquality.hash [new file with mode: 0644]
package/libpwquality/libpwquality.mk [new file with mode: 0644]

index c8d354dab4e0621807a0dd3f087a17b1f43b113d..de34d066ca5d74943a253531408188493d5baa58 100644 (file)
@@ -1499,6 +1499,7 @@ F:        package/yasm/
 
 N:     Stefan Sørensen <stefan.sorensen@spectralink.com>
 F:     package/cracklib/
+F:     package/libpwquality/
 F:     package/libscrypt/
 
 N:     Stephan Hoffmann <sho@relinux.de>
index 6d24a58da81fada9c4baa5c40b1b915819525c03..7991353f99738074936ffde6aa37392505b7f4b9 100644 (file)
@@ -1394,6 +1394,7 @@ menu "Other"
        source "package/libplist/Config.in"
        source "package/libpthread-stubs/Config.in"
        source "package/libpthsem/Config.in"
+       source "package/libpwquality/Config.in"
        source "package/libseccomp/Config.in"
        source "package/libsigc/Config.in"
        source "package/libsigsegv/Config.in"
diff --git a/package/libpwquality/0001-Fix-build-with-disable-nls-on-platforms-without-libi.patch b/package/libpwquality/0001-Fix-build-with-disable-nls-on-platforms-without-libi.patch
new file mode 100644 (file)
index 0000000..3bae15c
--- /dev/null
@@ -0,0 +1,47 @@
+From fd1694c9d85666a39fe39e76518581b1ccd5a6c5 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Stefan=20S=C3=B8rensen?= <stefan.sorensen@spectralink.com>
+Date: Thu, 2 Feb 2017 11:16:49 +0100
+Subject: [PATCH] Fix build with --disable-nls on platforms without libintl
+ included in libc.
+
+Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
+
+---
+
+Status: accepted upstream, not yet released.
+
+diff --git a/src/pwmake.c b/src/pwmake.c
+index 5b8cfb8..81f7cd3 100644
+--- a/src/pwmake.c
++++ b/src/pwmake.c
+@@ -33,9 +33,11 @@ main(int argc, char *argv[])
+         int bits;
+         void *auxerror;
++#ifdef ENABLE_NLS
+         setlocale(LC_ALL, "");
+         bindtextdomain("libpwquality", "/usr/share/locale");
+         textdomain("libpwquality");
++#endif
+         if (argc != 2) {
+                 usage(basename(argv[0]));
+diff --git a/src/pwscore.c b/src/pwscore.c
+index 219a175..24c13f2 100644
+--- a/src/pwscore.c
++++ b/src/pwscore.c
+@@ -34,9 +34,11 @@ main(int argc, char *argv[])
+         size_t len;
+         char *user = NULL;
++#ifdef ENABLE_NLS
+         setlocale(LC_ALL, "");
+         bindtextdomain("libpwquality", "/usr/share/locale");
+         textdomain("libpwquality");
++#endif
+         if (argc > 2) {
+                 usage(basename(argv[0]));
+-- 
+2.9.3
+
diff --git a/package/libpwquality/0002-Fix-memory-leak-in-settings-when-using-bad-word-list.patch b/package/libpwquality/0002-Fix-memory-leak-in-settings-when-using-bad-word-list.patch
new file mode 100644 (file)
index 0000000..1b4f242
--- /dev/null
@@ -0,0 +1,26 @@
+From b1f2f1f71894fa0af92041fb4d5b6146101d63e5 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Stefan=20S=C3=B8rensen?= <stefan.sorensen@spectralink.com>
+Date: Thu, 2 Feb 2017 11:17:26 +0100
+Subject: [PATCH] Fix memory leak in settings when using bad word list.
+
+Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
+
+---
+
+Status: accepted upstream, not yet released.
+
+diff --git a/src/settings.c b/src/settings.c
+index 5c38b30..4b026b1 100644
+--- a/src/settings.c
++++ b/src/settings.c
+@@ -46,6 +46,7 @@ pwquality_free_settings(pwquality_settings_t *pwq)
+ {
+         if (pwq) {
+                 free(pwq->dict_path);
++                free(pwq->bad_words);
+                 free(pwq);
+         }
+ }
+-- 
+2.9.3
+
diff --git a/package/libpwquality/Config.in b/package/libpwquality/Config.in
new file mode 100644 (file)
index 0000000..4e85525
--- /dev/null
@@ -0,0 +1,19 @@
+config BR2_PACKAGE_LIBPWQUALITY
+       bool "libpwquality"
+       help
+         This is a library for password quality checks and generation
+         of random passwords that pass the checks.  This library uses
+         the cracklib and cracklib dictionaries to perform some of
+         the checks.
+
+         https://github.com/libpwquality/libpwquality
+
+if BR2_PACKAGE_LIBPWQUALITY
+
+config BR2_PACKAGE_LIBPWQUALITY_TOOLS
+       bool "install tools"
+       help
+         Install libpwquality command line tools generating/checking
+         passwords.
+
+endif
diff --git a/package/libpwquality/libpwquality.hash b/package/libpwquality/libpwquality.hash
new file mode 100644 (file)
index 0000000..0e3f9e3
--- /dev/null
@@ -0,0 +1,2 @@
+# Locally calculated
+sha256 74d2ea90e103323c1f2d6a6cc9617cdae6877573eddb31aaf31a40f354cc2d2a        libpwquality-1.3.0.tar.bz2
diff --git a/package/libpwquality/libpwquality.mk b/package/libpwquality/libpwquality.mk
new file mode 100644 (file)
index 0000000..66b15d8
--- /dev/null
@@ -0,0 +1,39 @@
+################################################################################
+#
+# libpwquality
+#
+################################################################################
+
+LIBPWQUALITY_VERSION = 1.3.0
+LIBPWQUALITY_SOURCE = libpwquality-$(LIBPWQUALITY_VERSION).tar.bz2
+LIBPWQUALITY_SITE = https://github.com/libpwquality/libpwquality/releases/download/libpwquality-$(LIBPWQUALITY_VERSION)
+LIBPWQUALITY_LICENSE = BSD-3-Clause or GPL-2.0+
+LIBPWQUALITY_INSTALL_STAGING = YES
+LIBPWQUALITY_DEPENDENCIES = cracklib
+LIBPWQUALITY_LICENSE_FILES = COPYING
+
+ifeq ($(BR2_PACKAGE_PYTHON),y)
+LIBPWQUALITY_CONF_OPTS += --enable-python-bindings
+LIBPWQUALITY_DEPENDENCIES += python
+LIBPWQUALITY_MAKE_ENV += $(PKG_PYTHON_DISTUTILS_ENV)
+else
+LIBPWQUALITY_CONF_OPTS += --disable-python-bindings
+endif
+
+ifeq ($(BR2_PACKAGE_LINUX_PAM),y)
+LIBPWQUALITY_CONF_OPTS += --enable-pam
+LIBPWQUALITY_DEPENDENCIES += linux-pam
+else
+LIBPWQUALITY_CONF_OPTS += --disable-pam
+endif
+
+ifeq ($(BR2_PACKAGE_LIBPWQUALITY_TOOLS),)
+define LIBPWQUALITY_REMOVE_TOOLS
+       rm -f $(TARGET_DIR)/usr/bin/pwmake
+       rm -f $(TARGET_DIR)/usr/bin/pwscore
+endef
+
+LIBPWQUALITY_POST_INSTALL_TARGET_HOOKS += LIBPWQUALITY_REMOVE_TOOLS
+endif
+
+$(eval $(autotools-package))