packages: roundcubemail/roundcubemail-password-anon-ldap-bind.patch (NEW) -...
pawelz
pawelz at pld-linux.org
Sun May 16 13:09:49 CEST 2010
Author: pawelz Date: Sun May 16 11:09:49 2010 GMT
Module: packages Tag: HEAD
---- Log message:
- works for me, but still needs some work
---- Files affected:
packages/roundcubemail:
roundcubemail-password-anon-ldap-bind.patch (NONE -> 1.1) (NEW)
---- Diffs:
================================================================
Index: packages/roundcubemail/roundcubemail-password-anon-ldap-bind.patch
diff -u /dev/null packages/roundcubemail/roundcubemail-password-anon-ldap-bind.patch:1.1
--- /dev/null Sun May 16 13:09:49 2010
+++ packages/roundcubemail/roundcubemail-password-anon-ldap-bind.patch Sun May 16 13:09:44 2010
@@ -0,0 +1,74 @@
+--- roundcubemail-0.3.1/plugins/password/config.inc.php.dist~ 2009-10-09 18:04:01.000000000 +0200
++++ roundcubemail-0.3.1/plugins/password/config.inc.php.dist 2010-05-16 13:06:35.000000000 +0200
+@@ -95,9 +95,11 @@
+ $rcmail_config['password_ldap_basedn'] = 'dc=exemple,dc=com';
+
+ // LDAP connection method
+-// There is two connection method for changing a user's LDAP password.
++// There are three connection methods for changing a user's LDAP password.
+ // 'user': use user credential (recommanded, require password_confirm_current=true)
+ // 'admin': use admin credential (this mode require password_ldap_adminDN and password_ldap_adminPW)
++// 'anonymous': bind anonymously, then search for dn with given uid, and
++// rebind using found dn
+ // Default: 'user'
+ $rcmail_config['password_ldap_method'] = 'user';
+
+--- roundcubemail-0.3.1/plugins/password/drivers/ldap.php.orig 2010-05-16 12:57:28.000000000 +0200
++++ roundcubemail-0.3.1/plugins/password/drivers/ldap.php 2010-05-16 13:02:42.000000000 +0200
+@@ -30,25 +30,44 @@
+ }
+
+ if (empty($userDN)) {return PASSWORD_CONNECT_ERROR;}
+-
+- // Connection Method
+- switch($rcmail->config->get('password_ldap_method')) {
+- case 'user': $binddn = $userDN; $bindpw = $curpass; break;
+- case 'admin': $binddn = $rcmail->config->get('password_ldap_adminDN'); $bindpw = $rcmail->config->get('password_ldap_adminPW'); break;
+- default: $binddn = $userDN; $bindpw = $curpass; break; // default is user mode
+- }
+-
+- // Configuration array
++
++ $basedn = $rcmail->config->get('password_ldap_basedn');
++ // Configuration array
+ $ldapConfig = array (
+- 'binddn' => $binddn,
+- 'bindpw' => $bindpw,
+- 'basedn' => $rcmail->config->get('password_ldap_basedn'),
++ 'binddn' => '',
++ 'bindpw' => '',
++ 'basedn' => $basedn,
+ 'host' => $rcmail->config->get('password_ldap_host'),
+ 'port' => $rcmail->config->get('password_ldap_port'),
+ 'starttls' => $rcmail->config->get('password_ldap_starttls'),
+ 'version' => $rcmail->config->get('password_ldap_version'),
+ );
++
+
++ // Connection Method
++ switch($rcmail->config->get('password_ldap_method')) {
++ case 'anonymous' :
++ //if anonymous is set, we anonymously bind to ldap
++ //then, we search for the dn of the first entry
++ //that matches our mask.
++ $ldap = Net_LDAP2::connect($ldapConfig);
++ if (PEAR::isError($ldap)) {return PASSWORD_CONNECT_ERROR;}
++ $r = $ldap->search($basedn,'uid='.$_SESSION['username']);
++ $entries = $r->entries();
++ if (count($entries) <= 0) {return PASSWORD_CONNECT_ERROR;}
++ $binddn = $entries[0]->dn();
++ $userDN = $binddn;
++ $bindpass = $curpass;
++ $ldap->done();
++ break;
++ case 'user': $binddn = $userDN; $bindpass = $curpass; break;
++ case 'admin': $binddn = $rcmail->config->get('password_ldap_adminDN'); $bindpass = $rcmail->config->get('password_ldap_adminPW'); break;
++ default: $binddn = $userDN; $bindpass = $curpass; break; // default is user mode
++ }
++
++ $ldapConfig['binddn'] = $binddn;
++ $ldapConfig['bindpw'] = $bindpass;
++
+ // Connecting using the configuration array
+ $ldap = Net_LDAP2::connect($ldapConfig);
+
================================================================
More information about the pld-cvs-commit
mailing list