GNU bug report logs - #7438
23.2; [PATCH] lisp/gnus/pop3.el fix STLS command ordering

Previous Next

Packages: emacs, gnus;

Reported by: Yuri Karaban <tech <at> askold.net>

Date: Thu, 18 Nov 2010 23:08:01 UTC

Severity: normal

Tags: patch

Found in version 23.2

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 7438 in the body.
You can then email your comments to 7438 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#7438; Package emacs. (Thu, 18 Nov 2010 23:08:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Yuri Karaban <tech <at> askold.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 18 Nov 2010 23:08:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Yuri Karaban <tech <at> askold.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 23.2; [PATCH] lisp/gnus/pop3.el fix STLS command ordering
Date: Fri, 19 Nov 2010 00:59:54 +0200
[Message part 1 (text/plain, inline)]
Hi

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.

Thanks!

[pop3.el-stls-order.patch (text/x-patch, inline)]
--- pop3.el.orig	2010-04-04 01:26:09.000000000 +0300
+++ pop3.el	2010-11-19 00:21:53.106967116 +0200
@@ -261,12 +261,6 @@
 		  (setq port 110))
 	      (let ((process (starttls-open-stream "POP" (current-buffer)
 						   mailhost (or port 110))))
-		(pop3-send-command process "STLS")
-		(let ((response (pop3-read-response process t)))
-		  (if (and response (string-match "+OK" response))
-		      (starttls-negotiate process)
-		    (pop3-quit process)
-		    (error "POP server doesn't support starttls")))
 		process))
 	     (t 
 	      (open-network-stream "POP" (current-buffer) mailhost port))))
@@ -274,6 +268,13 @@
 	(setq pop3-timestamp
 	      (substring response (or (string-match "<" response) 0)
 			 (+ 1 (or (string-match ">" response) -1)))))
+      (when (eq pop3-stream-type 'starttls)
+        (pop3-send-command process "STLS")
+        (let ((response (pop3-read-response process t)))
+          (if (and response (string-match "+OK" response))
+              (starttls-negotiate process)
+            (pop3-quit process)
+            (error "POP server doesn't support starttls"))))
       process)))
 
 ;; Support functions
[Message part 3 (text/plain, inline)]
-- 
Citius Altius Fortius

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#7438; Package emacs,gnus. (Fri, 19 Nov 2010 16:21:02 GMT) Full text and rfc822 format available.

Message #8 received at 7438 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Yuri Karaban <tech <at> askold.net>
Cc: 7438 <at> debbugs.gnu.org
Subject: Re: bug#7438: 23.2;
	[PATCH] lisp/gnus/pop3.el fix STLS command ordering
Date: Fri, 19 Nov 2010 11:25:27 -0500
Yuri Karaban <tech <at> askold.net> 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.




bug closed, send any further explanations to Yuri Karaban <tech <at> askold.net> Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> debbugs.gnu.org. (Fri, 19 Nov 2010 16:21:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 18 Dec 2010 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 14 years and 190 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.