summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2020-01-05 17:30:37 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2020-04-25 00:04:40 +0200
commit09bb25b913728f09ef5515de880a7914988f56cb (patch)
tree9cb020e57eb0fd974b44cead268988f8af9d4629
parent7e50b8651e0484fed2aa929d30dc7e27b4dc1121 (diff)
downloadNUR-09bb25b913728f09ef5515de880a7914988f56cb.tar.gz
NUR-09bb25b913728f09ef5515de880a7914988f56cb.tar.zst
NUR-09bb25b913728f09ef5515de880a7914988f56cb.zip
Upgrade phpLDAPAdmin to a fork
-rw-r--r--pkgs/webapps/phpldapadmin/default.nix19
-rw-r--r--pkgs/webapps/phpldapadmin/ldap-disable-mcrypt.patch36
-rw-r--r--pkgs/webapps/phpldapadmin/ldap-fix-password.patch13
-rw-r--r--pkgs/webapps/phpldapadmin/ldap-php5_5.patch88
-rw-r--r--pkgs/webapps/phpldapadmin/ldap-php7_2.patch30
5 files changed, 24 insertions, 162 deletions
diff --git a/pkgs/webapps/phpldapadmin/default.nix b/pkgs/webapps/phpldapadmin/default.nix
index 70fd19af..da32f978 100644
--- a/pkgs/webapps/phpldapadmin/default.nix
+++ b/pkgs/webapps/phpldapadmin/default.nix
@@ -1,17 +1,20 @@
1{ config ? "/etc/phpldapadmin/config.php", fetchurl, stdenv, optipng }: 1{ config ? "/etc/phpldapadmin/config.php", fetchurl, fetchFromGitHub, stdenv, optipng }:
2stdenv.mkDerivation rec { 2stdenv.mkDerivation rec {
3 version = "1.2.3"; 3 version = "1.2.5";
4 name = "phpldapadmin-${version}"; 4 name = "phpldapadmin-${version}";
5 src = fetchurl { 5 src = fetchFromGitHub {
6 url = "https://downloads.sourceforge.net/project/phpldapadmin/phpldapadmin-php5/${version}/${name}.tgz"; 6 owner = "leenooks";
7 sha256 = "0n7dhp2a7n1krmnik3pb969jynsmhghmxviivnckifkprv1zijmf"; 7 repo = "phpLDAPadmin";
8 rev = "8f4ced96f9c63a09510a5bccb2189a8b92fb29ba";
9 sha256 = "1x6xc3xbvw3aj46i5ds06a8h6mfljxdv3argxrzz02l541ra6ni7";
8 }; 10 };
9 patches = [ 11 patches = [
10 ./ldap-php5_5.patch 12 #./ldap-php5_5.patch
11 ./ldap-disable-mcrypt.patch 13 #./ldap-disable-mcrypt.patch
12 ./ldap-php7_2.patch 14 #./ldap-php7_2.patch
13 ./ldap-sort-in-templates.patch 15 ./ldap-sort-in-templates.patch
14 ./ldap-align-button.patch 16 ./ldap-align-button.patch
17 ./ldap-fix-password.patch
15 ]; 18 ];
16 buildInputs = [ optipng ]; 19 buildInputs = [ optipng ];
17 buildPhase = '' 20 buildPhase = ''
diff --git a/pkgs/webapps/phpldapadmin/ldap-disable-mcrypt.patch b/pkgs/webapps/phpldapadmin/ldap-disable-mcrypt.patch
deleted file mode 100644
index 8bc4e7b5..00000000
--- a/pkgs/webapps/phpldapadmin/ldap-disable-mcrypt.patch
+++ /dev/null
@@ -1,36 +0,0 @@
1diff -wbBur phpldapadmin-1.2.3/lib/functions.php phpldapadmin-1.2.3.my/lib/functions.php
2--- phpldapadmin-1.2.3/lib/functions.php 2012-10-01 10:54:14.000000000 +0400
3+++ phpldapadmin-1.2.3.my/lib/functions.php 2017-02-02 20:02:14.424245233 +0300
4@@ -745,6 +745,7 @@
5 if (! trim($secret))
6 return $data;
7
8+/*
9 if (function_exists('mcrypt_module_open') && ! empty($data)) {
10 $td = mcrypt_module_open(MCRYPT_BLOWFISH,'',MCRYPT_MODE_ECB,'');
11 $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td),MCRYPT_DEV_URANDOM);
12@@ -754,7 +755,7 @@
13
14 return $encrypted_data;
15 }
16-
17+*/
18 if (file_exists(LIBDIR.'blowfish.php'))
19 require_once LIBDIR.'blowfish.php';
20 else
21@@ -801,6 +802,7 @@
22 if (! trim($secret))
23 return $encdata;
24
25+/*
26 if (function_exists('mcrypt_module_open') && ! empty($encdata)) {
27 $td = mcrypt_module_open(MCRYPT_BLOWFISH,'',MCRYPT_MODE_ECB,'');
28 $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td),MCRYPT_DEV_URANDOM);
29@@ -810,6 +812,7 @@
30
31 return $decrypted_data;
32 }
33+*/
34
35 if (file_exists(LIBDIR.'blowfish.php'))
36 require_once LIBDIR.'blowfish.php';
diff --git a/pkgs/webapps/phpldapadmin/ldap-fix-password.patch b/pkgs/webapps/phpldapadmin/ldap-fix-password.patch
new file mode 100644
index 00000000..d2d80e48
--- /dev/null
+++ b/pkgs/webapps/phpldapadmin/ldap-fix-password.patch
@@ -0,0 +1,13 @@
1diff --git a/htdocs/login.php b/htdocs/login.php
2index 48f9e2e..298b07d 100644
3--- a/htdocs/login.php
4+++ b/htdocs/login.php
5@@ -13,7 +13,7 @@ require './common.php';
6
7 $user = array();
8 $user['login'] = get_request('login');
9-$user['password'] = get_request('login_pass');
10+$user['password'] = get_request('login_pass','POST',false,null,false);
11
12 if ($user['login'] && ! strlen($user['password']))
13 system_message(array(
diff --git a/pkgs/webapps/phpldapadmin/ldap-php5_5.patch b/pkgs/webapps/phpldapadmin/ldap-php5_5.patch
deleted file mode 100644
index 8545ad27..00000000
--- a/pkgs/webapps/phpldapadmin/ldap-php5_5.patch
+++ /dev/null
@@ -1,88 +0,0 @@
1diff -Nrbu phpldapadmin-1.2.3/lib/PageRender.php phpldapadmin-1.2.3-OK/lib/PageRender.php
2--- phpldapadmin-1.2.3/lib/PageRender.php 2012-10-01 10:54:14.000000000 +0400
3+++ phpldapadmin-1.2.3-OK/lib/PageRender.php 2013-11-12 03:44:40.518144839 +0400
4@@ -287,7 +287,7 @@
5 break;
6
7 default:
8- $vals[$i] = password_hash($passwordvalue,$enc);
9+ $vals[$i] = pla_password_hash($passwordvalue,$enc);
10 }
11
12 $vals = array_unique($vals);
13diff -Nrbu phpldapadmin-1.2.3/lib/ds_ldap.php phpldapadmin-1.2.3-OK/lib/ds_ldap.php
14--- phpldapadmin-1.2.3/lib/ds_ldap.php 2012-10-01 10:54:14.000000000 +0400
15+++ phpldapadmin-1.2.3-OK/lib/ds_ldap.php 2013-11-12 03:40:56.638343739 +0400
16@@ -1117,12 +1117,14 @@
17 if (is_array($dn)) {
18 $a = array();
19 foreach ($dn as $key => $rdn)
20- $a[$key] = preg_replace('/\\\([0-9A-Fa-f]{2})/e',"''.chr(hexdec('\\1')).''",$rdn);
21+ $a[$key] = preg_replace_callback('/\\\([0-9A-Fa-f]{2})/',
22+ function ($matches) { return chr(hexdec($matches[1])); }, $rdn);
23
24 return $a;
25
26 } else
27- return preg_replace('/\\\([0-9A-Fa-f]{2})/e',"''.chr(hexdec('\\1')).''",$dn);
28+ return preg_replace_callback('/\\\([0-9A-Fa-f]{2})/',
29+ function ($matches) { return chr(hexdec($matches[1])); }, $dn);
30 }
31
32 public function getRootDSE($method=null) {
33diff -Nrbu phpldapadmin-1.2.3/lib/functions.php phpldapadmin-1.2.3-OK/lib/functions.php
34--- phpldapadmin-1.2.3/lib/functions.php 2012-10-01 10:54:14.000000000 +0400
35+++ phpldapadmin-1.2.3-OK/lib/functions.php 2013-11-12 03:44:17.298065264 +0400
36@@ -2127,7 +2127,7 @@
37 * crypt, ext_des, md5crypt, blowfish, md5, sha, smd5, ssha, sha512, or clear.
38 * @return string The hashed password.
39 */
40-function password_hash($password_clear,$enc_type) {
41+function pla_password_hash($password_clear,$enc_type) {
42 if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
43 debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
44
45@@ -2318,7 +2318,7 @@
46
47 # SHA crypted passwords
48 case 'sha':
49- if (strcasecmp(password_hash($plainpassword,'sha'),'{SHA}'.$cryptedpassword) == 0)
50+ if (strcasecmp(pla_password_hash($plainpassword,'sha'),'{SHA}'.$cryptedpassword) == 0)
51 return true;
52 else
53 return false;
54@@ -2327,7 +2327,7 @@
55
56 # MD5 crypted passwords
57 case 'md5':
58- if( strcasecmp(password_hash($plainpassword,'md5'),'{MD5}'.$cryptedpassword) == 0)
59+ if( strcasecmp(pla_password_hash($plainpassword,'md5'),'{MD5}'.$cryptedpassword) == 0)
60 return true;
61 else
62 return false;
63@@ -2392,7 +2392,7 @@
64
65 # SHA512 crypted passwords
66 case 'sha512':
67- if (strcasecmp(password_hash($plainpassword,'sha512'),'{SHA512}'.$cryptedpassword) == 0)
68+ if (strcasecmp(pla_password_hash($plainpassword,'sha512'),'{SHA512}'.$cryptedpassword) == 0)
69 return true;
70 else
71 return false;
72@@ -2565,12 +2565,14 @@
73 $a = array();
74
75 foreach ($dn as $key => $rdn)
76- $a[$key] = preg_replace('/\\\([0-9A-Fa-f]{2})/e',"''.chr(hexdec('\\1')).''",$rdn);
77+ $a[$key] = preg_replace_callback('/\\\([0-9A-Fa-f]{2})/',
78+ function ($matches) { return chr(hexdec($matches[1])); }, $rdn );
79
80 return $a;
81
82 } else {
83- return preg_replace('/\\\([0-9A-Fa-f]{2})/e',"''.chr(hexdec('\\1')).''",$dn);
84+ return preg_replace_callback('/\\\([0-9A-Fa-f]{2})/',
85+ function ($matches) { return chr(hexdec($matches[1])); }, $dn);
86 }
87 }
88
diff --git a/pkgs/webapps/phpldapadmin/ldap-php7_2.patch b/pkgs/webapps/phpldapadmin/ldap-php7_2.patch
deleted file mode 100644
index 40ee0555..00000000
--- a/pkgs/webapps/phpldapadmin/ldap-php7_2.patch
+++ /dev/null
@@ -1,30 +0,0 @@
1diff -wbBur phpldapadmin.org/lib/functions.php phpldapadmin/lib/functions.php
2--- phpldapadmin.org/lib/functions.php 2017-02-02 10:03:58.000000000 -0700
3+++ phpldapadmin/lib/functions.php 2018-01-23 06:18:31.118312887 -0700
4@@ -51,7 +51,7 @@
5 /**
6 * Loads class definition
7 */
8-function __autoload($className) {
9+spl_autoload_register(function($className) {
10 if (file_exists(HOOKSDIR."classes/$className.php"))
11 require_once(HOOKSDIR."classes/$className.php");
12 elseif (file_exists(LIBDIR."$className.php"))
13@@ -64,7 +64,7 @@
14 'body'=>sprintf('%s: %s [%s]',
15 __METHOD__,_('Called to load a class that cant be found'),$className),
16 'type'=>'error'));
17-}
18+});
19
20 /**
21 * Strips all slashes from the specified array in place (pass by ref).
22@@ -1083,7 +1083,7 @@
23
24 $code .= 'return $c;';
25
26- $CACHE[$sortby] = create_function('$a, $b',$code);
27+ eval("\$CACHE[\$sortby] = function(\$a, \$b) { $code; };");
28 }
29
30 uasort($data,$CACHE[$sortby]);