Gnus v5.8.8
XEmacs 21.4 (patch 4) "Artificial Intelligence" [Lucid] (i686-pc-linux, Mule) of
Wed Aug 29 2001 on
two-places-at-once.mit.edu
200
senator-bedfellow.mit.edu NNRP Service Ready - usenet(a)mit.edu (posting ok).
Any IMAP command containing a literal that contains newlines will fail
when using nnimap with an nnimap-stream of "gssapi". (APPEND is a good
example of a command that will fail.) This is because the literal
length is miscomputed.
First, the fix; make imap-gssapi-open match imap-kerberos4-open in this way:
--- imap.el 2002/04/03 07:42:18 1.1
+++ imap.el 2002/04/03 07:45:13
@@ -520,7 +520,8 @@
response)
(when process
(with-current-buffer buffer
- (setq imap-client-eol "\n")
+ (setq imap-client-eol "\n"
+ imap-calculate-literal-size-first t)
(while (and (memq (process-status process) '(open run))
(goto-char (point-min))
;; cyrus 1.6.x (13? < x <= 22) queries capabilities
Now, the background. "imtest" is a horrible, evil, unholy program that
hates me. It calls up my mother at 3am and swears at her. It
murdered my cat. It's *that* bad.
IMAP specifies that newlines are canonicalized to \r\n. imtest requires
that its input lines be terminated with \n, because it uses fgets().
(I suppose this is actually platform specific and Gnus and imtest would
lose in more interesting ways on non-Unix platforms, if they ran there.)
imtest then does a \n to \r\n translation on what it's read.
This means that any program that uses imtest and sends literals needs
to send any newlines as \n but count them as 2 characters when computing
the literal length.
Gnus likes to construct proper IMAP messages (with \r\n) but is smart
enough to know that imtest wants \n, and translates the buffer before
sending it to imtest. (That's the (setq imap-client-eol "\n") bit.)
However, unless you tell it (setq imap-calculate-literal-size-first
t), it gets the length wrong because it calculates the length after
translating, forgetting that imtest will translate back.
This obviously bit someone long ago on kerberos4 auth, because that
code does the right thing. But that right thing never got copied to
the GSSAPI code.
Oh, by the way, remember how I said that imtest uses fgets()? It uses
a 2k buffer there. Which means that if you ever try to send a line
longer than 2K, imtest will insert spurious newlines in it, and you're
just fucked.
Isn't this fun?
--Jered