Bug 94748

Summary: KMail violates RfC on SMTP AUTH problems
Product: [Applications] kmail2 Reporter: Rolf Eike Beer <kde>
Component: generalAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED UNMAINTAINED    
Severity: normal CC: lemma
Priority: NOR Keywords: triaged
Version: 4.8   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Rolf Eike Beer 2004-12-09 17:30:53 UTC
Version:           1.7.2 (using KDE 3.3.2 Level "a" , unofficial build of SUSE )
Compiler:          gcc version 3.3.1 (SuSE Linux)
OS:                Linux (i686) release 2.6.10-rc2

I was just playing a bit with my self-written mailer daemon and found this behaviour of KMail when there are problems with the authentication (it does not matter if it's a 4xx or 5xx reply):

Dec  9 17:02:39 sf-mail smtpd: 1102608159.984393 24065 > 220 mail.sf-mail.de Qsmtpd 0.3pre ESMTP?
Dec  9 17:02:40 sf-mail smtpd: 1102608160.055922 24065 < EHLO bilbo.math.uni-mannheim.de?
Dec  9 17:02:40 sf-mail smtpd: 1102608160.070479 24065 > 250-mail.sf-mail.de?
Dec  9 17:02:40 sf-mail smtpd: 1102608160.070539 24065 > 250-ENHANCEDSTATUSCODES?
Dec  9 17:02:40 sf-mail smtpd: 1102608160.070579 24065 > 250-PIPELINING?
Dec  9 17:02:40 sf-mail smtpd: 1102608160.070617 24065 > 250-8BITMIME?
Dec  9 17:02:40 sf-mail smtpd: 1102608160.088269 24065 > 250-STARTTLS?
Dec  9 17:02:40 sf-mail smtpd: 1102608160.096825 24065 > 250 SIZE?
Dec  9 17:02:40 sf-mail smtpd: 1102608160.116863 24065 < AUTH PLAIN?
Dec  9 17:02:40 sf-mail smtpd: 1102608160.117040 24065 > 334 ?
Dec  9 17:02:40 sf-mail smtpd: 1102608160.126852 24065 < ZWlrZUBzZi1tYWlsLmRlAGVpa2VAc2YtbWFpbC5kZQBibGFmYXNlbA==?
Dec  9 17:02:45 sf-mail smtpd: 1102608165.237787 24065 > 535 5.7.0 authorization failed?
Dec  9 17:02:45 sf-mail smtpd: 1102608165.259435 24065 < [EOF]
Dec  9 17:02:45 sf-mail smtpd: 1102608165.260579 24065 > [EOF]

Kmail must send a "QUIT" here as RfC 2821 says:
4.1.1.10 QUIT (QUIT)

[...]
   error).  The sender MUST NOT intentionally close the transmission
   channel until it sends a QUIT command and SHOULD wait until it
   receives the reply (even if there was an error response to a previous
   command).  If the connection is closed prematurely due to violations

At the moment it violates the RfC and just closes the connection (incoming EOF in log above).

The second problem/bug is that KMail tries to authenticate even if the server does not announce AUTH in it's EHLO response (and a bug in my daemon not to reject the auth).
Comment 1 Thiago Macieira 2005-04-14 00:19:07 UTC
Is this still an issue with KMail 1.8? We're now using an external plugin for authentication.
Comment 2 Rolf Eike Beer 2005-04-21 12:20:03 UTC
Yes:

Apr 21 12:17:27 sf-mail Qsmtpd[13970]: <e EHLO bilbo.math.uni-mannheim.de
Apr 21 12:17:27 sf-mail Qsmtpd[13970]: >e 250-mail.sf-mail.de
Apr 21 12:17:27 sf-mail Qsmtpd[13970]: >e 250-ENHANCEDSTATUSCODES
Apr 21 12:17:27 sf-mail Qsmtpd[13970]: >e 250-PIPELINING
Apr 21 12:17:27 sf-mail Qsmtpd[13970]: >e 250-8BITMIME
Apr 21 12:17:27 sf-mail Qsmtpd[13970]: >e 250-AUTH PLAIN LOGIN
Apr 21 12:17:27 sf-mail Qsmtpd[13970]: >e 250 SIZE
Apr 21 12:17:27 sf-mail Qsmtpd[13970]: <e AUTH PLAIN ...
Apr 21 12:17:32 sf-mail Qsmtpd[13970]: >e 535 5.7.0 authorization failed
Apr 21 12:17:32 sf-mail Qsmtpd[13970]: connection died
Comment 3 Michael Leupold 2008-09-14 23:53:21 UTC
Hey Rolf, triaging bugs currently and stumbled onto yours. :) It's pretty hard to reproduce this bug. Do you still have your daemon around and ready to check if this bug persists with a recent KMail release?
Comment 4 Rolf Eike Beer 2008-09-18 16:41:12 UTC
Yes, bug still exists with current trunk.
Comment 5 Rolf Eike Beer 2009-10-19 12:35:01 UTC
Still present in KMail 1.12.2
Comment 6 Torgny Nyblom 2009-10-21 08:13:20 UTC
SVN commit 1038345 by tnyblom:

Send "QUIT" when closing the connection (mandatory according to RFC5321). Might be more 
cases where this is missing...

CCBUG: 94748


 M  +8 -1      smtp.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1038345
Comment 7 Rolf Eike Beer 2009-10-21 17:29:35 UTC
Wrong RfC number?
Comment 8 Torgny Nyblom 2011-12-04 18:11:20 UTC
Still an issue?

(No not wrong RFC number: http://tools.ietf.org/html/rfc5321#section-3.8, this RFC is the latest SMTP RFC and obsoletes the others)
Comment 9 Christophe Marin 2012-01-08 13:27:48 UTC
No feedback. Closing
Comment 10 Rolf Eike Beer 2012-01-08 14:23:26 UTC
Sorry, got distracted. Problem persists using Kontact from 4.7.4 and 4.8RC2.
Comment 11 Denis Kurz 2016-09-24 18:08:49 UTC
This bug has only been reported for versions before 4.14, which have been unsupported for at least two years now. Can anyone tell if this bug still present?

If noone confirms this bug for a Framework-based version of kmail2 (version 5.0 or later, as part of KDE Applications 15.12 or later), it gets closed in about three months.
Comment 12 Denis Kurz 2017-01-07 22:34:32 UTC
Just as announced in my last comment, I close this bug. If you encounter it again in a recent version (at least 5.0 aka 15.08), please open a new one unless it already exists. Thank you for all your input.