From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Yuri Karaban Newsgroups: gmane.emacs.bugs Subject: bug#7438: 23.2; [PATCH] lisp/gnus/pop3.el fix STLS command ordering Date: Fri, 19 Nov 2010 00:59:54 +0200 Message-ID: <874obe44r9.fsf@askold.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1290122077 5058 80.91.229.12 (18 Nov 2010 23:14:37 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 18 Nov 2010 23:14:37 +0000 (UTC) To: 7438@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Nov 19 00:14:30 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PJDgS-0003lA-60 for geb-bug-gnu-emacs@m.gmane.org; Fri, 19 Nov 2010 00:14:28 +0100 Original-Received: from localhost ([127.0.0.1]:49530 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PJDgR-0001Nq-QQ for geb-bug-gnu-emacs@m.gmane.org; Thu, 18 Nov 2010 18:14:27 -0500 Original-Received: from [140.186.70.92] (port=59049 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PJDgN-0001NW-1o for bug-gnu-emacs@gnu.org; Thu, 18 Nov 2010 18:14:24 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PJDgL-0004c7-Md for bug-gnu-emacs@gnu.org; Thu, 18 Nov 2010 18:14:22 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:35086) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PJDgL-0004bu-Gn for bug-gnu-emacs@gnu.org; Thu, 18 Nov 2010 18:14:21 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1PJDaD-0007nY-RW; Thu, 18 Nov 2010 18:08:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Yuri Karaban Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 18 Nov 2010 23:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 7438 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.129012163529960 (code B ref -1); Thu, 18 Nov 2010 23:08:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 18 Nov 2010 23:07:15 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PJDZS-0007nA-9O for submit@debbugs.gnu.org; Thu, 18 Nov 2010 18:07:14 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PJDNY-0007hy-JS for submit@debbugs.gnu.org; Thu, 18 Nov 2010 17:54:57 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PJDST-0002P7-EX for submit@debbugs.gnu.org; Thu, 18 Nov 2010 18:00:02 -0500 Original-Received: from lists.gnu.org ([199.232.76.165]:47524) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PJDST-0002P3-CT for submit@debbugs.gnu.org; Thu, 18 Nov 2010 18:00:01 -0500 Original-Received: from [140.186.70.92] (port=40723 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PJDSS-0008HR-AM for bug-gnu-emacs@gnu.org; Thu, 18 Nov 2010 18:00:01 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PJDSQ-0002Oh-S7 for bug-gnu-emacs@gnu.org; Thu, 18 Nov 2010 18:00:00 -0500 Original-Received: from askold.net ([173.203.215.26]:56436) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PJDSQ-0002OW-Oq for bug-gnu-emacs@gnu.org; Thu, 18 Nov 2010 17:59:58 -0500 Original-Received: from [93.73.241.34] (helo=sun) by askold.net with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1PJDSP-0000bI-2V for bug-gnu-emacs@gnu.org; Thu, 18 Nov 2010 22:59:57 +0000 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Mailman-Approved-At: Thu, 18 Nov 2010 18:07:13 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Thu, 18 Nov 2010 18:08:01 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:41741 Archived-At: --=-=-= 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 ) 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! --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=pop3.el-stls-order.patch --- 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 --=-=-= -- Citius Altius Fortius --=-=-=--