Subject: smtp transport looping with tls

From: Alexey Gadzhiev <[email-masked]>
Date: Thu, 19 Dec 2002 14:47:34 +0300

Hello!

I get this with latest CVS zmailer and openssl 0.9.6h or 0.9.5. Linux 
redhat 6.2. Probably this is happend after error in ssl handshake.  I 
can reproduce the error with broken smtp server sertificate.

Looping inside  smtp_sync after lebel reread_line:
smtp_nbread returns -1 with errno == 1
then inside "if (!nonblocking && len < 0)"
  select_sleep returns 0	and goto reread_line:

I feel  smtp should not continue the loop after error
in smtp_nbread/SSL_read other then EAGAIN or something...

smtp log:

  smtp_sync() did yield code 0/OK (rcptstates = 0x0)
--> EHLO rc=0 demand_TLS_mode=0 tls_available=1 STARTTLS
STARTTLS
  smtp_sfwrite() to write 10 bytes
220 Ready to start TLS
  smtp_sync() did yield code 0/OK (rcptstates = 0x0)
# setting up TLS connection
# SSL_connect:before/connect initialization
# write to 0808EC98 [0809F3E0] (114 bytes => 114 (0x72))
# 0000 80 70 01 03 01 00 57 00|00 00 10 00 00 16 00 00  .p....W. ........
# 0010 13 00 00 0a 07 00 c0 00|00 66 00 00 07 00 00 05  ........ .f......
# 0020 00 00 04 05 00 80 03 00|80 01 00 80 08 00 80 00  ........ ........
# 0030 00 65 00 00 64 00 00 63|00 00 62 00 00 61 00 00  .e..d..c ..b..a..

# 0040 60 00 00 15 00 00 12 00|00 09 06 00 40 00 00 14  `....... ....@...
# 0050 00 00 11 00 00 08 00 00|06 00 00 03 04 00 80 02  ........ ........
# 0060 00 80 74 96 01 b5 9f f0|ed e1 ef 81 85 6c a2 51  ..t..... .....l.Q
# 0070 f0 5f     ._
# SSL_connect:SSLv2/v3 write client hello A
# read from 0808EC98 [080A4940] (7 bytes => -1 (0xFFFFFFFF))
# SSL_connect:error in SSLv2/v3 read server hello A
# read from 0808EC98 [080A4940] (7 bytes => 0 (0x0))
# TLS connection established: TLSv1 with cipher (NONE) (0/0 bits)
  TLS mode running successfully!
  TLS cipher: (NONE)
  TLS protocol: TLSv1
  TLS cipher bits: 0 in use: 0
  TLS peer CN-1:             <>
  TLS peer cert issuer name: <>
  Cert not valid Before:     <>
  Cert not valid After:      <>
EHLO alg.yandex.ru
  smtp_sfwrite() to write 20 bytes
# read from 0808EC98 [080A4940] (7 bytes => 0 (0x0))
smtp; 500 (write to server error: Operation not permitted)
# read from 0808EC98 [080A4940] (7 bytes => 0 (0x0))
# smtp_nbread() rc=-1 errno=1
# read from 0808EC98 [080A4940] (7 bytes => 0 (0x0))
# smtp_nbread() rc=-1 errno=1
# read from 0808EC98 [080A4940] (7 bytes => 0 (0x0))
# smtp_nbread() rc=-1 errno=1

  ... And so on...

strace:

Looping in:
....
time(NULL)                              = 1040294759
getpid()                                = 8749
read(6, "", 7)                          = 0
time([1040294759])                      = 1040294759
write(3, "08749A089-0550-0734#\tread from 0"..., 72) = 72
getpid()                                = 8749
getpid()                                = 8749
time([1040294759])                      = 1040294759
write(3, "08749A089-0551-0734#\tsmtp_nbread"..., 49) = 49
time([1040294759])                      = 1040294759
select(7, [6], [], NULL, {0, 0})        = 1 (in [6], left {0, 0})
time(NULL)                              = 1040294759
getpid()                                = 8749
read(6, "", 7)                          = 0
time([1040294759])                      = 1040294759
write(3, "08749A089-0552-0734#\tread from 0"..., 72) = 72
getpid()                                = 8749
getpid()                                = 8749
time([1040294759])                      = 1040294759
write(3, "08749A089-0553-0734#\tsmtp_nbread"..., 49) = 49
time([1040294759])                      = 1040294759
select(7, [6], [], NULL, {0, 0})        = 1 (in [6], left {0, 0})
...

-
To unsubscribe from this list: send the line "unsubscribe zmailer" in
the body of a message to [email-masked]