$RCMAIL->autoselect_host overriding provided IMAP servers for a domain
|Reported by:||CountNosnam||Owned by:|
|Priority:||1 - Highest||Milestone:||0.8-stable|
|Severity:||critical||Keywords:||$RCMAIL->autoselect_host, IMAP, IMAP override|
Having tried 0.8 RC recently I have come across a major bug, the issue still exists in the latest version on the GIT repo too.
When you have the following setup:
$rcmail_config['default_host'] = array ( 'ssl://server.domain.org.uk' => 'New Server', 'ssl://old.domain.org.uk' => 'Old Server', 'ssl://server.altdomain.org' => 'Alternate Domain', );
If you were to attempt to login as:
With "Old Server" selected from the dropdown list on the login screen, it instead connects to the first IMAP server listed for that specific domain (in this case "New Server - ssl://server.domain.org.uk").
Likewise, if you switched "Old Server" and "New Server" in the configuration array - so that "Old Server" was listed first for that domain, it would always connect to "Old Server" even if you selected "New Server" from the login dropdown.
From some quick digging around, I found that the error seems to be caused caused by the $RCMAIL->autoselect_host functionality.
I also found that if you change:
$auth = $RCMAIL->plugins->exec_hook('authenticate', array( 'host' => $RCMAIL->autoselect_host(),
$auth = $RCMAIL->plugins->exec_hook('authenticate', array( 'host' => trim(get_input_value('_host', RCUBE_INPUT_POST)),
It resolves the issue in this particular case.
I have not had a chance to look into what exactly $RCMAIL->autoselect_host() does yet, but assume that for some reason it is unable to cope with multiple definitions for the same domain - and if found defaults to the first one listed?