aboutsummaryrefslogtreecommitdiff
path: root/nixops
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 /nixops
parent3a1461cf44102e6cd8cdee5e0f1ff1d7992894ad (diff)
downloadNix-f5efae0f8c4c53798f8f9fc88c5f92f38a223320.tar.gz
Nix-f5efae0f8c4c53798f8f9fc88c5f92f38a223320.tar.zst
Nix-f5efae0f8c4c53798f8f9fc88c5f92f38a223320.zip
Move phpldapadmin to pkgs
Diffstat (limited to 'nixops')
-rw-r--r--nixops/modules/websites/tools/tools/default.nix1
-rw-r--r--nixops/modules/websites/tools/tools/ldap-align-button.patch11
-rw-r--r--nixops/modules/websites/tools/tools/ldap-disable-mcrypt.patch36
-rw-r--r--nixops/modules/websites/tools/tools/ldap-php5_5.patch88
-rw-r--r--nixops/modules/websites/tools/tools/ldap-php7_2.patch30
-rw-r--r--nixops/modules/websites/tools/tools/ldap-sort-in-templates.patch12
-rw-r--r--nixops/modules/websites/tools/tools/ldap.nix26
7 files changed, 3 insertions, 201 deletions
diff --git a/nixops/modules/websites/tools/tools/default.nix b/nixops/modules/websites/tools/tools/default.nix
index 827c563..e872224 100644
--- a/nixops/modules/websites/tools/tools/default.nix
+++ b/nixops/modules/websites/tools/tools/default.nix
@@ -33,6 +33,7 @@ let
33 inherit (mylibs) fetchedGithub; 33 inherit (mylibs) fetchedGithub;
34 }; 34 };
35 ldap = pkgs.callPackage ./ldap.nix { 35 ldap = pkgs.callPackage ./ldap.nix {
36 inherit (pkgs.webapps) phpldapadmin;
36 env = myconfig.env.tools.phpldapadmin; 37 env = myconfig.env.tools.phpldapadmin;
37 }; 38 };
38 39
diff --git a/nixops/modules/websites/tools/tools/ldap-align-button.patch b/nixops/modules/websites/tools/tools/ldap-align-button.patch
deleted file mode 100644
index d9a5504..0000000
--- a/nixops/modules/websites/tools/tools/ldap-align-button.patch
+++ /dev/null
@@ -1,11 +0,0 @@
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/nixops/modules/websites/tools/tools/ldap-disable-mcrypt.patch b/nixops/modules/websites/tools/tools/ldap-disable-mcrypt.patch
deleted file mode 100644
index 8bc4e7b..0000000
--- a/nixops/modules/websites/tools/tools/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/nixops/modules/websites/tools/tools/ldap-php5_5.patch b/nixops/modules/websites/tools/tools/ldap-php5_5.patch
deleted file mode 100644
index 8545ad2..0000000
--- a/nixops/modules/websites/tools/tools/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/nixops/modules/websites/tools/tools/ldap-php7_2.patch b/nixops/modules/websites/tools/tools/ldap-php7_2.patch
deleted file mode 100644
index 40ee055..0000000
--- a/nixops/modules/websites/tools/tools/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]);
diff --git a/nixops/modules/websites/tools/tools/ldap-sort-in-templates.patch b/nixops/modules/websites/tools/tools/ldap-sort-in-templates.patch
deleted file mode 100644
index 55a1974..0000000
--- a/nixops/modules/websites/tools/tools/ldap-sort-in-templates.patch
+++ /dev/null
@@ -1,12 +0,0 @@
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
diff --git a/nixops/modules/websites/tools/tools/ldap.nix b/nixops/modules/websites/tools/tools/ldap.nix
index 7c26b61..8ee39f6 100644
--- a/nixops/modules/websites/tools/tools/ldap.nix
+++ b/nixops/modules/websites/tools/tools/ldap.nix
@@ -1,4 +1,4 @@
1{ lib, php, env, writeText, stdenv, optipng, fetchurl }: 1{ lib, php, env, writeText, phpldapadmin }:
2rec { 2rec {
3 keys = [{ 3 keys = [{
4 dest = "webapps/tools-ldap"; 4 dest = "webapps/tools-ldap";
@@ -25,29 +25,7 @@ rec {
25 $servers->setValue('login','fallback_dn',true); 25 $servers->setValue('login','fallback_dn',true);
26 ''; 26 '';
27 }]; 27 }];
28 webRoot = stdenv.mkDerivation rec { 28 webRoot = phpldapadmin.override { config = "/var/secrets/webapps/tools-ldap"; };
29 version = "1.2.3";
30 name = "phpldapadmin-${version}";
31 src = fetchurl {
32 url = "https://downloads.sourceforge.net/project/phpldapadmin/phpldapadmin-php5/${version}/${name}.tgz";
33 sha256 = "0n7dhp2a7n1krmnik3pb969jynsmhghmxviivnckifkprv1zijmf";
34 };
35 patches = [
36 ./ldap-php5_5.patch
37 ./ldap-disable-mcrypt.patch
38 ./ldap-php7_2.patch
39 ./ldap-sort-in-templates.patch
40 ./ldap-align-button.patch
41 ];
42 buildInputs = [ optipng ];
43 buildPhase = ''
44 find -name '*.png' -exec optipng -quiet -force -fix {} \;
45 '';
46 installPhase = ''
47 cp -a . $out
48 ln -sf /var/secrets/webapps/tools-ldap $out/config/config.php
49 '';
50 };
51 apache = rec { 29 apache = rec {
52 user = "wwwrun"; 30 user = "wwwrun";
53 group = "wwwrun"; 31 group = "wwwrun";