IMAP Virtual Domain: Failure to get mailbox for default domain. Mailbox does not exist

RESOLVED WORKSFORME

Status

MailNews Core
Networking: IMAP
RESOLVED WORKSFORME
14 years ago
10 years ago

People

(Reporter: Erik Norgaard, Assigned: Bienvenu)

Tracking

Trunk
x86
FreeBSD

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

14 years ago
User-Agent:       Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.1) Gecko/20040721
Build Identifier: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.1) Gecko/20040721

I have set up Cyrus-IMAP server with virtual domains, and migrated my mailbox'es
to the default domain. Things works if I disable virtual domains. However,
enabling virtual domains I get the following error: Mailbox does not exist.

Tried:

1. Added a virtual domain mailbox, me@example.com: There is no problem reading
mail for that account (login: me%example.com).

2. Tried other client, Squirrelmail: Access to both defaultdomain account and
me@example.com.

3. Disabled virtual domains: access to my default domain, no access to
me@example.com (expected).

4. Specified login to defaultdomain account as 'me', me@defaultdomain and
me%defaultdomain. None works when virtual domains are enabled.

5. Changed default domain: Cyrus fails. 

6. Uncommented 'defaultdomain' config line in imapd.conf: cyrus fails.

I cannot completely exclude a bug in cyrus-imapd since imapd does not accept
other default domains than the hostname's domain. However the fact that things
work with Squirrelmail makes me suspect an error in Mozilla MailNews.

Server info: cyrus-imap 2.2.8, cyrus-sasl 2.1.19, cyrus-sasl-saslauthd 2.1.19,
OS: FreeBSD 4.10.

Reproducible: Always
Steps to Reproduce:
1. Setup cyrus-imap v. 2.2.8: my imapd.conf is as follows:
-------- imapd.conf ---------
configdirectory: /var/imap
partition-default: /var/imap/spool
altnamespace: yes 
defaultdomain: daemonsecurity.com
virtdomains: yes
allowplaintext: yes
admins: cyrus root
defaultacl: anyone lrs
sieveusehomedir: false
sievedir: /var/imap/sieve
sasl_pwcheck_method: saslauthd
sasl_mech_list: plain cram-md5 digest-md5
----------
fire up imapd.
2. Create a mailbox for the default domain eg. using cyradm, (add some mail, but
not sure if need to test).
3. Create account in Mozilla MailNews - normal procedure.
4. Open the inbox folder.
Actual Results:  
Failure: Mailbox does not exist

From the log: I can see that authentication succeeds.

Expected Results:  
MailNews should create a list of available folders and fetch messages for the inbox.
(Reporter)

Comment 1

14 years ago
Workarround:

I have found a workarround: As noted in 5) cyrus fails, I changed defaultdomain.
Removing my domain from /etc/hosts allows to **** an alternate default domain,
and hence setup the original default domain as a virtual domain:

In /etc/hosts:
::1                     localhost
127.0.0.1               localhost

In imapd.conf:
defaultdomain: localhost

The "Mailbox does not exits" error persists, but now with @localhost mailboxes
which at least provides a working solution.
(Assignee)

Comment 2

14 years ago
a client side imap protocol log of a failed session would be helpful:

http://www.mozilla.org/quality/mailnews/mail-troubleshoot.html#imap

thx.
(Reporter)

Comment 3

14 years ago
Created attachment 156238 [details]
Log output

This log contains client and server side log (server side is a bit sparce). 

First part is the client side log, shows unsuccesfull opening of mailbox for
default domain (example.com), then succesfull opening of mailbox for virtual
domain (virtualdomain.com).

Second part is the server side log of the above connections.
(Assignee)

Comment 4

14 years ago
in the virtual domain case, you'll see there's no personal namespace : NAMESPACE
NIL, and selecting the INBOX fails. I don't see the client doing anything wrong
- it seems like there is no INBOX or even personal namespace for the account
when you turn on virtual domains...
(Assignee)

Comment 5

14 years ago
except perhaps we shouldn't try to select the INBOX where there's no personal
namespace, I guess. Do you expect that there should be an INBOX?
(Reporter)

Comment 6

14 years ago
Created attachment 156267 [details]
mbox2imap batch migration tool

I created all mailfolders using this script for batch migration:

./mbox2imap.pl norgaard
./mbox2imap.pl norgaard@virtualdomain.com

This creates one mail account in the default domain, 'example.com', and another
in the virtual domain 'virtualdomain.com'. Both contain the same mail, the same
folders etc.

I can log in using Squirrelmail, and check mail, delete mail etc. for both
accounts. In squirrelmail if I log in as 'norgaard', 'norgaard%example.com' and
'norgaard@example.com' all sends me to the same namespace/mailaccount belonging
to the default domain's namespace. If I log in as 'norgaard%virtualdomain.com'
or 'norgaard@virtualdomain.com' I get the other mail account. This is all as I
would expect.

Doing the same using the mozilla mail, I only get access to the virtualdomain
account. The interesting thing is that if I disable virtual domains, then I
have normal access to the account in the default domain namespace (and
obviously not access to the virtual domain).

