<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffff99" text="#000000">
<font size="+1"><font face="Helvetica, Arial, sans-serif">Hi,<br>
<br>
To be able to have user names like &lt;user&gt;@&lt;our.domain&gt; and
&lt;sameuser&gt;@&lt;another.domain&gt;, I have changed our IMAP config
to use virtual domains. To be able to access the existing mailboxes, I
added the "defaultdomain" option to imapd.conf. The user names were
then renamed from &lt;user&gt; to &lt;user&gt;@&lt;our.domain&gt;, so I
would think we could login. <br>
But we couldn't. </font></font><font size="+1"><font
 face="Helvetica, Arial, sans-serif">We use a sql lookup for
authentication and so does Postfix to find the local users. Now, here I
have found a problem.<br>
<br>
What happens? At authentication, the (default) domain name appears to
get replaced with the <b>server's hostname</b> and the authentication
fails. If I change the user name to &lt;user&gt;@&lt;server name&gt;,
it works. But then Postfix requires the email address to be present in
the virtual users table, pointing to the local user name again. And
this is only the case for the default domain, not for foreign domains.<br>
<br>
The server's local name should not be used here, as it is totally
arbitrary. It would make it impossible to e.g. migrate cyrus and
Postfix to another server.<br>
<br>
(I hope you still follow)<br>
<br>
Here's the imapd.conf:<br>
</font></font><font size="+1"><tt>configdirectory: /var/lib/imap<br>
partition-default: /var/spool/imap<br>
sievedir: /var/lib/sieve<br>
admins: cyrus root<br>
<br>
allowanonymouslogin: no<br>
autocreate_users: anyone<br>
autocreatequota: 1000000<br>
reject8bit: no<br>
quotawarn: 90<br>
timeout: 30<br>
poptimeout: 10<br>
dracinterval: 0<br>
drachost: localhost<br>
allowplaintext: yes<br>
lmtp_overquota_perm_failure: no<br>
lmtp_downcase_rcpt: yes<br>
createonpost: yes<br>
unixhierarchysep: yes<br>
virtdomains: yes<br>
defaultdomain: secureoffice.net<br>
<br>
sasl_pwcheck_method: auxprop<br>
sasl_auxprop_plugin: sql<br>
sasl_sql_engine: mysql<br>
sasl_mech_list: login<br>
sasl_sql_hostnames: localhost<br>
sasl_sql_user: mail<br>
sasl_sql_passwd: Love32Home15Should50Travel<br>
sasl_sql_database: maildb<br>
sasl_sql_verbose: yes<br>
sasl_sql_select: SELECT clear AS password FROM users WHERE id='%u@%r'
AND Active='Y'<br>
<br>
</tt></font><font size="+1"><font face="Helvetica, Arial, sans-serif">And
this is from the logfile:<br>
</font></font><font size="+1"><tt>Feb 18 16:26:07 reindeer imap[14741]:
sql plugin create statement from userPassword edwin.boersma reindeer<br>
Feb 18 16:26:07 reindeer imap[14741]: sql plugin doing query SELECT
clear AS password FROM users WHERE id='edwin.boersma@reindeer' AND
Active='Y';<br>
</tt></font><font size="+1"><font face="Helvetica, Arial, sans-serif"><br>
My username is <a class="moz-txt-link-abbreviated"
 href="mailto:edwin.boersma@secureoffice.net">edwin.boersma@secureoffice.net</a>,
and the server's local
name is reindeer. Is there something wrong in my config, or is this
works-as-designed? <br>
</font></font>
<pre class="moz-signature" cols="72">-- 
Kind regards,

Edwin Boersma
Lead Developer Web Applications

SecureOffice Europe AB
Ideon Science Park B2 floor 2
Scheelev&auml;gen 17
22363 Lund
Sweden

W: <a class="moz-txt-link-freetext" href="http://www.secureoffice.net">http://www.secureoffice.net</a>
T: +46 462868773
M: +46 709726431</pre>
</body>
</html>