summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/password/config.inc.php.dist7
-rw-r--r--plugins/password/drivers/ldap.php8
2 files changed, 13 insertions, 2 deletions
diff --git a/plugins/password/config.inc.php.dist b/plugins/password/config.inc.php.dist
index abe2749b6..5d0a88b4e 100644
--- a/plugins/password/config.inc.php.dist
+++ b/plugins/password/config.inc.php.dist
@@ -87,8 +87,11 @@ $rcmail_config['password_ldap_adminDN'] = null;
$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';
diff --git a/plugins/password/drivers/ldap.php b/plugins/password/drivers/ldap.php
index 108782624..e38f13f8c 100644
--- a/plugins/password/drivers/ldap.php
+++ b/plugins/password/drivers/ldap.php
@@ -21,6 +21,14 @@ function password_save($curpass, $passwd)
// 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