Gnus development mailing list
 help / color / mirror / Atom feed
From: "Steven E. Harris" <seh@panix.com>
To: ding@gnus.org
Subject: Re: nnimap with openssl stopping up after connecting in Windows
Date: Sun, 23 Nov 2008 20:38:05 -0500	[thread overview]
Message-ID: <833ahh3nud.fsf@torus.sehlabs.com> (raw)
In-Reply-To: <utz9zd2j0.fsf_-_@dod.no>

Steinar Bang <sb@dod.no> writes:

> Steven thinks the solution lies in setting the coding system for the
> buffer where nnimaps reads the server responses (perhaps to
> undecided-unix...?), but he hasn't yet figured out to do it.

Right. I note that the lines being read from the remote IMAP server show
up in the IMAP process buffer with ^M glyphs at the end. Looking at
these lines in hexl mode, I can see that Emacs has each line ending with

  CR CR LF

That suggests some conflicting assumptions about line endings, maybe
with two steps of conversion going on among the programs involved:

  starttls (Cygwin) -> Emacs (Windows)

That is, the Emacs is a Windows build, but it's calling on starttls
built for Cygwin. I would expect that this starttls would emit lines per
the Unix convention, or maybe it transparently passes through what the
server sends.

The IMAP specification shows line ending with CRLF pairs. If that's what
the server is sending, then I suspect that Emacs reading from starttls
is doing some erroneous line conversion and adding in the extra CR
before the server's CRLF pair.

Here's what Emacs shows in its *imap-log* buffer, sanitized a little:

,----[ *imap-log* buffer ]
| * OK [CAPABILITY IMAP4rev1 SASL-IR SORT THREAD=REFERENCES MULTIAPPEND UNSELECT LITERAL+ IDLE CHILDREN NAMESPACE LOGIN-REFERRALS QUOTA STARTTLS AUTH=PLAIN AUTH=LOGIN] Dovecot ready.
| 1 CAPABILITY
| * CAPABILITY IMAP4rev1 SASL-IR SORT THREAD=REFERENCES MULTIAPPEND UNSELECT LITERAL+ IDLE CHILDREN NAMESPACE LOGIN-REFERRALS QUOTA STARTTLS AUTH=PLAIN AUTH=LOGIN
| 1 OK Capability completed.
| 1 STARTTLS
| * OK [CAPABILITY IMAP4rev1 SASL-IR SORT THREAD=REFERENCES MULTIAPPEND UNSELECT LITERAL+ IDLE CHILDREN NAMESPACE LOGIN-REFERRALS QUOTA STARTTLS AUTH=PLAIN AUTH=LOGIN] Dovecot ready.
| 1 OK Begin TLS negotiation now.
| 2 LOGOUT
| * BYE Logging out
| 2 OK Logout completed.
| 2 CAPABILITY
| 3 LOGIN "seh" "mypassword"
`----

And from the *Messages* buffer:

,----[ *Messages* buffer ]
| Checking new news...
| Opening nnimap server on panix...
| imap: Connecting to mail.panix.com...
| Waiting for response from mail.panix.com...done
| imap: Reconnecting with stream `starttls'...
| Loading starttls...done
| imap: Connecting with STARTTLS...done
| Waiting for response from mail.panix.com...done
| imap: Reconnecting with stream `starttls'...done
| Parsing authinfo file `~/.authinfo'.
| imap: Authenticating to `mail.panix.com' using `login'...
| imap: Plaintext authentication...
| Unable to open server due to: Process imap<1> not running
| Unable to open nnimap:panix, go offline? (y or n) 
| Opening nnimap server on panix...failed
`----

Per the "2 LOGOUT" command above, it looks like the client closes the
connection, and /then/ issues the LOGIN command. I'm not sure why. Or
maybe that LOGOUT is required once the TLS negotiation is complete,
after which the LOGIN command is appropriate.

Here's a similar *imap-log* buffer from a successful login with a Cygwin
XEmacs build (actual ^M characters are replaced here with the character
sequence "^M"):

,----[ *imap-log* buffer (Cygwin) ]
| * OK [CAPABILITY IMAP4rev1 SASL-IR SORT THREAD=REFERENCES MULTIAPPEND UNSELECT LITERAL+ IDLE CHILDREN NAMESPACE LOGIN-REFERRALS QUOTA STARTTLS AUTH=PLAIN AUTH=LOGIN] Dovecot ready.
| 1 CAPABILITY^M
| * CAPABILITY IMAP4rev1 SASL-IR SORT THREAD=REFERENCES MULTIAPPEND UNSELECT LITERAL+ IDLE CHILDREN NAMESPACE LOGIN-REFERRALS QUOTA STARTTLS AUTH=PLAIN AUTH=LOGIN^M
| 1 OK Capability completed.^M
| 1 STARTTLS^M
| * OK [CAPABILITY IMAP4rev1 SASL-IR SORT THREAD=REFERENCES MULTIAPPEND UNSELECT LITERAL+ IDLE CHILDREN NAMESPACE LOGIN-REFERRALS QUOTA STARTTLS AUTH=PLAIN AUTH=LOGIN] Dovecot ready.^M
| 1 OK Begin TLS negotiation now.^M
| 2 NOOP^M
| 2 OK NOOP completed.^M
| 3 LOGOUT^M
| * BYE Logging out^M
| 3 OK Logout completed.^M
| 2 NOOP^M
| 2 OK NOOP completed.^M
| 3 CAPABILITY^M
| * CAPABILITY IMAP4rev1 SASL-IR SORT THREAD=REFERENCES MULTIAPPEND UNSELECT LITERAL+ IDLE CHILDREN NAMESPACE LOGIN-REFERRALS QUOTA AUTH=PLAIN AUTH=LOGIN^M
| 3 OK Capability completed.^M
| 4 LOGIN "seh" "mypassword"^M
| 4 OK Logged in.^M
| 5 NOOP^M
| 5 OK NOOP completed.^M
| 6 STATUS "INBOX" (UIDVALIDITY UIDNEXT UNSEEN)^M
| * STATUS "INBOX" (UIDNEXT 18324 UIDVALIDITY 1067275254 UNSEEN 0)^M
| 6 OK Status completed.^M
`----

