* Asynchronous Network Security Manager
@ 2016-02-15 5:25 Lars Ingebrigtsen
2016-02-15 6:16 ` Lars Ingebrigtsen
0 siblings, 1 reply; 2+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-15 5:25 UTC (permalink / raw)
To: emacs-devel
We've made the changes Eli suggested, so now we have the very final
problem associated with the async stuff: The network security manager.
We have not had asynchronous TLS connections until now, so we haven't
really had this problem before.
`open-network-stream', if given :type 'tls, would call
`network-stream-open-tls'. It used to start like this:
(defun network-stream-open-tls (name buffer host service parameters)
[...]
(stream
(funcall (if (gnutls-available-p)
'open-gnutls-stream
'open-tls-stream)
[...]
;; Check certificate validity etc.
(when (and (gnutls-available-p) stream)
(setq stream (nsm-verify-connection stream host service)))
With async TLS, the negotiation takes place later, of course, and
calling `nsm-verify-connection' here makes no sense.
network-stream-open-tls could put a sentinel on the process, but the
common application use case is
(progn
(setq proc (open-network-stream ...))
(set-process-sentinel proc ...))
so that obviously doesn't work.
I see two solutions:
1) We require callers to call `nsm-verify-connection' themselves in
their own sentinels. (Yuck.)
2) We call `nsm-verify-connection' after the asynchronous TLS
negotiation has finished, and before notifying the user sentinel that
the socket has connected.
Hm... I've never called complex Lisp code from the C layer before. Is
that an A-OK thing to do?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Asynchronous Network Security Manager
2016-02-15 5:25 Asynchronous Network Security Manager Lars Ingebrigtsen
@ 2016-02-15 6:16 ` Lars Ingebrigtsen
0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-15 6:16 UTC (permalink / raw)
To: emacs-devel
Lars Ingebrigtsen <larsi@gnus.org> writes:
> 2) We call `nsm-verify-connection' after the asynchronous TLS
> negotiation has finished, and before notifying the user sentinel that
> the socket has connected.
I've now implemented this just to see whether it would work at all, and
it does. There should be a way to control whether we want our socket to
pass through the NSM, though. Obviously all calls through
`open-network-stream' do, but raw `make-network-socket' might not...
--
(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:[~2016-02-15 6:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-15 5:25 Asynchronous Network Security Manager Lars Ingebrigtsen
2016-02-15 6:16 ` Lars 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).