using openssl s_client with uw servers

Andrew Daviel <[email protected]> Tue, 9 Nov 2010 12:56:53 -0800 (PST)
Newsgroups gmane.mail.imap.uw.c-client
Message-ID <[email protected]>
Has anyone used openssl with UW imapd/pop3d to check certificates ?

I use it to check pop3s on port 995, and imaps on port 993. That works 
OK,e.g.

echo 0 LOGOUT|openssl s_client -showcerts -connect $host:993
echo QUIT|openssl s_client -showcerts -connect $host:995

It also supports STARTTLS, initially only in SMTP, which works with 
sendmail e.g.
echo QUIT|openssl s_client -showcerts -starttls smtp -connect $host:25

I see that it now supports STARTTLS im imap and pop3, but when I try, the 
server disconnects with an RST
(this is openssl-0.9.8e on CENTOS 5; it sends STARTTLS in imap and STLS 
in POP3, then some encrypted request I can't read in wireshark)

Clearly StartTLS is working in the server, as it works with Thunderbird 
and other clients.

Any ideas ? Do I need some particular option on the command line ?