GNU bug report logs - #14938
24.3; open-network-stream with starttls fails with protocol that has no greeting

Previous Next

Package: emacs;

Reported by: Dan Starr <dan.starr <at> gmail.com>

Date: Tue, 23 Jul 2013 15:43:01 UTC

Severity: normal

Tags: fixed

Found in version 24.3

Fixed in version 24.4

Done: Lars Magne Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dan Starr <dan.starr <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3; open-network-stream with starttls fails with protocol that has
 no greeting
Date: Tue, 23 Jul 2013 09:14:15 -0400
[Message part 1 (text/plain, inline)]
I have been trying to use open-network-stream in emacs 24.3 to interact
with a server that runs the Infinote protocol on top of STARTTLS (
http://gobby.0x539.de/trac/wiki/Infinote/Protocol).

This is my usage of open-network-stream:

<code>

  (setq myprocess (open-network-stream
                   "testname" ; name
                   "blah" ; buffer
                   "127.0.0.1" ; host
                   6523   ; port
                   :type 'starttls
                   :starttls-function 'my-starttls-function
                   ;; sent to server when connection initially established
                   :capability-command "<stream:stream version=\"1.0\"
xmlns=\"jabber:client\" xmlns:stream=\"http://etherx.jabber.org/streams\"
to=\"127.0.0.1\">"
                   :end-of-capability "</stream:features>"
                   :end-of-command "/>"
                   :success "proceed"
                   :client-certificate '(/home/dstarr/key/dstarr.key
/home/dstarr/key/dstarr.cert)
                   ))

(defun my-starttls-function (capabilityCommandResponse)
  "<starttls xmlns=\"urn:ietf:params:xml:ns:xmpp-tls\"/>")

</code>

The problem that I have run into is that the Infinote protocol does not
emit a "greeting" upon initial connection, whereas it seems that the
implementation of the function network-stream-open-starttls
in lisp/net/network-stream.el expects such a greeting.

Line 214 of network-stream.el reads: (greeting (network-stream-get-response
stream start eoc)).

For my particular protocol, I have eoc set to "/>", as I have to be able to
detect the server's response to my starttls command (Line 266). Since my
server does not emit a greeting, emacs hangs on Line 214 waiting for an
"eoc" that never comes.  If I set eoc to nil, emacs will proceed past that
line, but it will fail to detect the starttls response (obviously, as it
has no way to detect the end of a command).

To temporarily fix my issue, I removed the 'greeting' line from
network-stream.el.  A more robust solution would be to perhaps allow a
parameter to open-network-stream that indicates whether a greeting is
expected or not.

R,
Dan
[Message part 2 (text/html, inline)]

This bug report was last modified 12 years and 13 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.