On 26/04/20 14:04 +0200, Robert Nagy wrote: > On 26/04/20 13:17 +0200, Moises Simon wrote: > > Hi, > > > > I'm trying www/phpldapadmin. > > When I access the web page I see tons of errors of deprecated or non > > existent functions > > like this: > > > > error Error > > Unrecognized error number: 8192: Function mcrypt_module_open() is deprecated > > PHP Debug Backtrace > > File /phpldapadmin/lib/functions.php (184) > > Function error (a:5:{i:0;s:76:"Unrecognized error number: 8192: Fu...) > > File /phpldapadmin/lib/functions.php (749) > > Function app_error_handler (a:5:{i:0;i:8192;i:1;s:43:"Function > > mcrypt_module_o...) > > File /phpldapadmin/lib/ds.php (227) > > Function blowfish_encrypt (a:1:{i:0;s:33:"EDITED";...) > > File /phpldapadmin/lib/ds_ldap.php (276) > > Function setLogin (a:3:{i:0;s:33:"EDITED";...) > > File /phpldapadmin/htdocs/login.php (25) > > Function login (a:3:{i:0;s:33:"EDITED";... > > File /phpldapadmin/htdocs/cmd.php (59) > > Function include (a:1:{i:0;s:30:"/phpldapadmin/htdocs/login.php";}) > > > > Maybe I have setup something wrong but as far as I know phpldapamin > > hasn't been updated since 2012 and uses php5. > > > > Hi > > What happens if you do not load the mcrypt pecl extension? > > Our port has patches to run with php 7.x so that should not be a problem. >
Actually, what we have is not enough. I've updated the port to use a source which is still maintained with lots of fixes for php7. sthen@, i think we should commit this before the release. I've done some minimal testing with it and everything is fine. I've removed the mcrypt dependency because the first choice is now to use blowfish from the openssl extension which is enabled by default. If that is not available it will fallback to mcrypt and then to a bundled blowfish implementation which also works fine, so I think removing the dependency on the deprecated mcrypt extension is the right thing to do. Here is the diff: Index: Makefile =================================================================== RCS file: /cvs/ports/www/phpldapadmin/Makefile,v retrieving revision 1.49 diff -u -p -u -r1.49 Makefile --- Makefile 26 Sep 2019 21:59:31 -0000 1.49 +++ Makefile 26 Apr 2020 12:37:52 -0000 @@ -2,18 +2,17 @@ COMMENT= web-based LDAP browser to manage LDAP servers -VERSION= 1.2.3 -DISTNAME= phpldapadmin-${VERSION} +DISTNAME= phpldapadmin-${GH_TAGNAME} CATEGORIES= www -HOMEPAGE= http://phpldapadmin.sourceforge.net/ -REVISION= 7 +HOMEPAGE= https://github.com/leenooks/phpLDAPadmin + +GH_ACCOUNT= leenooks +GH_TAGNAME= 1.2.5 +GH_PROJECT= phpLDAPadmin # GPLv2 PERMIT_PACKAGE= Yes -MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=phpldapadmin/} -EXTRACT_SUFX= .tgz - NO_BUILD= Yes NO_TEST= Yes PKG_ARCH= * @@ -23,8 +22,7 @@ INSTDIR= ${PREFIX}/phpldapadmin SUBST_VARS= INSTDIR MODULES= lang/php -RUN_DEPENDS= lang/php/${MODPHP_VERSION},-ldap \ - security/pecl-mcrypt${MODPHP_FLAVOR} +RUN_DEPENDS= lang/php/${MODPHP_VERSION},-ldap do-install: ${INSTALL_DATA_DIR} ${PREFIX}/phpldapadmin Index: distinfo =================================================================== RCS file: /cvs/ports/www/phpldapadmin/distinfo,v retrieving revision 1.16 diff -u -p -u -r1.16 distinfo --- distinfo 11 Nov 2013 18:17:27 -0000 1.16 +++ distinfo 26 Apr 2020 12:37:52 -0000 @@ -1,2 +1,2 @@ -SHA256 (phpldapadmin-1.2.3.tgz) = rsr4w853ujiZ3THuXuGDVVsvk0nrjhltzTPYo8SF7Vg= -SIZE (phpldapadmin-1.2.3.tgz) = 1115707 +SHA256 (phpldapadmin-1.2.5.tar.gz) = dFgfWvGr2/ZytqFlXp+zw0oWx1EAGTSIElcfzBD93hs= +SIZE (phpldapadmin-1.2.5.tar.gz) = 1117335 Index: patches/patch-config_config_php_example =================================================================== RCS file: patches/patch-config_config_php_example diff -N patches/patch-config_config_php_example --- patches/patch-config_config_php_example 12 Sep 2015 08:09:05 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,21 +0,0 @@ -$OpenBSD: patch-config_config_php_example,v 1.1 2015/09/12 08:09:05 robert Exp $ ---- config/config.php.example.orig Mon Oct 1 08:54:14 2012 -+++ config/config.php.example Sat Sep 12 09:46:59 2015 -@@ -379,7 +379,7 @@ $servers->setValue('server','name','My LDAP Server'); - - /* Default password hashing algorithm. One of md5, ssha, sha, md5crpyt, smd5, - blowfish, crypt or leave blank for now default algorithm. */ --// $servers->setValue('appearance','password_hash','md5'); -+// $servers->setValue('appearance','password_hash_custom','md5'); - - /* If you specified 'cookie' or 'session' as the auth_type above, you can - optionally specify here an attribute to use when logging in. If you enter -@@ -546,7 +546,7 @@ $servers->setValue('sasl','authz_id_regex','/^uid=([^, - $servers->setValue('sasl','authz_id_replacement','$1'); - $servers->setValue('sasl','props',null); - --$servers->setValue('appearance','password_hash','md5'); -+$servers->setValue('appearance','password_hash_custom','md5'); - $servers->setValue('login','attr','dn'); - $servers->setValue('login','fallback_dn',false); - $servers->setValue('login','class',null); Index: patches/patch-lib_PageRender_php =================================================================== RCS file: patches/patch-lib_PageRender_php diff -N patches/patch-lib_PageRender_php --- patches/patch-lib_PageRender_php 12 Sep 2015 08:09:05 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,30 +0,0 @@ -$OpenBSD: patch-lib_PageRender_php,v 1.1 2015/09/12 08:09:05 robert Exp $ ---- lib/PageRender.php.orig Mon Oct 1 08:54:14 2012 -+++ lib/PageRender.php Sat Sep 12 09:46:59 2015 -@@ -287,7 +287,7 @@ class PageRender extends Visitor { - break; - - default: -- $vals[$i] = password_hash($passwordvalue,$enc); -+ $vals[$i] = password_hash_custom($passwordvalue,$enc); - } - - $vals = array_unique($vals); -@@ -957,7 +957,7 @@ class PageRender extends Visitor { - if (trim($val)) - $enc_type = get_enc_type($val); - else -- $enc_type = $server->getValue('appearance','password_hash'); -+ $enc_type = $server->getValue('appearance','password_hash_custom'); - - $obfuscate_password = obfuscate_password_display($enc_type); - -@@ -982,7 +982,7 @@ class PageRender extends Visitor { - if (trim($val)) - $enc_type = get_enc_type($val); - else -- $enc_type = $server->getValue('appearance','password_hash'); -+ $enc_type = $server->getValue('appearance','password_hash_custom'); - - echo '<table cellspacing="0" cellpadding="0"><tr><td valign="top">'; - Index: patches/patch-lib_TemplateRender_php =================================================================== RCS file: patches/patch-lib_TemplateRender_php diff -N patches/patch-lib_TemplateRender_php --- patches/patch-lib_TemplateRender_php 12 Sep 2015 08:09:05 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,12 +0,0 @@ -$OpenBSD: patch-lib_TemplateRender_php,v 1.1 2015/09/12 08:09:05 robert Exp $ ---- lib/TemplateRender.php.orig Mon Oct 1 08:54:14 2012 -+++ lib/TemplateRender.php Sat Sep 12 09:46:59 2015 -@@ -2466,7 +2466,7 @@ function deleteAttribute(attrName,friendlyName,i) - if ($val = $attribute->getValue($i)) - $default = get_enc_type($val); - else -- $default = $this->getServer()->getValue('appearance','password_hash'); -+ $default = $this->getServer()->getValue('appearance','password_hash_custom'); - - if (! $attribute->getPostValue()) - printf('<input type="hidden" name="post_value[%s][]" value="%s" />',$attribute->getName(),$i); Index: patches/patch-lib_ds_ldap_php =================================================================== RCS file: patches/patch-lib_ds_ldap_php diff -N patches/patch-lib_ds_ldap_php --- patches/patch-lib_ds_ldap_php 12 Sep 2015 08:09:05 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,31 +0,0 @@ -$OpenBSD: patch-lib_ds_ldap_php,v 1.1 2015/09/12 08:09:05 robert Exp $ ---- lib/ds_ldap.php.orig Mon Oct 1 08:54:14 2012 -+++ lib/ds_ldap.php Sat Sep 12 09:46:59 2015 -@@ -1116,13 +1116,24 @@ class ldap extends DS { - - if (is_array($dn)) { - $a = array(); -- foreach ($dn as $key => $rdn) -- $a[$key] = preg_replace('/\\\([0-9A-Fa-f]{2})/e',"''.chr(hexdec('\\1')).''",$rdn); -+ foreach ($dn as $key => $rdn) { -+ $a[$key] = preg_replace_callback('/\\\([0-9A-Fa-f]{2})/', -+ function ($m) { -+ return ''.chr(hexdec('\\1')).''; -+ }, -+ $rdn -+ ); -+ } - - return $a; - - } else -- return preg_replace('/\\\([0-9A-Fa-f]{2})/e',"''.chr(hexdec('\\1')).''",$dn); -+ return preg_replace_callback('/\\\([0-9A-Fa-f]{2})/', -+ function ($m) { -+ return ''.chr(hexdec('\\1')).''; -+ }, -+ $dn -+ ); - } - - public function getRootDSE($method=null) { Index: patches/patch-lib_ds_ldap_pla_php =================================================================== RCS file: patches/patch-lib_ds_ldap_pla_php diff -N patches/patch-lib_ds_ldap_pla_php --- patches/patch-lib_ds_ldap_pla_php 12 Sep 2015 08:09:05 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,12 +0,0 @@ -$OpenBSD: patch-lib_ds_ldap_pla_php,v 1.1 2015/09/12 08:09:05 robert Exp $ ---- lib/ds_ldap_pla.php.orig Mon Oct 1 08:54:14 2012 -+++ lib/ds_ldap_pla.php Sat Sep 12 09:46:59 2015 -@@ -16,7 +16,7 @@ class ldap_pla extends ldap { - function __construct($index) { - parent::__construct($index); - -- $this->default->appearance['password_hash'] = array( -+ $this->default->appearance['password_hash_custom'] = array( - 'desc'=>'Default HASH to use for passwords', - 'default'=>'md5'); - Index: patches/patch-lib_functions_php =================================================================== RCS file: patches/patch-lib_functions_php diff -N patches/patch-lib_functions_php --- patches/patch-lib_functions_php 12 Sep 2015 08:09:05 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,67 +0,0 @@ -$OpenBSD: patch-lib_functions_php,v 1.3 2015/09/12 08:09:05 robert Exp $ ---- lib/functions.php.orig Mon Oct 1 08:54:14 2012 -+++ lib/functions.php Sat Sep 12 09:46:59 2015 -@@ -2127,7 +2127,7 @@ function password_types() { - * crypt, ext_des, md5crypt, blowfish, md5, sha, smd5, ssha, sha512, or clear. - * @return string The hashed password. - */ --function password_hash($password_clear,$enc_type) { -+function password_hash_custom($password_clear,$enc_type) { - if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) - debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs); - -@@ -2318,7 +2318,7 @@ function password_check($cryptedpassword,$plainpasswor - - # SHA crypted passwords - case 'sha': -- if (strcasecmp(password_hash($plainpassword,'sha'),'{SHA}'.$cryptedpassword) == 0) -+ if (strcasecmp(password_hash_custom($plainpassword,'sha'),'{SHA}'.$cryptedpassword) == 0) - return true; - else - return false; -@@ -2327,7 +2327,7 @@ function password_check($cryptedpassword,$plainpasswor - - # MD5 crypted passwords - case 'md5': -- if( strcasecmp(password_hash($plainpassword,'md5'),'{MD5}'.$cryptedpassword) == 0) -+ if( strcasecmp(password_hash_custom($plainpassword,'md5'),'{MD5}'.$cryptedpassword) == 0) - return true; - else - return false; -@@ -2392,7 +2392,7 @@ function password_check($cryptedpassword,$plainpasswor - - # SHA512 crypted passwords - case 'sha512': -- if (strcasecmp(password_hash($plainpassword,'sha512'),'{SHA512}'.$cryptedpassword) == 0) -+ if (strcasecmp(password_hash_custom($plainpassword,'sha512'),'{SHA512}'.$cryptedpassword) == 0) - return true; - else - return false; -@@ -2564,13 +2564,24 @@ function dn_unescape($dn) { - if (is_array($dn)) { - $a = array(); - -- foreach ($dn as $key => $rdn) -- $a[$key] = preg_replace('/\\\([0-9A-Fa-f]{2})/e',"''.chr(hexdec('\\1')).''",$rdn); -+ foreach ($dn as $key => $rdn) { -+ $a[$key] = preg_replace_callback('/\\\([0-9A-Fa-f]{2})/', -+ function ($m) { -+ return ''.chr(hexdec('\\1')).''; -+ }, -+ $rdn -+ ); -+ } - - return $a; - - } else { -- return preg_replace('/\\\([0-9A-Fa-f]{2})/e',"''.chr(hexdec('\\1')).''",$dn); -+ return preg_replace_callback('/\\\([0-9A-Fa-f]{2})/', -+ function ($m) { -+ return ''.chr(hexdec('\\1')).''; -+ }, -+ $dn -+ ); - } - } - Index: pkg/PLIST =================================================================== RCS file: /cvs/ports/www/phpldapadmin/pkg/PLIST,v retrieving revision 1.18 diff -u -p -u -r1.18 PLIST --- pkg/PLIST 4 Sep 2018 12:46:26 -0000 1.18 +++ pkg/PLIST 26 Apr 2020 12:37:52 -0000 @@ -2,7 +2,7 @@ @group daemon phpldapadmin/ @comment phpldapadmin/.gitignore -phpldapadmin/INSTALL +phpldapadmin/INSTALL.md phpldapadmin/LICENSE phpldapadmin/VERSION phpldapadmin/config/