New_user_identity: Fix %fu/%u vars substitution in user specific LDAP params (#6419)

pull/6465/head
Aleksander Machniak 6 years ago
parent 0304f7c75b
commit 4303c59467

@ -9,6 +9,7 @@ CHANGELOG Roundcube Webmail
- Fix XSS issue in handling invalid style tag content (#6410)
- Fix compatibility with MySQL 8 - error on 'system' table use
- Managesieve: Fix bug where show_real_foldernames setting wasn't respected (#6422)
- New_user_identity: Fix %fu/%u vars substitution in user specific LDAP params (#6419)
RELEASE 1.3.7
-------------

@ -26,7 +26,7 @@ class new_user_identity extends rcube_plugin
function lookup_user_name($args)
{
if ($this->init_ldap($args['host'])) {
if ($this->init_ldap($args['host'], $args['user'])) {
$results = $this->ldap->search('*', $args['user'], true);
if (count($results->records) == 1) {
@ -96,7 +96,7 @@ class new_user_identity extends rcube_plugin
return $args;
}
private function init_ldap($host)
private function init_ldap($host, $user)
{
if ($this->ldap) {
return $this->ldap->ready;
@ -112,11 +112,17 @@ class new_user_identity extends rcube_plugin
return false;
}
$this->ldap = new new_user_identity_ldap_backend(
$ldap_config[$addressbook],
$this->rc->config->get('ldap_debug'),
$this->rc->config->mail_domain($host),
$match);
$debug = $this->rc->config->get('ldap_debug');
$domain = $this->rc->config->mail_domain($host);
$props = $ldap_config[$addressbook];
// Set 'username' prop for correct variables substitution (#6419)
$props['username'] = $user;
if (!strpos($user, '@')) {
$props['username'] .= '@' . $domain;
}
$this->ldap = new new_user_identity_ldap_backend($props, $debug, $domain, $match);
return $this->ldap->ready;
}

@ -299,7 +299,7 @@ class rcube_ldap extends rcube_addressbook
}
// Get the pieces needed for variable replacement.
if ($fu = $rcube->get_user_email()) {
if ($fu = ($rcube->get_user_email() ?: $this->prop['username'])) {
list($u, $d) = explode('@', $fu);
}
else {

Loading…
Cancel
Save