Skip to content

Commit

Permalink
Fix variable substitution in ldap host for some use-cases, e.g. new_u…
Browse files Browse the repository at this point in the history
…ser_identity (#5544)
  • Loading branch information
alecpl committed Dec 1, 2016
1 parent bc826be commit 79613c1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ CHANGELOG Roundcube Webmail
===========================

- Managesieve: Fix handling of scripts with nested rules (#5540)
- Fix variable substitution in ldap host for some use-cases, e.g. new_user_identity (#5544)

RELEASE 1.2.3
-------------
Expand Down
8 changes: 5 additions & 3 deletions program/lib/Roundcube/rcube_ldap.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ function __construct($p, $debug = false, $mail_domain = null)

$this->sort_col = is_array($p['sort']) ? $p['sort'][0] : $p['sort'];
$this->debug = $debug;
$this->mail_domain = $mail_domain;
$this->mail_domain = $this->prop['mail_domain'] = $mail_domain;

// initialize cache
$rcube = rcube::get_instance();
Expand Down Expand Up @@ -260,11 +260,13 @@ private function _connect()
{
$rcube = rcube::get_instance();

if ($this->ready)
if ($this->ready) {
return true;
}

if (!is_array($this->prop['hosts']))
if (!is_array($this->prop['hosts'])) {
$this->prop['hosts'] = array($this->prop['hosts']);
}

// try to connect + bind for every host configured
// with OpenLDAP 2.x ldap_connect() always succeeds but ldap_bind will fail if host isn't reachable
Expand Down
3 changes: 2 additions & 1 deletion program/lib/Roundcube/rcube_ldap_generic.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ public function connect($host = null)
{
// Net_LDAP3 does not support IDNA yet
// also parse_host() here is very Roundcube specific
$host = rcube_utils::idn_to_ascii(rcube_utils::parse_host($host));
$host = rcube_utils::parse_host($host, $this->config['mail_domain']);
$host = rcube_utils::idn_to_ascii($host);

return parent::connect($host);
}
Expand Down

0 comments on commit 79613c1

Please sign in to comment.