To me, this confirms that the INBOX does indeed exist. If I try to 'subscribe',
I see no folders or subfolders, even though they exist.
(Assignee)

Comment 7

14 years ago
If you'll look at the protocol log, you'll see that the server is telling us
there's no INBOX:

148844032[8d9ea00]: 84b7000:top.example.com:A:SendData: 7 select "INBOX"
148844032[8d9ea00]: ReadNextLine [stream=8bd8d08 nb=29 needmore=0]
148844032[8d9ea00]: 84b7000:top.example.com:A:CreateNewLineFromSocket: 7 NO
Mailbox does not exist

It seems like the default domain logon would be the simplest - we just pass in
the username. I don't see how Mozilla could be doing anything wrong in that
scenario. Are you changing the username in the account settings UI or by using
about:config/editing prefs.js by hand? Unfortunately, for privacy reasons, our
protocol log doesn't show the user name that gets sent...
(Reporter)

Comment 8

14 years ago
> I don't see how Mozilla could be doing anything wrong in that scenario. 
> Are you changing the username in the account settings UI or by using 
> about:config/editing prefs.js by hand? 

No, I have created the accounts through the normal interface. The error "Mailbox
does not exist" seems to be a consequence of the lacking namespace. I did a
sniffing on the packets and tried to replay the connection by hand using telnet,
and I can only confirm the mozilla log.

I didn't exclude the posibility that it's an cyrus-imap bug, and I have posted
on the cyrus mailing list.

I am experiencing wierd things with cyrus (in particular squirrelmail no longer
works?!) so I am less certain that this is a mozilla bug. I'll return when I
know more from the cyrus people.

Thanks for your time, and sorry if I have wasted it. Erik
(Reporter)

Comment 9

14 years ago
Hi there,

I haven't got any news from the Cyrus people, but this morning it occured to me:
If I can't select the mailbox, how on earth did I get the mail in there in the
first place? My migration script transfers mail using the imap protocol, and for
performance it connects to localhost.

So I tried telnetting to localhost, and the default domain works. While
connecting on the normal interface returns namespace NIL. This explains why I
could have Squirrellmail working since it was running on the same host (and it
stopped working because I for some reason decided to change the server address). 

So, I conclude that this is not a bug in Mozilla mail. I am really sorry for
taking your time, this bug is beyond normal obscurity I think. For your interest
I have included the two telnet sessions below...

Best regards, and thanks. Erik

Mystery deepens... Here is what I got:

Telnetsession on loopback interface:
[norgaard@top norgaard]$ telnet 127.0.0.1 143
Trying 127.0.0.1...
Connected to localhost.example.com.
Escape character is '^]'.
* OK top.example.com Cyrus IMAP4 v2.2.8 server ready
1 login "norgaard@example.com" ******
1 OK User logged in
2 namespace
* NAMESPACE (("" ".")) (("Other Users." ".")) (("Shared Folders." "."))
2 OK Completed

Telnet session on real interface:
[norgaard@top norgaard]$ telnet 192.168.0.4 143
Trying 192.168.0.4...
Connected to top.168.192.in-addr.arpa.
Escape character is '^]'.
* OK top.example.com Cyrus IMAP4 v2.2.8 server ready
1 login "norgaard@example.com" ******
1 OK User logged in
2 namespace
* NAMESPACE NIL (("Other Users." ".")) (("Shared Folders." "."))
2 OK Completed
Status: UNCONFIRMED → RESOLVED
Last Resolved: 14 years ago
Resolution: --- → FIXED

Comment 10

14 years ago
No bug / patch referenced.  From the comments, this doesn't seem like a bug with
Mozilla code anyway.

-> WORKSFORME
Status: RESOLVED → UNCONFIRMED
Resolution: FIXED → ---

Updated

14 years ago
Status: UNCONFIRMED → RESOLVED
Last Resolved: 14 years ago14 years ago
Resolution: --- → WORKSFORME
(Assignee)

Comment 11

14 years ago
Eric, no problem; glad you've figured it out to some extent. If you figure out
what's going on with Cyrus, maybe you could append that info here, and if
someone else has the same problem, I can point them to the info.
(Reporter)

Comment 12

14 years ago
I have finally traced the problem in case anyone should ask. It would be quite
wierd if cyrus took special care for the loopback interface, and it doesn't.
Cyrus does a reverse lookup on the ip that recieves the incoming connection. The
returned hostname must be one under the default domain.

So the solution to that kind of problem is to get reverse dns right, or add
entries to /etc/hosts. From the cyrus mailinglist I was finally told,

> Use:
>
> virtdomains: userid
> and it won't do this.  The reverse lookup is to support configs where 
> each virtdomain is serviced by a particular IP.

But then all would have to login with a fully qualified login. This behaviour is
perfectly fine (I think) if there was no default domain specified, but otherwise
I would expect cyrus to assume the default domain.

So, not only am I now embarassed to admit that the problem was local, worse, I
have also now found that the 'reverse lookup' was actually documented :-(
However, I still think a specified default domain should take precedence.

Thanks again, at least I learned something about the IMAP protocal :-)
Regards, Erik
Product: MailNews → Core
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.