Note here the NOOP commands and the LOGOUT followed by another
CAPABILITY, finally followed by the LOGIN command. There's more
cause-and-effect chatter evident here, whereas the first transcript
above looks more like two parties talking but not hearing one another.

I hope someone more familiar with nnimap, process control, and coding
systems can chime with suggestions for further investigation.

-- 
Steven E. Harris



  parent reply	other threads:[~2008-11-24  1:38 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-19 11:56 Vista, secure imap and firewalls? Steinar Bang
2008-11-19 17:37 ` Steinar Bang
2008-11-22 18:44   ` nnimap with openssl stopping up after connecting in Windows (Was: Vista, secure imap and firewalls?) Steinar Bang
2008-11-22 23:37     ` nnimap with openssl stopping up after connecting in Windows Steinar Bang
2008-11-24  9:12       ` Steinar Bang
2008-11-24  1:38     ` Steven E. Harris [this message]
2008-11-24 10:09       ` Simon Josefsson
2008-11-24 11:13         ` Steinar Bang
2008-12-11 20:46           ` When and how to look in ' *nnimap* ' buffers? (Was: nnimap with openssl stopping up after connecting in Windows) Steinar Bang
2008-12-21 18:34           ` nnimap with openssl stopping up after connecting in Windows Steinar Bang
2008-12-25  0:26             ` Steinar Bang
2008-12-26 11:21               ` Steinar Bang
2008-12-26 11:27                 ` Steinar Bang
2008-12-26 13:13                   ` Steinar Bang
2008-12-26 14:04                 ` Steven E. Harris
2008-12-26 15:57                   ` Steinar Bang
2008-12-26 17:25                     ` Steinar Bang
2008-12-26 17:40                       ` Steinar Bang
2008-12-31 13:06                         ` Steinar Bang
2009-01-01 18:48                           ` Steinar Bang
2008-12-26 14:12                 ` Steven E. Harris
2008-12-26 15:58                   ` Steinar Bang
2009-01-01 22:23               ` Steven E. Harris
2009-01-02  7:59                 ` Steinar Bang
2009-01-02 13:10                   ` Steven E. Harris
2009-01-02 13:37                     ` Steinar Bang
2009-01-11 17:30                       ` Steinar Bang
2009-01-11 18:04                         ` Steinar Bang
2009-01-11 21:30                           ` Reiner Steib
2009-01-12  8:41                             ` Steinar Bang
2009-01-12  8:57                               ` Steinar Bang
2009-01-15 12:43                                 ` Steinar Bang
2009-01-12  0:23                           ` Steven E. Harris
2009-01-01 22:35               ` Steven E. Harris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=833ahh3nud.fsf@torus.sehlabs.com \
    --to=seh@panix.com \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).