[imp] Trouble using realms
Ruben Monjaraz
rmhi77 at gmail.com
Tue Sep 21 16:35:07 PDT 2004
Hi everyone.
I was having trouble while trying to use the 'realm' field in servers.php.
The file says something like
$servers['imap'] = array(
'name' => 'IMAP Server',
'server' => 'imap.example.com',
'protocol' => 'imap/notls',
'port' => 143,
'folders' => 'mail/',
'namespace' => '',
'maildomain' => 'example.com',
'smtphost' => 'smtp.example.com',
'realm' => 'example.com',
'preferred' => ''
)
I've tried to log in simply as 'user', since IMP is supposed to put
the '@example.com' part.
However the log file shows attempts to log in as 'user', that is,
without the realm. It seemed to me that somehow IMP was 'forgetting'
to put this.
So, after looking in the code I found the following in lib/IMP.php,
lines 65-73 it reads
if (Auth::getAuth()) {
$_SESSION['imp']['uniquser'] = Auth::getAuth();
} elseif (($conf['server']['server_list'] != 'none') &&
!empty($servers[$server]['realm'])) {
$_SESSION['imp']['uniquser'] = $_SESSION['imp']['user'] . '@' .
$servers[$server]['realm'];
} elseif (!empty($realm)) {
$_SESSION['imp']['uniquser'] = $_SESSION['imp']['user'] . '@' . $realm;
} else {
$_SESSION['imp']['uniquser'] = $_SESSION['imp']['user'];
}
that is, $_SESSION['imp']['uniquser'] is effectively keeping the
value 'user + realm',
but on line 272 it reads:
$_SESSION['imp']['stream'] = @imap_open($connstr, $_SESSION['imp']['user'],
Secret::read(Secret::getKey('imp'), $_SESSION['imp']['pass']));
I think the 2nd argument in the call to imap_open should be
$_SESSION['imp']['uniquser'],
otherwise we are discarding the 'realm' value. It's clear that, if
'realm' is empty, then
$_SESSION['imp']['uniquser'] = $_SESSION['imp']['user']
so, at glance, it's safe to change that parameter.
So the big questions are:
Is this a bug ?
Are you having the same trouble ?
May be I'm completely wrong (if so, sorry for overpopulate your mail)
I will appreciate your comments.
Regards
More information about the imp
mailing list