[phpldapadmin/f19] add support for php >= 5.5

Dmitry Butskoy buc at fedoraproject.org
Tue Jun 18 12:11:47 UTC 2013


commit 0f48dd5562d04030520ebb9978fcdadf20494b9f
Author: Dmitry Butskoy <Dmitry at Butskoy.name>
Date:   Tue Jun 18 16:11:11 2013 +0400

    add support for php >= 5.5

 ...config.patch => phpldapadmin-1.2.3-config.patch |   14 ++--
 phpldapadmin-1.2.3-php5_5.patch                    |   67 ++++++++++++++++++++
 phpldapadmin.spec                                  |    9 ++-
 3 files changed, 81 insertions(+), 9 deletions(-)
---
diff --git a/phpldapadmin-1.2.1.1-config.patch b/phpldapadmin-1.2.3-config.patch
similarity index 82%
rename from phpldapadmin-1.2.1.1-config.patch
rename to phpldapadmin-1.2.3-config.patch
index b39a602..933f931 100644
--- a/phpldapadmin-1.2.1.1-config.patch
+++ b/phpldapadmin-1.2.3-config.patch
@@ -1,7 +1,7 @@
-diff -Nrbu phpldapadmin-1.2.1.1/config/config.php phpldapadmin-1.2.1.1-OK/config/config.php
---- phpldapadmin-1.2.1.1/config/config.php	2011-07-22 19:48:38.000000000 +0400
-+++ phpldapadmin-1.2.1.1-OK/config/config.php	2011-07-22 19:52:24.000000000 +0400
-@@ -76,6 +76,11 @@
+diff -Nrbu phpldapadmin-1.2.3/config/config.php phpldapadmin-1.2.3-OK/config/config.php
+--- phpldapadmin-1.2.3/config/config.php	2013-06-18 16:01:03.857955154 +0400
++++ phpldapadmin-1.2.3-OK/config/config.php	2013-06-18 16:00:46.813130919 +0400
+@@ -77,6 +77,11 @@
     30 seconds or the setting of max_exection_time if this is null. */
  // $config->custom->session['timelimit'] = 30;
  
@@ -13,7 +13,7 @@ diff -Nrbu phpldapadmin-1.2.1.1/config/config.php phpldapadmin-1.2.1.1-OK/config
  /* Our local timezone
     This is to make sure that when we ask the system for the current time, we
     get the right local time. If this is not set, all time() calculations will
-@@ -279,7 +284,7 @@
+@@ -283,7 +288,7 @@
  
  /* A convenient name that will appear in the tree viewer and throughout
     phpLDAPadmin to identify this LDAP server to users. */
@@ -22,7 +22,7 @@ diff -Nrbu phpldapadmin-1.2.1.1/config/config.php phpldapadmin-1.2.1.1-OK/config
  
  /* Examples:
     'ldap.example.com',
-@@ -373,6 +378,7 @@
+@@ -380,6 +385,7 @@
  /* 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');
@@ -30,7 +30,7 @@ diff -Nrbu phpldapadmin-1.2.1.1/config/config.php phpldapadmin-1.2.1.1-OK/config
  
  /* 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
-@@ -382,6 +388,7 @@
+@@ -389,6 +395,7 @@
     your LDAP server requires you to login to perform searches, you can enter the
     DN to use when searching in 'bind_id' and 'bind_pass' above. */
  // $servers->setValue('login','attr','dn');
