pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/databases/phpldapadmin phpldapadmin: import fixes for ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/cb5caab674b9
branches:  trunk
changeset: 447565:cb5caab674b9
user:      khorben <khorben%pkgsrc.org@localhost>
date:      Sun Feb 21 22:22:22 2021 +0000

description:
phpldapadmin: import fixes for PHP > 5.5, 7.2, 7.3

With help from the patches available at
https://packages.debian.org/source/sid/phpldapadmin.

diffstat:

 databases/phpldapadmin/Makefile                                |   4 +-
 databases/phpldapadmin/distinfo                                |  10 +-
 databases/phpldapadmin/patches/patch-config_config.php.example |  24 +++
 databases/phpldapadmin/patches/patch-htdocs_index.php          |  18 ++
 databases/phpldapadmin/patches/patch-lib_PageRender.php        |  33 ++++
 databases/phpldapadmin/patches/patch-lib_QueryRender.php       |  15 ++
 databases/phpldapadmin/patches/patch-lib_TemplateRender.php    |  15 ++
 databases/phpldapadmin/patches/patch-lib_ds__ldap__pla.php     |  15 ++
 databases/phpldapadmin/patches/patch-lib_functions.php         |  73 +++++++++-
 9 files changed, 198 insertions(+), 9 deletions(-)

diffs (284 lines):

diff -r 1a52f76511a8 -r cb5caab674b9 databases/phpldapadmin/Makefile
--- a/databases/phpldapadmin/Makefile   Sun Feb 21 18:59:32 2021 +0000
+++ b/databases/phpldapadmin/Makefile   Sun Feb 21 22:22:22 2021 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.44 2020/05/22 19:28:33 rillig Exp $
+# $NetBSD: Makefile,v 1.45 2021/02/21 22:22:22 khorben Exp $
 
 DISTNAME=      phpldapadmin-${VERSION}
-PKGREVISION=   2
+PKGREVISION=   3
 CATEGORIES=    databases www
 MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE:=phpldapadmin/}
 EXTRACT_SUFX=  .tgz
diff -r 1a52f76511a8 -r cb5caab674b9 databases/phpldapadmin/distinfo
--- a/databases/phpldapadmin/distinfo   Sun Feb 21 18:59:32 2021 +0000
+++ b/databases/phpldapadmin/distinfo   Sun Feb 21 22:22:22 2021 +0000
@@ -1,8 +1,14 @@
-$NetBSD: distinfo,v 1.16 2015/11/29 11:25:53 taca Exp $
+$NetBSD: distinfo,v 1.17 2021/02/21 22:22:22 khorben Exp $
 
 SHA1 (phpldapadmin-1.2.3.tgz) = 669fca66c75e24137e106fdd02e3832f81146e23
 RMD160 (phpldapadmin-1.2.3.tgz) = 0d170a1da26836b8c9af3c3a06960cfc42f29b26
 SHA512 (phpldapadmin-1.2.3.tgz) = 58a57ca577586685ebd0d7fde7e299b8945d1693018c7803e19239b79f4b9d72a4d207d53c9f284268e32398108038efafcdb434e634619bfe87db3524d267b6
 Size (phpldapadmin-1.2.3.tgz) = 1115707 bytes
+SHA1 (patch-config_config.php.example) = c6cdc8e62ec8c06ae99f219f1a20694502d6fe0d
+SHA1 (patch-htdocs_index.php) = 4788ea606b6aa0cc93bb319c8d6b180ccf3010e6
+SHA1 (patch-lib_PageRender.php) = 198e637024c01b164017a15b5449782ce8829996
+SHA1 (patch-lib_QueryRender.php) = 806e3d2f874aca0ff8c0c07d4f4db57a2008185c
+SHA1 (patch-lib_TemplateRender.php) = 766981b0a31221d2580e7f592140dd95601caf40
 SHA1 (patch-lib_ds__ldap.php) = 55563684fba16c1fbebbfa88ff1ce506f6c947fc
