unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#14938: 24.3; open-network-stream with starttls fails with protocol that has no greeting
@ 2013-07-23 13:14 Dan Starr
  2013-07-30 15:12 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Starr @ 2013-07-23 13:14 UTC (permalink / raw)
  To: 14938

[-- Attachment #1: Type: text/plain, Size: 2140 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 3025 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#14938: 24.3; open-network-stream with starttls fails with protocol that has no greeting
  2013-07-23 13:14 bug#14938: 24.3; open-network-stream with starttls fails with protocol that has no greeting Dan Starr
@ 2013-07-30 15:12 ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Magne Ingebrigtsen @ 2013-07-30 15:12 UTC (permalink / raw)
  To: Dan Starr; +Cc: 14938

Dan Starr <dan.starr@gmail.com> writes:

> 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.

I've now added support for a :nogreeting parameter to bzr Emacs.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-07-30 15:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-23 13:14 bug#14938: 24.3; open-network-stream with starttls fails with protocol that has no greeting Dan Starr
2013-07-30 15:12 ` Lars Magne Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).