[Svn] r2869 - in trunk/roundcubemail/plugins/password: . drivers

trac at roundcube.net trac at roundcube.net
Mon Aug 24 21:18:47 CEST 2009


Author: alec
Date: 2009-08-24 14:18:47 -0500 (Mon, 24 Aug 2009)
New Revision: 2869

Modified:
   trunk/roundcubemail/plugins/password/config.inc.php.dist
   trunk/roundcubemail/plugins/password/drivers/ldap.php
Log:
- Password/LDAP: support %name, %domain in userdn (#1486055)


Modified: trunk/roundcubemail/plugins/password/config.inc.php.dist
===================================================================
--- trunk/roundcubemail/plugins/password/config.inc.php.dist	2009-08-24 19:07:27 UTC (rev 2868)
+++ trunk/roundcubemail/plugins/password/config.inc.php.dist	2009-08-24 19:18:47 UTC (rev 2869)
@@ -87,8 +87,11 @@
 $rcmail_config['password_ldap_adminPW'] = null;
 
 // LDAP user DN mask
-// The user's DN is mandatory and as we only have his login, we need to re-create his DN using a mask
-// '%login' will be replace by the current roundcube user's login
+// The user's DN is mandatory and as we only have his login,
+// we need to re-create his DN using a mask
+// '%login' will be replaced by the current roundcube user's login
+// '%name' will be replaced by the current roundcube user's name part
+// '%domain' will be replaced by the current roundcube user's domain part
 // Exemple: 'uid=%login,ou=people,dc=exemple,dc=com'
 $rcmail_config['password_ldap_userDN_mask'] = 'uid=%login,ou=people,dc=exemple,dc=com';
 

Modified: trunk/roundcubemail/plugins/password/drivers/ldap.php
===================================================================
--- trunk/roundcubemail/plugins/password/drivers/ldap.php	2009-08-24 19:07:27 UTC (rev 2868)
+++ trunk/roundcubemail/plugins/password/drivers/ldap.php	2009-08-24 19:18:47 UTC (rev 2869)
@@ -21,6 +21,14 @@
     
     // Building user DN
     $userDN = str_replace('%login', $_SESSION['username'], $rcmail->config->get('password_ldap_userDN_mask'));
+    
+    $parts = explode('@', $_SESSION['username']);
+    if (count($parts) == 2)
+    {
+        $userDN = str_replace('%name', $parts[0], $userDN);
+        $userDN = str_replace('%domain', $parts[1], $userDN);
+    }
+
     if (empty($userDN)) {return PASSWORD_CONNECT_ERROR;}
     
     // Connection Method

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list