package/php-pam: new package

The php-pam package provides a PHP PAM (Pluggable Authentication
Modules) integration.

https://pecl.php.net/package/PAM

Based on initial work from Nicolas Carrier <nicolas.carrier@orolia.com>

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Herve Codina 2021-10-14 14:13:50 +02:00 committed by Thomas Petazzoni
parent d49127dd4c
commit 403b62943b
6 changed files with 83 additions and 0 deletions

View file

@ -1163,10 +1163,12 @@ F: package/lua-augeas/
F: package/modsecurity2/
F: package/php-apcu/
F: package/php-lua/
F: package/php-pam/
F: support/testing/tests/package/test_dtbocfg.py
F: support/testing/tests/package/test_lua_augeas.py
F: support/testing/tests/package/test_php_apcu.py
F: support/testing/tests/package/test_php_lua.py
F: support/testing/tests/package/test_php_pam.py
N: Hervé Codina <herve.codina@bootlin.com>
F: package/php-pecl-dbus/
@ -2027,6 +2029,7 @@ F: package/lua-augeas/
F: package/modsecurity2/
F: package/php-apcu/
F: package/php-lua/
F: package/php-pam/
F: package/php-pecl-dbus/
F: package/php-xdebug/
F: package/python-augeas/
@ -2043,6 +2046,7 @@ F: support/testing/tests/package/test_bmap_tools.py
F: support/testing/tests/package/test_php_apcu.py
F: support/testing/tests/package/test_php_pecl_dbus.py
F: support/testing/tests/package/test_php_lua.py
F: support/testing/tests/package/test_php_pam.py
F: support/testing/tests/package/test_python_augeas.py
F: support/testing/tests/package/test_python_flask_expects_json.py
F: support/testing/tests/package/test_python_git.py

View file

@ -870,7 +870,9 @@ menu "External php extensions"
source "package/php-geoip/Config.in"
source "package/php-gnupg/Config.in"
source "package/php-imagick/Config.in"
source "package/php-lua/Config.in"
source "package/php-memcached/Config.in"
source "package/php-pam/Config.in"
source "package/php-pecl-dbus/Config.in"
source "package/php-ssh2/Config.in"
source "package/php-xdebug/Config.in"

16
package/php-pam/Config.in Normal file
View file

@ -0,0 +1,16 @@
config BR2_PACKAGE_PHP_PAM
bool "php-pam"
depends on BR2_ENABLE_LOCALE # linux-pam
depends on BR2_USE_WCHAR # linux-pam
depends on BR2_USE_MMU # linux-pam
depends on !BR2_STATIC_LIBS # linux-pam
select BR2_PACKAGE_LINUX_PAM
help
PHP PAM (Pluggable Authentication Modules) integration
https://pecl.php.net/package/PAM
comment "php-pam needs a toolchain w/ wchar, locale, dynamic library"
depends on BR2_USE_MMU
depends on !BR2_ENABLE_LOCALE || !BR2_USE_WCHAR \
|| BR2_STATIC_LIBS

View file

@ -0,0 +1,3 @@
# Locally calculated:
sha256 fda3b5f719d51cb278351eedd3d7a96db75661324d81fdcf8072a4309121bc92 pam-2.2.3.tgz
sha256 0967ad6cf4b7fe81d38709d7aaef3fecb3bd685be7eebb37b864aa34c991baa7 LICENSE

View file

@ -0,0 +1,26 @@
################################################################################
#
# php-pam
#
################################################################################
PHP_PAM_VERSION = 2.2.3
PHP_PAM_SITE = http://pecl.php.net/get
PHP_PAM_SOURCE = pam-$(PHP_PAM_VERSION).tgz
PHP_PAM_LICENSE = PHP-3.01
PHP_PAM_LICENSE_FILES = LICENSE
PHP_PAM_DEPENDENCIES = php linux-pam host-autoconf host-pkgconf
PHP_PAM_CONF_OPTS = \
--with-php-config=$(STAGING_DIR)/usr/bin/php-config \
--with-pam=$(STAGING_DIR)/usr
define PHP_PAM_PHPIZE
(cd $(@D); \
PHP_AUTOCONF=$(HOST_DIR)/usr/bin/autoconf \
PHP_AUTOHEADER=$(HOST_DIR)/usr/bin/autoheader \
$(STAGING_DIR)/usr/bin/phpize)
endef
PHP_PAM_PRE_CONFIGURE_HOOKS += PHP_PAM_PHPIZE
$(eval $(autotools-package))

View file

@ -0,0 +1,32 @@
import os
import infra.basetest
class TestPhpPam(infra.basetest.BRTest):
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
"""
BR2_PACKAGE_PHP=y
BR2_PACKAGE_PHP_SAPI_CLI=y
BR2_PACKAGE_PHP_PAM=y
BR2_TARGET_ROOTFS_CPIO=y
# BR2_TARGET_ROOTFS_TAR is not set
"""
def test_run(self):
img = os.path.join(self.builddir, "images", "rootfs.cpio")
self.emulator.boot(arch="armv5",
kernel="builtin",
options=["-initrd", img])
self.emulator.login()
self.assertRunOk("mkdir /etc/php.d")
self.assertRunOk("echo 'extension=pam.so'> /etc/php.d/pam.ini")
output, exit_code = self.emulator.run("php --ri pam | sed '/^$/d'")
self.assertEqual(exit_code, 0)
self.assertEqual(output[0], "pam")
self.assertEqual(output[1], "PAM support => enabled")
# Do not check the version value in order to avoid test failure when
# bumping package version
self.assertEqual(output[2][0:21], "Extension version => ")