diff --git a/phpldapadmin-1.2.3-php5_5.patch b/phpldapadmin-1.2.3-php5_5.patch
new file mode 100644
index 0000000..0457b57
--- /dev/null
+++ b/phpldapadmin-1.2.3-php5_5.patch
@@ -0,0 +1,67 @@
+diff -Nrbu phpldapadmin-1.2.3/lib/ds_ldap.php phpldapadmin-1.2.3-OK/lib/ds_ldap.php
+--- phpldapadmin-1.2.3/lib/ds_ldap.php	2012-10-01 10:54:14.000000000 +0400
++++ phpldapadmin-1.2.3-OK/lib/ds_ldap.php	2013-06-18 16:03:52.295235583 +0400
+@@ -1117,12 +1117,14 @@
+ 		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);
++				$a[$key] = preg_replace_callback('/\\\([0-9A-Fa-f]{2})/',
++					function ($matches) { return chr(hexdec($matches[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 ($matches) { return chr(hexdec($matches[1])); }, $dn);
+ 	}
+ 
+ 	public function getRootDSE($method=null) {
+diff -Nrbu phpldapadmin-1.2.3/lib/functions.php phpldapadmin-1.2.3-OK/lib/functions.php
+--- phpldapadmin-1.2.3/lib/functions.php	2012-10-01 10:54:14.000000000 +0400
++++ phpldapadmin-1.2.3-OK/lib/functions.php	2013-06-18 16:03:52.330235281 +0400
+@@ -2127,7 +2127,7 @@
+  *        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 pla_password_hash($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 @@
+ 
+ 		# SHA crypted passwords
+ 		case 'sha':
+-			if (strcasecmp(password_hash($plainpassword,'sha'),'{SHA}'.$cryptedpassword) == 0)
++			if (strcasecmp(pla_password_hash($plainpassword,'sha'),'{SHA}'.$cryptedpassword) == 0)
+ 				return true;
+ 			else
+ 				return false;
+@@ -2327,7 +2327,7 @@
+ 
+ 		# MD5 crypted passwords
+ 		case 'md5':
+-			if( strcasecmp(password_hash($plainpassword,'md5'),'{MD5}'.$cryptedpassword) == 0)
++			if( strcasecmp(pla_password_hash($plainpassword,'md5'),'{MD5}'.$cryptedpassword) == 0)
+ 				return true;
+ 			else
+ 				return false;
+@@ -2565,12 +2565,14 @@
+ 		$a = array();
+ 
+ 		foreach ($dn as $key => $rdn)
+-			$a[$key] = preg_replace('/\\\([0-9A-Fa-f]{2})/e',"''.chr(hexdec('\\1')).''",$rdn);
++			$a[$key] = preg_replace_callback('/\\\([0-9A-Fa-f]{2})/', 
++				function ($matches) { return chr(hexdec($matches[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 ($matches) { return chr(hexdec($matches[1])); }, $dn);
+ 	}
+ }
+ 
diff --git a/phpldapadmin.spec b/phpldapadmin.spec
index 6224c17..eafc23a 100644
--- a/phpldapadmin.spec
+++ b/phpldapadmin.spec
@@ -2,14 +2,15 @@
 Name: phpldapadmin
 Summary: Web-based tool for managing LDAP servers
 Version: 1.2.3
-Release: 2%{?dist}
+Release: 3%{?dist}
 Group: Applications/Internet
 License: GPLv2+
 URL: http://phpldapadmin.sourceforge.net
 
 Source: http://dl.sourceforge.net/sourceforge/phpldapadmin/phpldapadmin-%{version}.tgz
 
-Patch0: phpldapadmin-1.2.1.1-config.patch
+Patch0: phpldapadmin-1.2.3-config.patch
+Patch1: phpldapadmin-1.2.3-php5_5.patch
 
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildArch: noarch
@@ -40,6 +41,7 @@ access by remote web-clients.
 cp config/config.php.example config/config.php
 
 %patch0 -p1
+%patch1 -p1
 
 
 %build
@@ -125,6 +127,9 @@ fi
 
 
 %changelog
+* Tue Jun 18 2013 Dmitry Butskoy <Dmitry at Butskoy.name> - 1.2.3-3
+- Add compatibility patch for php >= 5.5
+
 * Thu Feb 14 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.2.3-2
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
 


More information about the scm-commits mailing list