From unknown Sat Jun 21 03:21:33 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#8988 <8988@debbugs.gnu.org> To: bug#8988 <8988@debbugs.gnu.org> Subject: Status: 24.0.50; [PATCH] pop3-open-server fails to parse response to CAPA Reply-To: bug#8988 <8988@debbugs.gnu.org> Date: Sat, 21 Jun 2025 10:21:33 +0000 retitle 8988 24.0.50; [PATCH] pop3-open-server fails to parse response to C= APA reassign 8988 emacs submitter 8988 Wolfgang Jenkner severity 8988 normal tag 8988 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 02 22:44:00 2011 Received: (at submit) by debbugs.gnu.org; 3 Jul 2011 02:44:00 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QdCfA-0004l4-2i for submit@debbugs.gnu.org; Sat, 02 Jul 2011 22:44:00 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QdCf8-0004kt-22 for submit@debbugs.gnu.org; Sat, 02 Jul 2011 22:43:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QdCf1-0000oB-BC for submit@debbugs.gnu.org; Sat, 02 Jul 2011 22:43:52 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:45892) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QdCf0-0000o0-Uo for submit@debbugs.gnu.org; Sat, 02 Jul 2011 22:43:51 -0400 Received: from eggs.gnu.org ([140.186.70.92]:45237) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QdCez-0004y2-FG for bug-gnu-emacs@gnu.org; Sat, 02 Jul 2011 22:43:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QdCex-0000nm-NJ for bug-gnu-emacs@gnu.org; Sat, 02 Jul 2011 22:43:49 -0400 Received: from mx12.lb01.inode.at ([62.99.145.14]:39765 helo=mx.inode.at) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QdCex-0000na-3D for bug-gnu-emacs@gnu.org; Sat, 02 Jul 2011 22:43:47 -0400 Received: from [85.127.18.8] (port=9744 helo=iznogoud.viz) by smartmx-12.inode.at with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1QdCes-0004ZC-K7; Sun, 03 Jul 2011 04:43:43 +0200 Received: from wolfgang by iznogoud.viz with local (Exim 4.76 (FreeBSD)) (envelope-from ) id 1QdCeq-00069p-8J; Sun, 03 Jul 2011 04:43:40 +0200 From: Wolfgang Jenkner To: bug-gnu-emacs@gnu.org Subject: 24.0.50; [PATCH] pop3-open-server fails to parse response to CAPA Date: Sun, 03 Jul 2011 04:33:11 +0200 Mail-Followup-To: bug-gnu-emacs@gnu.org, larsi@gnus.org Message-ID: <85sjqo5bj7.fsf@iznogoud.viz> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -4.1 (----) X-Debbugs-Envelope-To: submit Cc: larsi@gnus.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.5 (----) When I evaluate (progn (load "pop3.el") (trace-function-background 'open-protocol-stream) (let ((pop3-stream-type 'starttls)) (ignore-errors (pop3-open-server "pop.gmx.com" 110)))) buffer *trace-output* contains ====================================================================== 1 -> open-protocol-stream: name="POP" buffer=# host="pop.gmx.com" service=110 parameters=(:type starttls :capability-command "CAPA " :end-of-command "^\\.? \\|^\\(-ERR\\|+OK \\).* " :success "^\\+OK.* " :return-list t :starttls-function (lambda (capabilities) (and (string-match "\\bSTLS\\b" capabilities) "STLS "))) 1 <- open-protocol-stream: (nil :greeting "+OK POP server ready H migmx003 " :capabilities "+OK Capability list follows " :type plain :error "Server does not support TLS") However, in the shell $ telnet pop.gmx.com 110 Trying 212.227.17.187... Connected to pop.gmx.com. Escape character is '^]'. +OK POP server ready H migmx007 CAPA +OK Capability list follows TOP USER UIDL STLS SASL PLAIN IMPLEMENTATION trinity . QUIT +OK POP server signing off Connection closed by foreign host. $ So it seems that "+OK Capability list follows" arrived in a separate chunk and was matched by the second alternative of the regexp specified for :end-of-command in pop3-open-server before the actual capability list followed and the regexp's first alternative had a chance to match. (I haven't tested this theory, though, since it seems valid as a theoretical possibility anyway :-) I include ChangeLog entries and patches for lisp/gnus/pop3.el and lisp/net/network-stream.el (I could also send a bzr bundle, but given that most of lisp/gnus is merged from the main Gnus repository this doesn't seem too practical). Wolfgang 2011-07-03 Wolfgang Jenkner * net/network-stream.el (open-network-stream) (network-stream-open-starttls, network-stream-open-tls) (network-stream-open-shell): New parameter :end-of-capability, like :end-of-command but matches the end of the response to a :capability-command query. 2011-07-03 Wolfgang Jenkner * pop3.el (pop3-open-server): Use :end-of-capability. === modified file 'lisp/net/network-stream.el' --- lisp/net/network-stream.el 2011-06-27 00:11:22 +0000 +++ lisp/net/network-stream.el 2011-07-02 23:38:45 +0000 @@ -98,6 +98,10 @@ :end-of-command specifies a regexp matching the end of a command. +:end-of-capability specifies a regexp matching the end of the + response to the command specified for :capability-command. + It defaults to the regexp specified for :end-of-command. + :success specifies a regexp matching a message indicating a successful STARTTLS negotiation. For instance, the default should be \"^3\" for an NNTP connection. @@ -129,6 +133,10 @@ asynchronously, if possible." (unless (featurep 'make-network-process) (error "Emacs was compiled without networking support")) + ;; (unless (plist-get parameters :end-of-capability) + ;; (setq parameters (plist-put parameters + ;; :end-of-capability + ;; (plist-get parameters :end-of-command)))) (let ((type (plist-get parameters :type)) (return-list (plist-get parameters :return-list))) (if (and (not return-list) @@ -203,11 +211,12 @@ (success-string (plist-get parameters :success)) (capability-command (plist-get parameters :capability-command)) (eoc (plist-get parameters :end-of-command)) + (eo-capa (or (plist-get parameters :end-of-capability) eoc)) ;; Return (STREAM GREETING CAPABILITIES RESULTING-TYPE) (stream (make-network-process :name name :buffer buffer :host host :service service)) (greeting (network-stream-get-response stream start eoc)) - (capabilities (network-stream-command stream capability-command eoc)) + (capabilities (network-stream-command stream capability-command eo-capa)) (resulting-type 'plain) (builtin-starttls (and (fboundp 'gnutls-available-p) (gnutls-available-p))) @@ -250,7 +259,7 @@ ;; Requery capabilities for protocols that require it; i.e., ;; EHLO for SMTP. (when (plist-get parameters :always-query-capabilities) - (network-stream-command stream capability-command eoc))) + (network-stream-command stream capability-command eo-capa))) (when (string-match success-string (network-stream-command stream starttls-command eoc)) ;; The server said it was OK to begin STARTTLS negotiations. @@ -271,7 +280,7 @@ (network-stream-get-response stream start eoc))) ;; Re-get the capabilities, which may have now changed. (setq capabilities - (network-stream-command stream capability-command eoc)))) + (network-stream-command stream capability-command eo-capa)))) ;; If TLS is mandatory, close the connection if it's unencrypted. (when (and (or require-tls @@ -320,7 +329,8 @@ 'open-gnutls-stream 'open-tls-stream) name buffer host service)) - (eoc (plist-get parameters :end-of-command))) + (eoc (plist-get parameters :end-of-command)) + (eo-capa (or (plist-get parameters :end-of-capability) eoc))) (if (null stream) (list nil nil nil 'plain) ;; If we're using tls.el, we have to delete the output from @@ -335,13 +345,14 @@ (let* ((capability-command (plist-get parameters :capability-command))) (list stream (network-stream-get-response stream start eoc) - (network-stream-command stream capability-command eoc) + (network-stream-command stream capability-command eo-capa) 'tls)))))) (defun network-stream-open-shell (name buffer host service parameters) (require 'format-spec) (let* ((capability-command (plist-get parameters :capability-command)) (eoc (plist-get parameters :end-of-command)) + (eo-capa (or (plist-get parameters :end-of-capability) eoc)) (start (with-current-buffer buffer (point))) (stream (let ((process-connection-type nil)) (start-process name buffer shell-file-name @@ -353,7 +364,7 @@ ?p service)))))) (list stream (network-stream-get-response stream start eoc) - (network-stream-command stream capability-command eoc) + (network-stream-command stream capability-command eo-capa) 'plain))) (provide 'network-stream) === modified file 'lisp/gnus/pop3.el' --- lisp/gnus/pop3.el 2011-05-30 22:11:52 +0000 +++ lisp/gnus/pop3.el 2011-07-02 23:38:45 +0000 @@ -306,7 +306,12 @@ (t (or pop3-stream-type 'network))) :capability-command "CAPA\r\n" - :end-of-command "^\\.\r?\n\\|^\\(-ERR\\|+OK \\).*\n" + :end-of-command "^\\(-ERR\\|+OK \\).*\n" + ;; As it happens, the regexp above also matches the first + ;; line of the response to CAPA, which might arrive in + ;; a separate chunk, with the actual capabilities + ;; following later. + :end-of-capability "^\\.\r?\n" :success "^\\+OK.*\n" :return-list t :starttls-function From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 03 09:52:19 2011 Received: (at submit) by debbugs.gnu.org; 3 Jul 2011 13:52:19 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QdN5v-0007fa-7O for submit@debbugs.gnu.org; Sun, 03 Jul 2011 09:52:19 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QdN5t-0007fO-2c for submit@debbugs.gnu.org; Sun, 03 Jul 2011 09:52:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QdN5n-0002I0-7O for submit@debbugs.gnu.org; Sun, 03 Jul 2011 09:52:11 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:41134) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QdN5m-0002Hq-SY for submit@debbugs.gnu.org; Sun, 03 Jul 2011 09:52:10 -0400 Received: from eggs.gnu.org ([140.186.70.92]:56103) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QdN5k-0000Pj-O3 for bug-gnu-emacs@gnu.org; Sun, 03 Jul 2011 09:52:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QdN5h-0002H0-Sv for bug-gnu-emacs@gnu.org; Sun, 03 Jul 2011 09:52:08 -0400 Received: from hermes.netfonds.no ([80.91.224.195]:41692) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QdN5h-0002GS-Au for bug-gnu-emacs@gnu.org; Sun, 03 Jul 2011 09:52:05 -0400 Received: from cm-84.215.51.58.getinternet.no ([84.215.51.58] helo=quimbies.gnus.org) by hermes.netfonds.no with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1QdN5Z-0000R9-UL for bug-gnu-emacs@gnu.org; Sun, 03 Jul 2011 15:51:57 +0200 From: Lars Magne Ingebrigtsen To: bug-gnu-emacs@gnu.org Subject: Re: 24.0.50; [PATCH] pop3-open-server fails to parse response to CAPA In-Reply-To: <85sjqo5bj7.fsf@iznogoud.viz> (Wolfgang Jenkner's message of "Sun, 03 Jul 2011 04:33:11 +0200") Date: Sun, 03 Jul 2011 15:51:55 +0200 Message-ID: References: <85sjqo5bj7.fsf@iznogoud.viz> User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux) Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAElBMVEUEAQBROzUNCAaOdGOu noza1sHh7llOAAACV0lEQVQ4jU2UQWLjIAxFZdIDDMbdg5zZDwYfIAYfIDHc/yr9Eum0LJwE8fjS lxyiX2tKtSYb8Cwznb23ruuij95qxbeW8kH2Z9Eq8VYynocSKe2yQ397V6IOwqWUrCt5o1vX3ToI nE8JJ1tTDbmhWgdC9lM+e5vprklUEQFRoJBOzeoup3svztoNGnIcO1GJlmp7E70qPwit40qi4TT3 Gq0dhKbf20ZZz39raFYif5DkA2+sEB+ISqk9FxDnOQzqT/qoKe7fXmVsS8opRdG49NIMjaWOJcQd nxLAORD4ocVHS5+jQCkGBVbEJVofZkc+YkKxadgu2yXFG4RLnKMNV5opIFG5CcSaa06WZzIhv4So QyY6EHXmaHkBwYJos6LLonzWyGF/0q7DoOL8KXVqUVY0GCuoJWFXo3ABCPFqjM8Tw4BW5MIsp0Rh Zl00VR9qjmQWnMp1WKjExT7nB5ED4cSMQdH6cEdGpuazvxB4OydEy1dFbSaE34THiGYdCr5jGKS2 rIxkJXLzNBvPIi4FYTEtve3demJ5J3gYgvhzggnuyT+vi5enIdx0Xu5FwY+fdHukvEVH0sBHPczq jdfAKgbWQrRfS6v/2L4vM8VGu+B9ouW4l3Pj7X2zyY96YpLxjQF3O39rBHQZkJy7oaCX3OQRYKNh WX4tyW3Mft0YlgzbNRIs2prQDx5TIh1Pqukl6NdoZsrqBxAtk9kk66c/t0MJZeKIrMGz8dM8TFTG apqwdkZ62/+/DCcjQ8aYzSBzo0Qp2qsU2UMjEgKTpkL8nhKWVrC2g78A1IjJ0jxbx2cAAAAASUVO RK5CYII= X-Now-Playing: Siouxsie and the Banshees's _Kaleidoscope_: "Desert Kisses" X-Hashcash: 1:23:110703:bug-gnu-emacs@gnu.org::bjakmi/SqT8mXQFm:0000000000000000000000000000000000000000qNeC MIME-Version: 1.0 Content-Type: text/plain X-MailScanner-ID: 1QdN5Z-0000R9-UL X-Netfonds-MailScanner: Found to be clean X-Netfonds-MailScanner-From: larsi@gnus.org MailScanner-NULL-Check: 1310305918.09798@mWD8AbpfRGTbYLt3Q68vDA X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -4.8 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.8 (----) Wolfgang Jenkner writes: > So it seems that "+OK Capability list follows" arrived in a separate > chunk and was matched by the second alternative of the regexp specified > for :end-of-command in pop3-open-server before the actual capability > list followed and the regexp's first alternative had a chance to match. > (I haven't tested this theory, though, since it seems valid as > a theoretical possibility anyway :-) I think you're totally right. I've applied parts of your patch to Emacs 24/No Gnus, and redid other parts slight. Thanks for the bug fix. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog http://lars.ingebrigtsen.no/ From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 25 17:50:11 2011 Received: (at control) by debbugs.gnu.org; 25 Sep 2011 21:50:11 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R7waP-0007qx-Ji for submit@debbugs.gnu.org; Sun, 25 Sep 2011 17:50:11 -0400 Received: from hermes.netfonds.no ([80.91.224.195]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1R7waN-0007qq-FL for control@debbugs.gnu.org; Sun, 25 Sep 2011 17:50:07 -0400 Received: from cm-84.215.51.58.getinternet.no ([84.215.51.58] helo=stories.gnus.org) by hermes.netfonds.no with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1R7wZd-00058p-JI for control@debbugs.gnu.org; Sun, 25 Sep 2011 23:49:21 +0200 Date: Sun, 25 Sep 2011 23:49:20 +0200 Message-Id: To: control@debbugs.gnu.org From: Lars Magne Ingebrigtsen Subject: control message for bug #8988 X-MailScanner-ID: 1R7wZd-00058p-JI X-Netfonds-MailScanner: Found to be clean X-Netfonds-MailScanner-From: larsi@gnus.org MailScanner-NULL-Check: 1317592162.00449@7myj44EgfjnPl1tqw+VxpA X-Spam-Status: No X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) close 8988 24.1 From unknown Sat Jun 21 03:21:33 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 24 Oct 2011 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator