commit:     7ee51d74a1a7d4014029d9fb3729de1e99da357c
Author:     Jorge Manuel B. S. Vicetto (jmbsvicetto) <jmbsvicetto <AT> gentoo 
<DOT> org>
AuthorDate: Thu Apr 10 19:46:50 2014 +0000
Commit:     Jorge Manuel B. S. Vicetto <jmbsvicetto <AT> gentoo <DOT> org>
CommitDate: Thu Apr 10 19:52:52 2014 +0000
URL:        
http://git.overlays.gentoo.org/gitweb/?p=dev/jmbsvicetto.git;a=commit;h=7ee51d74

Add a patch to allow phpldapadmin to build against php-5.5. Fixes bug 482340 - 
thanks to Alexander Stein.

---
 net-nds/phpldapadmin/Manifest                      |   3 +-
 .../files/phpldapadmin-fix-php5.5-support.patch    | 152 +++++++++++++++++++++
 net-nds/phpldapadmin/phpldapadmin-1.2.3-r1.ebuild  |  49 +++++++
 3 files changed, 203 insertions(+), 1 deletion(-)

diff --git a/net-nds/phpldapadmin/Manifest b/net-nds/phpldapadmin/Manifest
index 912f16a..1d714a5 100644
--- a/net-nds/phpldapadmin/Manifest
+++ b/net-nds/phpldapadmin/Manifest
@@ -1 +1,2 @@
-DIST phpldapadmin-1.2.2.tgz 1415565 SHA256 
8629ea3f14630d4dd74099c997ac9795240a6417d5d124517ba5860c12d8a239
+DIST phpldapadmin-1.2.2.tgz 1415565 SHA256 
8629ea3f14630d4dd74099c997ac9795240a6417d5d124517ba5860c12d8a239 SHA512 
262e177258fc0e107833eeee3df3352fa66f099baa2ebd30ff3c5aa42dbf95811c4a7c5effda423171a8ac3558f03aa100ab6f48818c9df1f3ab6bb1e1e17e99
 WHIRLPOOL 
9d71144996308ced445ae7c09849f5c3cc72a58123bc17d5fe1301a947bd13922e391ed198231fad5a54a2075af9fa8da9c2e7c4dbae28263a678260864e568e
+DIST phpldapadmin-1.2.3.tgz 1115707 SHA256 
aecaf8c3ce77ba3899dd31ee5ee183555b2f9349eb8e196dcd33d8a3c485ed58 SHA512 
58a57ca577586685ebd0d7fde7e299b8945d1693018c7803e19239b79f4b9d72a4d207d53c9f284268e32398108038efafcdb434e634619bfe87db3524d267b6
 WHIRLPOOL 
2d8cf7dc9e3b509ed6884efa280e554aa34703ca829f377304b99ded20ad144ff445cae3630e83dbfdcccc83799a85a3a2301903a4e298faf0884d3201ca0d21

diff --git a/net-nds/phpldapadmin/files/phpldapadmin-fix-php5.5-support.patch 
b/net-nds/phpldapadmin/files/phpldapadmin-fix-php5.5-support.patch
new file mode 100644
index 0000000..df6a7c1
--- /dev/null
+++ b/net-nds/phpldapadmin/files/phpldapadmin-fix-php5.5-support.patch
@@ -0,0 +1,152 @@
+commit 7e53dab990748c546b79f0610c3a7a58431e9ebc
+Author: Michael Laccetti <mich...@laccetti.com>
+Date:   Thu Aug 29 09:13:56 2013 -0400
+
+    Fixed two issues to get phpLdapAdmin to work under PHP 5.5.x
+    1) password_hash is an actual function, so renamed instances to 
password_hash_custom (HT: 
https://sourceforge.net/mailarchive/message.php?msg_id=31302386)
+    2) Fixed the preg_replace to preg_replace_callback to use the /e/ 
functionality in the officially endorsed fashion
+
+diff --git a/lib/PageRender.php b/lib/PageRender.php
+index 7d86a54..eed5d5f 100644
+--- a/lib/PageRender.php
++++ b/lib/PageRender.php
+@@ -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">';
+ 
+diff --git a/lib/ds_ldap.php b/lib/ds_ldap.php
+index c346660..7532539 100644
+--- a/lib/ds_ldap.php
++++ b/lib/ds_ldap.php
+@@ -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) {
+diff --git a/lib/ds_ldap_pla.php b/lib/ds_ldap_pla.php
+index 7ece393..6b0990e 100644
+--- a/lib/ds_ldap_pla.php
++++ b/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['password_hash_custom'] = array(
+                       'desc'=>'Default HASH to use for passwords',
+                       'default'=>'md5');
+ 
+diff --git a/lib/functions.php b/lib/functions.php
+index 56d8bf3..5ac3caf 100644
+--- a/lib/functions.php
++++ b/lib/functions.php
+@@ -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,$plainpassword,$attribute='userpassword
+ 
+               # 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,$plainpassword,$attribute='userpassword
+ 
+               # 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,$plainpassword,$attribute='userpassword
+ 
+               # 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
++              );
+       }
+ }
+ 

diff --git a/net-nds/phpldapadmin/phpldapadmin-1.2.3-r1.ebuild 
b/net-nds/phpldapadmin/phpldapadmin-1.2.3-r1.ebuild
new file mode 100644
index 0000000..970af1a
--- /dev/null
+++ b/net-nds/phpldapadmin/phpldapadmin-1.2.3-r1.ebuild
@@ -0,0 +1,49 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: 
/var/cvsroot/gentoo-x86/net-nds/phpldapadmin/phpldapadmin-1.2.3.ebuild,v 1.1 
2012/11/12 12:04:32 jmbsvicetto Exp $
+
+EAPI="2"
+
+inherit webapp depend.php
+
+DESCRIPTION="phpLDAPadmin is a web-based tool for managing all aspects of your 
LDAP server."
+HOMEPAGE="http://phpldapadmin.sourceforge.net";
+SRC_URI="mirror://sourceforge/${PN}/${P}.tgz"
+
+LICENSE="GPL-2"
+KEYWORDS="~alpha ~amd64 ~ia64 ~ppc ~sparc ~x86"
+IUSE=""
+
+RDEPEND="dev-lang/php[hash,ldap,session,xml,nls]
+                || ( <dev-lang/php-5.3[pcre] >=dev-lang/php-5.3 )"
+
+need_httpd_cgi
+need_php_httpd
+
+src_prepare() {
+       mv config/config.php.example config/config.php
+       epatch "${FILESDIR}/${PN}-1.2.1.1-fix-magic-quotes.patch"
+       # 
http://phpldapadmin.git.sourceforge.net/git/gitweb.cgi?p=phpldapadmin/phpldapadmin;a=commit;h=7dc8d57d6952fe681cb9e8818df7f103220457bd
+
+       epatch "${FILESDIR}/${PN}-fix-php5.5-support.patch"
+       # 
http://sourceforge.net/u/nihilisticz/phpldapadmin/ci/7e53dab990748c546b79f0610c3a7a58431e9ebc/
+       # This patch has been requested to be merged, but there's no recent 
activity by upstream
+}
+
+src_install() {
+       webapp_src_preinst
+
+       dodoc INSTALL
+
+       # Restrict config file access - bug 280836
+       chown root:apache "config/config.php"
+       chmod 640 "config/config.php"
+
+       insinto "${MY_HTDOCSDIR}"
+       doins -r *
+
+       webapp_configfile "${MY_HTDOCSDIR}/config/config.php"
+       webapp_postinst_txt en "${FILESDIR}"/postinstall2-en.txt
+
+       webapp_src_install
+}

Reply via email to