Subject: bug#7438: 23.2; [PATCH] lisp/gnus/pop3.el fix STLS command ordering

From: Chong Yidong <[email-masked]>
Date: Fri, 19 Nov 2010 11:25:27 -0500

Yuri Karaban <[email-masked]> writes:

> Starttls (STLS) is not working with pop3.
>
> There is a bug in current implementation.
>
> Current implementation sends STLS just after opening connection.
>
> As result connection hangs (pop3.el tries to read a greeting message
> after STLS, but all POP3 servers I tried does not send anything after
> successful negotiation). On other hand, ignoring server greeting leads
> to mistreating server greeting (+OK <timestamp>) as successful response
> to STLS command. In this case negotiation starts too early (before
> reading real response to STLS).
>
> I've attached a patch which fixes the problem. The server greeting got
> read first (as with plain POP3) and only after receiving greeting STLS
> issued and TLS negotiation starts.
>
> I hope much this would be fixed in next minor release of emacs.

Looks reasonable.  I've checked your patch into the emacs-23 branch.
Thanks.