-SHA1 (patch-lib_functions.php) = 3d83f5fe56ba9d908ef6b55028483b0fc7764b29
+SHA1 (patch-lib_ds__ldap__pla.php) = 5331d8410ace331a5924f96e3f90a991866b9345
+SHA1 (patch-lib_functions.php) = 06be1a704070e5466278dfc3003f5c015fcc93c9
diff -r 1a52f76511a8 -r cb5caab674b9 databases/phpldapadmin/patches/patch-config_config.php.example
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/databases/phpldapadmin/patches/patch-config_config.php.example    Sun Feb 21 22:22:22 2021 +0000
@@ -0,0 +1,24 @@
+$NetBSD: patch-config_config.php.example,v 1.1 2021/02/21 22:22:22 khorben Exp $
+
+Fix for PHP >= 5.5
+
+--- config/config.php.example.orig     2012-10-01 06:54:14.000000000 +0000
++++ config/config.php.example
+@@ -379,7 +379,7 @@ $servers->setValue('server','name','My L
+ 
+ /* 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','pla_password_hash','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_rege
+ $servers->setValue('sasl','authz_id_replacement','$1');
+ $servers->setValue('sasl','props',null);
+ 
+-$servers->setValue('appearance','password_hash','md5');
++$servers->setValue('appearance','pla_password_hash','md5');
+ $servers->setValue('login','attr','dn');
+ $servers->setValue('login','fallback_dn',false);
+ $servers->setValue('login','class',null);
diff -r 1a52f76511a8 -r cb5caab674b9 databases/phpldapadmin/patches/patch-htdocs_index.php
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/databases/phpldapadmin/patches/patch-htdocs_index.php     Sun Feb 21 22:22:22 2021 +0000
@@ -0,0 +1,18 @@
+$NetBSD: patch-htdocs_index.php,v 1.1 2021/02/21 22:22:22 khorben Exp $
+
+Bail out if the configuration file is missing
+
+--- htdocs/index.php.orig      2012-10-01 06:54:14.000000000 +0000
++++ htdocs/index.php
+@@ -57,6 +57,11 @@ if (defined('CONFDIR'))
+ else
+       $app['config_file'] = 'config.php';
+ 
++if (! is_readable($app['config_file'])) {
++      if (ob_get_level()) ob_end_clean();
++      die(sprintf("Missing configuration file <b>%s</b> - have you created it?",$app['config_file']));
++}
++
+ # Make sure this PHP install has session support
+ if (! extension_loaded('session'))
+       error('<p>Your install of PHP appears to be missing php-session support.</p><p>Please install php-session support before using phpLDAPadmin.<br /><small>(Dont forget to restart your web 
server afterwards)</small></p>','error',null,true);
diff -r 1a52f76511a8 -r cb5caab674b9 databases/phpldapadmin/patches/patch-lib_PageRender.php
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/databases/phpldapadmin/patches/patch-lib_PageRender.php   Sun Feb 21 22:22:22 2021 +0000
@@ -0,0 +1,33 @@
+$NetBSD: patch-lib_PageRender.php,v 1.1 2021/02/21 22:22:22 khorben Exp $
+
+Fix for PHP >= 5.5
+
+--- lib/PageRender.php.orig    2012-10-01 06:54:14.000000000 +0000
++++ lib/PageRender.php
+@@ -287,7 +287,7 @@ class PageRender extends Visitor {
+                                               break;
+ 
+                                       default:
+-                                              $vals[$i] = password_hash($passwordvalue,$enc);
++                                              $vals[$i] = pla_password_hash($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','pla_password_hash');
+ 
+               $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','pla_password_hash');
+ 
+               echo '<table cellspacing="0" cellpadding="0"><tr><td valign="top">';
+ 
diff -r 1a52f76511a8 -r cb5caab674b9 databases/phpldapadmin/patches/patch-lib_QueryRender.php
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/databases/phpldapadmin/patches/patch-lib_QueryRender.php  Sun Feb 21 22:22:22 2021 +0000
@@ -0,0 +1,15 @@
+$NetBSD: patch-lib_QueryRender.php,v 1.4 2021/02/21 22:22:22 khorben Exp $
+
+Fix for PHP >= 7.3
+
+--- lib/QueryRender.php.orig   2012-10-01 06:54:14.000000000 +0000
++++ lib/QueryRender.php
+@@ -321,7 +321,7 @@ class QueryRender extends PageRender {
+                                       if (! $results) {
+                                               echo _('Search returned no results');
+ 
+-                                              continue;
++                                              continue 2;
+                                       }
+ 
+                                       printf('<form action="cmd.php" method="post" id="massform_%s">',$counter);
diff -r 1a52f76511a8 -r cb5caab674b9 databases/phpldapadmin/patches/patch-lib_TemplateRender.php
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/databases/phpldapadmin/patches/patch-lib_TemplateRender.php       Sun Feb 21 22:22:22 2021 +0000
@@ -0,0 +1,15 @@
+$NetBSD: patch-lib_TemplateRender.php,v 1.1 2021/02/21 22:22:22 khorben Exp $
+
+Fix for PHP >= 5.5
+
+--- lib/TemplateRender.php.orig        2012-10-01 06:54:14.000000000 +0000
++++ lib/TemplateRender.php
+@@ -2466,7 +2466,7 @@ function deleteAttribute(attrName,friend
+               if ($val = $attribute->getValue($i))
+                       $default = get_enc_type($val);
+               else
+-                      $default = $this->getServer()->getValue('appearance','password_hash');
++                      $default = $this->getServer()->getValue('appearance','pla_password_hash');
+ 
+               if (! $attribute->getPostValue())
+                       printf('<input type="hidden" name="post_value[%s][]" value="%s" />',$attribute->getName(),$i);
diff -r 1a52f76511a8 -r cb5caab674b9 databases/phpldapadmin/patches/patch-lib_ds__ldap__pla.php
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/databases/phpldapadmin/patches/patch-lib_ds__ldap__pla.php        Sun Feb 21 22:22:22 2021 +0000
@@ -0,0 +1,15 @@
+$NetBSD: patch-lib_ds__ldap__pla.php,v 1.1 2021/02/21 22:22:22 khorben Exp $
+
+Fix for PHP >= 5.5
+
+--- lib/ds_ldap_pla.php.orig   2012-10-01 06:54:14.000000000 +0000
++++ lib/ds_ldap_pla.php
+@@ -16,7 +16,7 @@ class ldap_pla extends ldap {
+       function __construct($index) {
+               parent::__construct($index);
+ 
+-              $this->default->appearance['password_hash'] = array(
++              $this->default->appearance['pla_password_hash'] = array(
+                       'desc'=>'Default HASH to use for passwords',
+                       'default'=>'md5');
+ 
diff -r 1a52f76511a8 -r cb5caab674b9 databases/phpldapadmin/patches/patch-lib_functions.php
--- a/databases/phpldapadmin/patches/patch-lib_functions.php    Sun Feb 21 18:59:32 2021 +0000
+++ b/databases/phpldapadmin/patches/patch-lib_functions.php    Sun Feb 21 22:22:22 2021 +0000
@@ -1,11 +1,65 @@
-$NetBSD: patch-lib_functions.php,v 1.3 2015/11/29 11:25:53 taca Exp $
+$NetBSD: patch-lib_functions.php,v 1.4 2021/02/21 22:22:22 khorben Exp $
 
 Fix for PHP 5.5 and later: 
        https://bugzilla.redhat.com/show_bug.cgi?id=974928
 
 --- lib/functions.php.orig     2012-10-01 06:54:14.000000000 +0000
 +++ lib/functions.php
-@@ -2127,7 +2127,7 @@ function password_types() {
+@@ -51,7 +51,7 @@ if (file_exists(LIBDIR.'functions.custom
+ /**
+  * Loads class definition
+  */
+-function __autoload($className) {
++function pla_autoload($className) {
+       if (file_exists(HOOKSDIR."classes/$className.php"))
+               require_once(HOOKSDIR."classes/$className.php");
+       elseif (file_exists(LIBDIR."$className.php"))
+@@ -66,6 +66,12 @@ function __autoload($className) {
+                       'type'=>'error'));
+ }
+ 
++if (version_compare(phpversion(), '7.0', '>=')) {
++      spl_autoload_register('pla_autoload');
++} else {
++      eval('function __autoload($className) {pla_autoload($className);}');
++}
++
+ /**
+  * Strips all slashes from the specified array in place (pass by ref).
+  * @param Array The array to strip slashes from, typically one of
+@@ -994,6 +1000,22 @@ function get_custom_file($index,$filenam
+ }
+ 
+ /**
++ * Replacement for create_function() which is deprecated as of PHP 7.2
++ *
++ * @param string The function arguments
++ * @param string The function code
++ */
++function pla_create_function($args, $code) {
++      if (version_compare(phpversion(), '7.0', '>=')) {
++              # anonymous functions were introduced in PHP 5.3.0
++              return eval("return function(".$args."){".$code."};");
++      } else {
++              # create_function is deprecated in PHP 7.2
++              return create_function($args, $code);
++      }
++}
++
++/**
+  * Sort a multi dimensional array.
+  *
+  * @param array Multi demension array passed by reference
+@@ -1080,7 +1102,7 @@ function masort(&$data,$sortby,$rev=0) {
+ 
+               $code .= 'return $c;';
+ 
+-              $CACHE[$sortby] = create_function('$a, $b',$code);
++              $CACHE[$sortby] = pla_create_function('$a, $b',$code);
+       }
+ 
+       uasort($data,$CACHE[$sortby]);
+@@ -2127,7 +2149,7 @@ function password_types() {
   *        crypt, ext_des, md5crypt, blowfish, md5, sha, smd5, ssha, sha512, or clear.
   * @return string The hashed password.
   */
@@ -14,7 +68,7 @@
        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
+@@ -2318,7 +2340,7 @@ function password_check($cryptedpassword
  
                # SHA crypted passwords
                case 'sha':
@@ -23,7 +77,7 @@
                                return true;
                        else
                                return false;
-@@ -2327,7 +2327,7 @@ function password_check($cryptedpassword
+@@ -2327,7 +2349,7 @@ function password_check($cryptedpassword
  
                # MD5 crypted passwords
                case 'md5':
@@ -32,7 +86,16 @@
                                return true;
                        else
                                return false;
-@@ -2565,12 +2565,14 @@ function dn_unescape($dn) {
+@@ -2392,7 +2414,7 @@ function password_check($cryptedpassword
+ 
+               # SHA512 crypted passwords
+               case 'sha512':
+-                      if (strcasecmp(password_hash($plainpassword,'sha512'),'{SHA512}'.$cryptedpassword) == 0)
++                      if (strcasecmp(pla_password_hash($plainpassword,'sha512'),'{SHA512}'.$cryptedpassword) == 0)
+                               return true;
+                       else
+                               return false;
+@@ -2565,12 +2587,14 @@ function dn_unescape($dn) {
                $a = array();
  
                foreach ($dn as $key => $rdn)



Home | Main Index | Thread Index | Old Index