Bug 90897 - kmail opens two connections to send mail if user defined hostname is set
Summary: kmail opens two connections to send mail if user defined hostname is set
Status: RESOLVED WORKSFORME
Alias: None
Product: kmail
Classification: Applications
Component: sending (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-07 11:10 UTC by Rolf Eike Beer
Modified: 2009-10-19 12:29 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rolf Eike Beer 2004-10-07 11:10:59 UTC
Version:            (using KDE KDE 3.3.0)
Installed from:    SuSE RPMs
OS:                Linux

My host is named myhost.sf-tec.de (not really, but that doesn't matter). KMail should send mail using the hostname "test.sf-tec.de". This is the output of ssldump between kmail and the mail server which shows KMail opens one connection and uses the real hostname, uses STARTTLS, quits the connection and starts again, this time using the given hostname and delivering the mail. This will hit you if the server filters special hostnames and blocks the mail then, I found this because normally my private server rejects mail with his own name as HELO (and this was the reason I set a special one).

New TCP connection #1: myhost.sf-tec.de(32852) <-> myhost.sf-tec.de(25252)
0.3209 (0.3209)  S>C
---------------------------------------------------------------
220 myhost.sf-tec.de Qsmtpd v0.1 ESMTP
---------------------------------------------------------------

0.5410 (0.2200)  C>S
---------------------------------------------------------------
EHLO myhost.sf-tec.de
---------------------------------------------------------------

0.5435 (0.0025)  S>C
---------------------------------------------------------------
250-myhost.sf-tec.de
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-STARTTLS
250 SIZE 123456
---------------------------------------------------------------

0.5942 (0.0507)  C>S
---------------------------------------------------------------
STARTTLS
---------------------------------------------------------------

0.6123 (0.0181)  S>C
---------------------------------------------------------------
220 ready for tls
---------------------------------------------------------------

1 1  0.8359 (0.2235)  C>S  Handshake
      ClientHello
        Version 3.1
        cipher suites
        TLS_RSA_WITH_RC4_128_MD5
        TLS_RSA_WITH_RC4_128_SHA
        TLS_RSA_WITH_3DES_EDE_CBC_SHA
        Unknown value 0x39
        Unknown value 0x38
        Unknown value 0x35
        TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA
        TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA
        Unknown value 0x33
        Unknown value 0x32
        Unknown value 0x2f
        TLS_DHE_DSS_WITH_RC4_128_SHA
        TLS_DHE_DSS_WITH_RC2_56_CBC_SHA
        TLS_RSA_EXPORT1024_WITH_RC4_56_SHA
        TLS_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA
        TLS_RSA_EXPORT1024_WITH_DES_CBC_SHA
        TLS_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5
        TLS_RSA_EXPORT1024_WITH_RC4_56_MD5
        TLS_DHE_RSA_WITH_DES_CBC_SHA
        TLS_DHE_DSS_WITH_DES_CBC_SHA
        TLS_RSA_WITH_DES_CBC_SHA
        compression methods
                  NULL
1 2  0.8499 (0.0140)  S>C  Handshake
      ServerHello
        Version 3.1
        session_id[32]=
          66 3d 1e 44 4a 08 e2 47 27 e1 2b ea b0 6f 1f 60
          10 b0 af 59 81 52 a1 10 19 56 4c d2 44 4e 2f 87
        cipherSuite         TLS_RSA_WITH_RC4_128_MD5
        compressionMethod                   NULL
1 3  0.8499 (0.0000)  S>C  Handshake
      Certificate
1 4  0.8499 (0.0000)  S>C  Handshake
      ServerHelloDone
1 5  0.9488 (0.0988)  C>S  Handshake
      ClientKeyExchange
1 6  0.9488 (0.0000)  C>S  ChangeCipherSpec
1 7  0.9488 (0.0000)  C>S  Handshake
      Finished
1 8  1.0943 (0.1455)  S>C  ChangeCipherSpec
1 9  1.0943 (0.0000)  S>C  Handshake
      Finished
1 10 1.8841 (0.7897)  C>S  application_data
    ---------------------------------------------------------------
    EHLO myhost.sf-tec.de
    ---------------------------------------------------------------
1 11 31.8904 (30.0062)  S>C  application_data
    ---------------------------------------------------------------
    250-myhost.sf-tec.de
    250-ENHANCEDSTATUSCODES
    250-PIPELINING
    250-8BITMIME
    250 SIZE 123456
    ---------------------------------------------------------------
1 12 32.3697 (0.4793)  C>S  application_data
    ---------------------------------------------------------------
    QUIT
    ---------------------------------------------------------------
1 13 62.3736 (30.0039)  S>C  application_data
    ---------------------------------------------------------------
    221 2.0.0 myhost.sf-tec.de service closing transmission channel
    ---------------------------------------------------------------
1 14 62.3816 (0.0079)  C>S  Alert
    level           warning
    value           close_notify
1    62.3881 (0.0064)  S>C  TCP RST
New TCP connection #2: myhost.sf-tec.de(32854) <-> myhost.sf-tec.de(25252)
0.1544 (0.1544)  S>C
---------------------------------------------------------------
220 myhost.sf-tec.de Qsmtpd v0.1 ESMTP
---------------------------------------------------------------

0.1691 (0.0147)  C>S
---------------------------------------------------------------
EHLO test.sf-tec.de
---------------------------------------------------------------

0.2750 (0.1058)  S>C
---------------------------------------------------------------
250-myhost.sf-tec.de
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-STARTTLS
250 SIZE 123456
---------------------------------------------------------------

0.3125 (0.0374)  C>S
---------------------------------------------------------------
STARTTLS
---------------------------------------------------------------

0.3333 (0.0208)  S>C
---------------------------------------------------------------
220 ready for tls
---------------------------------------------------------------

2 1  0.5460 (0.2126)  C>S  Handshake
      ClientHello
        Version 3.1
        cipher suites
        TLS_RSA_WITH_RC4_128_MD5
        TLS_RSA_WITH_RC4_128_SHA
        TLS_RSA_WITH_3DES_EDE_CBC_SHA
        Unknown value 0x39
        Unknown value 0x38
        Unknown value 0x35
        TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA
        TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA
        Unknown value 0x33
        Unknown value 0x32
        Unknown value 0x2f
        TLS_DHE_DSS_WITH_RC4_128_SHA
        TLS_DHE_DSS_WITH_RC2_56_CBC_SHA
        TLS_RSA_EXPORT1024_WITH_RC4_56_SHA
        TLS_DHE_DSS_EXPORT1024_WITH_DES_CBC_SHA
        TLS_RSA_EXPORT1024_WITH_DES_CBC_SHA
        TLS_RSA_EXPORT1024_WITH_RC2_CBC_56_MD5
        TLS_RSA_EXPORT1024_WITH_RC4_56_MD5
        TLS_DHE_RSA_WITH_DES_CBC_SHA
        TLS_DHE_DSS_WITH_DES_CBC_SHA
        TLS_RSA_WITH_DES_CBC_SHA
        compression methods
                  NULL
2 2  0.5606 (0.0146)  S>C  Handshake
      ServerHello
        Version 3.1
        session_id[32]=
          a9 0e de 17 dd c1 d2 a9 f0 b5 f0 13 f9 12 09 ff
          11 db e2 07 f3 05 5d a9 09 e8 d8 40 99 90 02 ed
        cipherSuite         TLS_RSA_WITH_RC4_128_MD5
        compressionMethod                   NULL
2 3  0.5606 (0.0000)  S>C  Handshake
      Certificate
2 4  0.5606 (0.0000)  S>C  Handshake
      ServerHelloDone
2 5  0.5868 (0.0261)  C>S  Handshake
      ClientKeyExchange
2 6  0.5868 (0.0000)  C>S  ChangeCipherSpec
2 7  0.5868 (0.0000)  C>S  Handshake
      Finished
2 8  0.7633 (0.1764)  S>C  ChangeCipherSpec
2 9  0.7633 (0.0000)  S>C  Handshake
      Finished
2 10 1.5061 (0.7427)  C>S  application_data
    ---------------------------------------------------------------
    EHLO test.sf-tec.de
    ---------------------------------------------------------------
2 11 31.5128 (30.0067)  S>C  application_data
    ---------------------------------------------------------------
    250-myhost.sf-tec.de
    250-ENHANCEDSTATUSCODES
    250-PIPELINING
    250-8BITMIME
    250 SIZE 123456
    ---------------------------------------------------------------
2 12 31.5267 (0.0138)  C>S  application_data
    ---------------------------------------------------------------
    MAIL FROM:<eike@myhost.sf-tec.de> BODY=8BITMIME SIZE=375
    RCPT TO:<eike@myhost.sf-tec.de>
    DATA
    ---------------------------------------------------------------
2 13 72.6093 (41.0825)  S>C  application_data
    ---------------------------------------------------------------
    250 2.1.5 ok
    ---------------------------------------------------------------
2 14 102.7242 (30.1149)  S>C  application_data
    ---------------------------------------------------------------
    250 2.1.0 ok
    ---------------------------------------------------------------
2 15 132.7320 (30.0078)  S>C  application_data
    ---------------------------------------------------------------
    354 Start mail input; end with <CRLF>.<CRLF>
    ---------------------------------------------------------------
2 16 132.8062 (0.0741)  C>S  application_data
    ---------------------------------------------------------------
    From: Rolf Eike Beer <eike@myhost.sf-tec.de>
    To: eike@myhost.sf-tec.de
    Subject: test 6
    Date: Sat, 25 Sep 2004 23:22:26 +0200
    User-Agent: KMail/1.7
    MIME-Version: 1.0
    Content-Type: text/plain;
      charset="iso-8859-15"
    Content-Transfer-Encoding: 7bit
    Content-Disposition: inline
    Message-Id: <200409252322.26846.eike@myhost.sf-tec.de>

    tls protokoll received
    .
    ---------------------------------------------------------------
2 17 162.8884 (30.0821)  S>C  application_data
    ---------------------------------------------------------------
    250 2.5.0 accepted message for delivery
    ---------------------------------------------------------------
2 18 163.0525 (0.1641)  C>S  application_data
    ---------------------------------------------------------------
    QUIT
    ---------------------------------------------------------------
2 19 193.0579 (30.0054)  S>C  application_data
    ---------------------------------------------------------------
    221 2.0.0 myhost.sf-tec.de service closing transmission channel
    ---------------------------------------------------------------
2    193.0663 (0.0084)  S>C  TCP FIN
2 20 193.0711 (0.0047)  C>S  Alert
    level           warning
    value           close_notify
Comment 1 Rolf Eike Beer 2005-12-29 16:03:12 UTC
Still present in 3.5.0
Comment 2 Rolf Eike Beer 2006-09-06 11:55:20 UTC
Still present in Kontact 1.2.3/KDE 3.5.4

This is my current log. Lines beginning with '<' are from KMail, '>' indicates server messages. If it is directly followed by a 'e' it's in STARTTLS mode. Slightly snipped.

First connection:

> 220 mail.sf-mail.de Qsmtpd 0.9 ESMTP
< EHLO myhost.sf-tec.de.de
> 250-mail.sf-mail.de
> 250-STARTTLS
> 250 SIZE
< STARTTLS
> 220 ready for tls
<e EHLO myhost.sf-tec.de
>e 250-mail.sf-mail.de
>e 250-AUTH PLAIN LOGIN
>e 250 SIZE
<e AUTH PLAIN (foobar)
>e 235 2.0.0 ok, go ahead
<e QUIT
>e 221 2.0.0 mail.sf-mail.de service closing transmission channel

Second connection:

> 220 mail.sf-mail.de Qsmtpd 0.9 ESMTP
< EHLO test.sf-tec.de
> 250-mail.sf-mail.de
> 250-STARTTLS
> 250 SIZE
< STARTTLS
> 220 ready for tls
<e EHLO test.sf-tec.de
>e 250-mail.sf-mail.de
>e 250-AUTH PLAIN LOGIN
>e 250 SIZE
<e AUTH PLAIN (foobar)
>e 235 2.0.0 ok, go ahead
<e MAIL FROM:<...>
>e 250 2.1.5 sender <...> is syntactically correct
<e RCPT TO:<...>
>e 250 2.1.0 recipient <...> OK
<e DATA
>e 354 Start mail input; end with <CRLF>.<CRLF>
>e 250 2.5.0 accepted message for delivery
<e QUIT
>e 221 2.0.0 mail.sf-mail.de service closing transmission channel

If for any reasons the first connection fails (e.g. because the normal hostname is not accepted by the server) the mail will not be delivered.
Comment 3 Torgny Nyblom 2009-10-19 11:19:53 UTC
Does this still happen with a resent version of KMail?

Closing for now as the last comment is > 3 years old.
Comment 4 Rolf Eike Beer 2009-10-19 12:29:39 UTC
Seems to be fixed.