MBOX-Line: From asuth at mozilla.com  Fri Mar  7 17:13:30 2014
To: imap-protocol@u.washington.edu
From: Andrew Sutherland <asuth@mozilla.com>
Date: Fri Jun  8 12:34:52 2018
Subject: [Imap-protocol] Is it okay/common for servers to ignore
 commands sent before the greeting? (gmail seems to?)
In-Reply-To: <4012E0DA-1598-47CA-804E-9ED75CE22327@iki.fi>
References: <5319E04C.3070105@mozilla.com>	<cfe80347-ed90-4e5b-a69a-93f99e2158c4@flaska.net>
	<4012E0DA-1598-47CA-804E-9ED75CE22327@iki.fi>
Message-ID: <531A6EBA.5000307@mozilla.com>

On 03/07/2014 12:27 PM, Timo Sirainen wrote:
> On 7.3.2014, at 18.01, Jan Kundr?t <jkt@flaska.net> wrote:
>
>> Interesting. What my client is doing is patiently waiting for the initial response and checking whether the capability list is passed in there as a response code.

Our IMAP implementation has not gotten a lot of love.  We started from 
https://github.com/mscdex/node-imap/ as a base and this was simply its 
default behavior which worked, so we ran with it.  We have a backlog of 
things to do to improve our IMAP implementation, but we do want 
connection setup to be as fast as possible so it's nice to know the 
right thing to do when correcting immediate issues and longer term.


> I think the ideal solution would be for everyone to start sending the CAPABILITY in the initial reply. Dovecot v2.x actually sends only a truncated CAPABILITY reply that contains only the extensions relevant to client before login. If you want to be sure not to break any clients, you could still do that and send the full capabilities list as a reply to the CAPABILITY command. The clients that understand the initial reply will also understand the updated OK [CAPABILITY ..] reply to LOGIN/AUTHENTICATE, while those that don't understand it will just request the CAPABILITY command directly.

Yes, dovecot's behavior here is very nice.  We do understand and want to 
continue to understand LOGINDISABLED so we can treat the situation as an 
appropriate type of transient failure, so it's good for us to have that 
information.

However, if a server such as dovecot does this and we have persisted 
this knowledge and are on an imaps/993/initial-TLS connection, would it 
then be okay for us to attempt our login as our first step before having 
seen the greeting?  Assuming the server always sends the greeting 
regardless of our initial command, we can drop the connection and/or 
ignore the login failure when we see that there was a LOGINDISABLED command.

Thanks,
Andrew

