fetchmail-friends
[Top] [All Lists]

[fetchmail]Why sleep(3) after logging in?

2004-04-18 03:58:27
I use fetchmail-6.2.5 to pull mail via POP3 from a courier-imap server. I've
always wondered why there seemed to be a three-second delay for logins to
complete: was there an authentication problem on the server? Well finally
today I got round to checking it out, and in pop3_getauth() in
fetchmail-6.2.5/pop3.c I discover:

    /*
     * Empirical experience shows some server/OS combinations
     * may need a brief pause even after any lockfiles on the
     * server are released, to give the server time to finish
     * copying back very large mailfolders from the temp-file...
     * this is only ever an issue with extremely large mailboxes.
     */
    sleep(3); /* to be _really_ safe, probably need sleep(5)! */

This is done after the PASS / +OK transaction has taken place.

Can someone explain why on earth this would ever be necessary? We can push a
STAT or LIST or RETR 1 command down the TCP socket, and the server will only
read it when it is ready to. Furthermore, we *know* by this stage that we
have had +OK back from the server. The server is therefore ready to receive
further commands, by its own admission!

Do any other POP3 clients incorporate such a delay? It must be a workaround
for one particular buggy POP3 server, as RFC1939 certainly doesn't say you
should wait 3-5 seconds after seeing +OK before you issue any commands. In
which case, I'd suggest it be made either a compile-time option or a
run-time option (although fetchmail has enough of those already :-) since
it's an inconvenience for the vast majority of users.

Anyway, while I'm here, I hope you don't mind if I report another little
quirk. When I connect using POP3 over SSL on port 995, and I'm using a
different name than the one in the certificate, the error message is always
reported *three* times:

fetchmail: Server CommonName mismatch: webmail.example.com != pop3.example.com
fetchmail: Server CommonName mismatch: webmail.example.com != pop3.example.com
fetchmail: Server CommonName mismatch: webmail.example.com != pop3.example.com

This is buried in SSL_verify_callback so I really can't see why it is being
called three times, instead of just once, at login time.

Regards,

Brian.


<Prev in Thread] Current Thread [Next in Thread>