* bug#7438: 23.2; [PATCH] lisp/gnus/pop3.el fix STLS command ordering
@ 2010-11-18 22:59 Yuri Karaban
2010-11-19 16:25 ` Chong Yidong
0 siblings, 1 reply; 2+ messages in thread
From: Yuri Karaban @ 2010-11-18 22:59 UTC (permalink / raw)
To: 7438
[-- Attachment #1: Type: text/plain, Size: 790 bytes --]
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!
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: pop3.el-stls-order.patch --]
[-- Type: text/x-patch, Size: 1151 bytes --]
--- 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
[-- Attachment #3: Type: text/plain, Size: 27 bytes --]
--
Citius Altius Fortius
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#7438: 23.2; [PATCH] lisp/gnus/pop3.el fix STLS command ordering
2010-11-18 22:59 bug#7438: 23.2; [PATCH] lisp/gnus/pop3.el fix STLS command ordering Yuri Karaban
@ 2010-11-19 16:25 ` Chong Yidong
0 siblings, 0 replies; 2+ messages in thread
From: Chong Yidong @ 2010-11-19 16:25 UTC (permalink / raw)
To: Yuri Karaban; +Cc: 7438
Yuri Karaban <tech@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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-11-19 16:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-18 22:59 bug#7438: 23.2; [PATCH] lisp/gnus/pop3.el fix STLS command ordering Yuri Karaban
2010-11-19 16:25 ` Chong Yidong
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.