aboutsummaryrefslogtreecommitdiff
path: root/pkgs
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2019-05-06 00:40:09 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2019-05-06 00:40:09 +0200
commitf5efae0f8c4c53798f8f9fc88c5f92f38a223320 (patch)
tree804bfea19e8b3ef112a64cf358983bc1817a9eea /pkgs
parent3a1461cf44102e6cd8cdee5e0f1ff1d7992894ad (diff)
downloadNix-f5efae0f8c4c53798f8f9fc88c5f92f38a223320.tar.gz
Nix-f5efae0f8c4c53798f8f9fc88c5f92f38a223320.tar.zst
Nix-f5efae0f8c4c53798f8f9fc88c5f92f38a223320.zip
Move phpldapadmin to pkgs
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/webapps/default.nix6
-rw-r--r--pkgs/webapps/phpldapadmin/default.nix24
-rw-r--r--pkgs/webapps/phpldapadmin/ldap-align-button.patch11
-rw-r--r--pkgs/webapps/phpldapadmin/ldap-disable-mcrypt.patch36
-rw-r--r--pkgs/webapps/phpldapadmin/ldap-php5_5.patch88
-rw-r--r--pkgs/webapps/phpldapadmin/ldap-php7_2.patch30
-rw-r--r--pkgs/webapps/phpldapadmin/ldap-sort-in-templates.patch12
7 files changed, 207 insertions, 0 deletions
diff --git a/pkgs/webapps/default.nix b/pkgs/webapps/default.nix
index da38f5f..7e04e8d 100644
--- a/pkgs/webapps/default.nix
+++ b/pkgs/webapps/default.nix
@@ -1,10 +1,14 @@
1{ callPackage, mylibs, lib }: 1{ callPackage, mylibs, lib }:
2rec { 2rec {
3 diaspora = callPackage ./diaspora { inherit mylibs; }; 3 diaspora = callPackage ./diaspora { inherit mylibs; };
4
4 mastodon = callPackage ./mastodon { inherit mylibs; }; 5 mastodon = callPackage ./mastodon { inherit mylibs; };
6
5 awl = callPackage ./awl {}; 7 awl = callPackage ./awl {};
6 davical = callPackage ./davical {}; 8 davical = callPackage ./davical {};
9
7 infcloud = callPackage ./infcloud {}; 10 infcloud = callPackage ./infcloud {};
11
8 nextcloud = callPackage ./nextcloud {}; 12 nextcloud = callPackage ./nextcloud {};
9 nextcloud-apps = let 13 nextcloud-apps = let
10 names = [ 14 names = [
@@ -17,4 +21,6 @@ rec {
17 in 21 in
18 lib.attrsets.genAttrs names 22 lib.attrsets.genAttrs names
19 (name: callPackage (./nextcloud/apps + "/${name}.nix") { buildApp = nextcloud.buildApp; }); 23 (name: callPackage (./nextcloud/apps + "/${name}.nix") { buildApp = nextcloud.buildApp; });
24
25 phpldapadmin = callPackage ./phpldapadmin {};
20} 26}
diff --git a/pkgs/webapps/phpldapadmin/default.nix b/pkgs/webapps/phpldapadmin/default.nix
new file mode 100644
index 0000000..70fd19a
--- /dev/null
+++ b/pkgs/webapps/phpldapadmin/default.nix
@@ -0,0 +1,24 @@
1{ config ? "/etc/phpldapadmin/config.php", fetchurl, stdenv, optipng }:
2stdenv.mkDerivation rec {
3 version = "1.2.3";
4 name = "phpldapadmin-${version}";
5 src = fetchurl {
6 url = "https://downloads.sourceforge.net/project/phpldapadmin/phpldapadmin-php5/${version}/${name}.tgz";
7 sha256 = "0n7dhp2a7n1krmnik3pb969jynsmhghmxviivnckifkprv1zijmf";
8 };
9 patches = [
10 ./ldap-php5_5.patch
11 ./ldap-disable-mcrypt.patch
12 ./ldap-php7_2.patch
13 ./ldap-sort-in-templates.patch
14 ./ldap-align-button.patch
15 ];
16 buildInputs = [ optipng ];
17 buildPhase = ''
18 find -name '*.png' -exec optipng -quiet -force -fix {} \;
19 '';
20 installPhase = ''
21 cp -a . $out
22 ln -sf ${config} $out/config/config.php
23 '';
24}
diff --git a/pkgs/webapps/phpldapadmin/ldap-align-button.patch b/pkgs/webapps/phpldapadmin/ldap-align-button.patch
new file mode 100644
index 0000000..d9a5504
--- /dev/null
+++ b/pkgs/webapps/phpldapadmin/ldap-align-button.patch
@@ -0,0 +1,11 @@
1--- a/htdocs/update_confirm.php 2012-10-01 08:54:14.000000000 +0200
2+++ b/htdocs/update_confirm.php 2018-06-06 15:47:44.122398888 +0200
3@@ -187,7 +187,7 @@
4
5 echo '</table>';
6
7- echo '<div style="text-align: center;">';
8+ echo '<div style="text-align: left;">';
9 echo '<br />';
10 // @todo cant use AJAX here, it affects file uploads.
11 printf('<input type="submit" value="%s" />',
diff --git a/pkgs/webapps/phpldapadmin/ldap-disable-mcrypt.patch b/pkgs/webapps/phpldapadmin/ldap-disable-mcrypt.patch
new file mode 100644
index 0000000..8bc4e7b
--- /dev/null
+++ b/pkgs/webapps/phpldapadmin/ldap-disable-mcrypt.patch
@@ -0,0 +1,36 @@
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-php5_5.patch b/pkgs/webapps/phpldapadmin/ldap-php5_5.patch
new file mode 100644
index 0000000..8545ad2
--- /dev/null
+++ b/pkgs/webapps/phpldapadmin/ldap-php5_5.patch
@@ -0,0 +1,88 @@
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
new file mode 100644
index 0000000..40ee055
--- /dev/null
+++ b/pkgs/webapps/phpldapadmin/ldap-php7_2.patch
@@ -0,0 +1,30 @@
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]);
diff --git a/pkgs/webapps/phpldapadmin/ldap-sort-in-templates.patch b/pkgs/webapps/phpldapadmin/ldap-sort-in-templates.patch
new file mode 100644
index 0000000..55a1974
--- /dev/null
+++ b/pkgs/webapps/phpldapadmin/ldap-sort-in-templates.patch
@@ -0,0 +1,12 @@
1diff -wbBur phpldapadmin-1.2.3.org/lib/TemplateRender.php phpldapadmin-1.2.3/lib/TemplateRender.php
2--- phpldapadmin-1.2.3.org/lib/TemplateRender.php 2012-10-01 10:54:14.000000000 +0400
3+++ phpldapadmin-1.2.3/lib/TemplateRender.php 2018-02-02 19:06:45.674760057 +0300
4@@ -321,6 +321,8 @@
5
6 $vals = array();
7
8+ asort($picklistvalues);
9+
10 foreach ($picklistvalues as $key => $values) {
11 $display = $args[3];
12