Subject: Pine 4.44: sending mail through local sendmail with enabled TLS

From: Peter Hanecak <[email-masked]>
Date: Thu, 24 Jan 2002 09:56:25 +0100 (CET)

Hello,

yesterday I upgraded my Pine to version 4.44 and from that moment I've 
been unable to send e-mails:

                          [Sending mail |          |]

Problem detected: "Received abort signal".
Pine Exiting.

Enabling "enable-verbose-smtp-posting" (and using ^X^WY) does not reveal 
any new messages.

This crash is for sure related to fact, that my sendmail has enabled TLS 
(using openssl library and certificate signed by my own CA certificate). 
First I suspected that certificate should be signed by some "root" CA so I 
put my CA certificate info /usr/share/ssl/cert.pem but it does not help.

Only when I disabled TLS in sendmail the problem "disapeared" so now I'm 
able to post messages using pine.

Do anyone have someinformation about how to use both sendmail with TLS and 
new pine? Is this related to "*  Crash when talking to SMTP server which 
offers STARTTLS" mentioned in "Changes from Pine 4.40 to 4.41"?

BTW (maybe it is useless but maybe not), part of strace output:

...
open("/usr/share/ssl/cert.pem", O_RDONLY) = 7
fstat64(7, {st_mode=S_IFREG|0644, st_size=251330, ...}) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x4001f000
read(7, "##\n##  Extracted from the mod_ss"..., 4096) = 4096
...<reading /usr/share/ssl/cert.pem>...
read(7, "\neUBtZWdhbG9tYW4uY29tMB4XDTAxMDI"..., 4096) = 1474
brk(0x8375000)                          = 0x8375000
brk(0x8376000)                          = 0x8376000
read(7, "", 4096)                       = 0
getpid()                                = 22404
getpid()                                = 22404
getpid()                                = 22404
close(7)                                = 0
munmap(0x4001f000, 4096)                = 0
open(umovestr: Input/output error
0, O_RDONLY)                       = -1 EFAULT (Bad address)
getpid()                                = 22404
getpid()                                = 22404
getpid()                                = 22404
getpid()                                = 22404
getpid()                                = 22404
getpid()                                = 22404
time(NULL)                              = 1011794019
getpid()                                = 22404
brk(0x837c000)                          = 0x837c000
brk(0x8381000)                          = 0x8381000
brk(0x8386000)                          = 0x8386000
time(NULL)                              = 1011794019
time(NULL)                              = 1011794019
getpid()                                = 22404
getpid()                                = 22404
getpid()                                = 22404
open("/dev/urandom", O_RDONLY)          = 7
read(7, "R\354\260\310\r\303\224H>u\351Jx]\237\302\267\316\371\257"..., 
20) = 20
close(7)                                = 0
getpid()                                = 22404
getpid()                                = 22404
getuid32()                              = 500
getpid()                                = 22404
time(NULL)                              = 1011794019
getpid()                                = 22404
... now this repeats for about 30 times ...
getpid()                                = 22404
write(135419392, "\26\3\1\0S\1\0\0O\3\1<N\300c\243\311\366\243VHV\265J\5"..., 88) = -1 EBADF (Bad file descriptor)
rt_sigprocmask(SIG_SETMASK, [], [ALRM], 8) = 0
close(135419392)                        = -1 EBADF (Bad file descriptor)
close(1)                                = 0
rt_sigprocmask(SIG_BLOCK, [ALRM], [], 8) = 0
--- SIGSEGV (Segmentation fault) ---
...

Thanks in advance for any reply.

Sincerely

Peter Hanecak

-- 
===================================================================
  Peter Hanecak <[email-masked]>
  GPG pub.key: http://www.megaloman.com/gpg/hanecak-megaloman.txt
===================================================================

-- 
-----------------------------------------------------------------
 For information about this mailing list, and its archives, see: 
 http://www.washington.edu/pine/pine-info/
-----------------------------------------------------------------

---

From: Mark Crispin <[email-masked]>
Date: Mon, 28 Jan 2002 12:36:35 -0800 (PST)

> (using openssl library and certificate signed by my own CA certificate).

Hello -

Please try rebuilding your copy of Pine 4.44 after replacing your current
	pine4.44/imap/src/c-client/smtp.c
file with the version which I have attached to this message.  Make sure
that smtp.c is recompiled when doing the rebuild.

After doing this, please let me know whether or not that fixes the
problem.

-- Mark --

http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.

---

From: Peter Hanecak <[email-masked]>
Date: Tue, 29 Jan 2002 10:42:12 +0100 (CET)

Hello,

> After doing this, please let me know whether or not that fixes the

Still same. I put some ugly debuging output in imap/src/c-client/smtp.c:

            printf ("H: STARTTLS OK ...\n");     /* DEBUG */
            if (sstream = (*stls) /* TLS started, negotiate it */
                (stream->netstream->stream,mb.host,
                 NET_TLSCLIENT | (mb.novalidate ? NET_NOVALIDATECERT : NIL))) {
              printf ("H: TLS OK ...\n");	/* DEBUG */

and output is like this:

H: SMTP greeting OK ...   [Sending mail |          |]
                       H: STARTTLS OK ...

so maybe the problem is in:

if (sstream = (*stls) /* TLS started, negotiate it */
                (stream->netstream->stream,mb.host,
                 NET_TLSCLIENT | (mb.novalidate ? NET_NOVALIDATECERT : NIL))) {

???

Sincerely

Peter

---

From: Peter Hanecak <[email-masked]>
Date: Tue, 29 Jan 2002 11:38:35 +0100 (CET)

Hello again,

> After doing this, please let me know whether or not that fixes the

after furher "investigation" I can write this:

1) 'reason' in imap/c-client/ssl_unix.c in ssl_start() is set to non null 
value: "SSL negotiation failed" - SSL_write() in ssl_start_work() fails 
...

2) ... that's why imap/c-client/ssl_unix.c:ssl_abort() is called and in 
'tcp_close  (stream->tcpstream);' signal is received.

Sincerely

Peter