1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-04-27 16:51:06 -07:00
Commit graph

124421 commits

Author SHA1 Message Date
Lars Ingebrigtsen
7d63fa01af Fix up tests for async TLS negotiation 2016-02-19 12:37:34 +11:00
Lars Ingebrigtsen
b73e5254ea Fix coding system setup
* src/process.c (set_network_socket_coding_system): Pass in
the host/service that's been computed already.
2016-02-19 11:58:50 +11:00
Lars Ingebrigtsen
e96df838af Verify the TLS connection asynchronously
* src/gnutls.c (gnutls_verify_boot): Refactor out into its own
function so that we can call it asynchronously.
(Fgnutls_boot): Use it.

* src/process.c (wait_reading_process_output): Verify the TLS
negotiation.
2016-02-18 16:25:37 +11:00
Lars Ingebrigtsen
d4bb0b923b Deactivate the correct process
* src/process.c (wait_reading_process_output): Deactivate the
correct process on failure.
2016-02-16 16:47:55 +11:00
Lars Ingebrigtsen
ac6e085cf6 Implement asynch TLS negotiation
* src/gnutls.c (gnutls_try_handshake): Factor out into its own
function.
(emacs_gnutls_handshake): Use it.
(emacs_gnutls_read): Just return instead of retrying the handshake.

* src/process.c (finish_after_tls_connection): Factor out
into its own function.
(connect_network_socket): Use it.
(wait_reading_process_output): Retry TLS handshakes.
(wait_reading_process_output): Defer sentinel until TLS completes.
2016-02-16 15:56:56 +11:00
Lars Ingebrigtsen
c43bb7f136 Simplify the DNS resolution loop a bit
* src/process.c (wait_reading_process_output): Simplify the
DNS resolution loop a bit.
2016-02-16 13:58:26 +11:00
Alain Schneble
d1fc5a548e Loop over the process list instead of maintaining a separate list
* src/process.c: Remove declaration/definition of dns_processes list.
* src/process.c (wait_reading_process_output): Loop over all processes in
Vprocess_alist instead of dns_processes, to check for completed DNS
requests.
2016-02-16 13:50:23 +11:00
Lars Ingebrigtsen
9755b75300 Allow setting the filter masks later
* src/process.c (Fset_process_filter): Don't set the socket
masks here, because we may not have a socket yet.
(set_process_filter_masks): New function.
(connect_network_socket): Set the filter masks here.
2016-02-16 13:37:33 +11:00
Lars Ingebrigtsen
1bbffcd9d7 Remove debugging 2016-02-16 13:24:47 +11:00
Lars Ingebrigtsen
df91173405 Ensure we always free DNS resources when deleting a process
* src/process.c (free_dns_request): Factor out into own function.
(Fdelete_process): When deleting a process, free any DNS
structures associated with it.
(check_for_dns): Always free all DNS resources.
2016-02-16 13:23:15 +11:00
Alain Schneble
e4324bdf56 Don't block in set-process-window-size
* src/process.c (set-process-window-size): Explicitly return Qnil when
called with network processes as set_window_size won't work anyway on
socket fds.  As a welcome side effect, this makes the blocking
wait_for_socket_fds call obsolete.
2016-02-16 13:13:06 +11:00
Lars Ingebrigtsen
7f3441cc33 Do most of the coding system setup earlier
* src/process.c (Fmake_network_process): Set the read/write
coding systems here, so that special bindings work.
(Fmake_network_process): Complete the coding system setup here.
2016-02-16 13:01:05 +11:00
Lars Ingebrigtsen
2d7af7e206 Protect against initial handshake failures
* src/process.c (connect_network_socket): Mark the connection
as failed if the handshake didn't succeed yet.  This should be
reworked later.
2016-02-15 20:10:10 +11:00
Lars Ingebrigtsen
9c74f2fea6 Call the network security manager after doing TLS negotiation
* lisp/net/network-stream.el (network-stream-open-tls):
Postpone NSM verification when running async.

* src/process.c (Fset_process_filter): This function doesn't
need to wait.
(connect_network_socket): Set the process status to "run" only
after TLS negotiation.
(wait_for_socket_fds): Take a name parameter for more debugging.
(wait_reading_process_output): Don't change status to "run"
unless TLS negotiation has finished.
(send_process): Wait for the process here instead of
send_process_string.
(connect_network_socket): Call the network security manager.
2016-02-15 18:24:08 +11:00
Lars Ingebrigtsen
40155283c3 Remove some #ifdefs and update documentation
* doc/lispref/processes.texi (Network Processes): Remove
mention of `dns'.

* lisp/net/network-stream.el (open-network-stream): Remove
mention of `dns'.

* src/process.c (Fset_process_filter)
(Fset_process_window_size, Fprocess_contact)
(Fprocess_datagram_address, Fset_process_datagram_address)
(Fset_network_process_option, Fprocess_send_region)
(Fprocess_send_string, Fset_process_coding_system)
(Fset_process_filter_multibyte): Remove the #ifdef
HAVE_GETADDRINFO_A checks.
(Fprocess_send_string): Wait for TLS negotiation.
(wait_for_tls_negotiation): New function.
(send_process): Remove the TLS boot check.

* src/process.c (Fmake_network_process): Ditto.
2016-02-15 16:05:14 +11:00
Lars Ingebrigtsen
204847702b Use :nowait t in url-gw
* lisp/url/url-gw.el (url-open-stream): Just use :nowait t,
since we're not differentiating.
2016-02-15 15:59:49 +11:00
Alain Schneble
c740d190e8 Add blockers to process functions
* src/process.c (set-process-filter, set-process-window-size,
process-contact, process-datagram-address, set-process-datagram-address,
set-network-process-option): Make functions wait (block) on network
process until pending DNS requests have been processed and associated
socket initialized.

* src/process.c (process-send-region, process-send-string,
process-send-eof): Make functions wait (block) while network process is
in connect state.
2016-02-15 15:44:29 +11:00
David Edmondson
51d728c834 src/process.c Correctly convert AF_INET6 addresses
* src/process.c (conv_lisp_to_sockaddr): AF_INET6 addresses are
converted to a list of 16 bit quantities by
conv_sockaddr_to_lisp(). conv_lisp_to_sockaddr() should follow the
same scheme rather than expecting a (longer) list of 8 bit
quantities.
2016-02-09 16:08:01 +11:00
Lars Ingebrigtsen
71f22453a5 Add an IPv6 test
* test/lisp/net/network-stream-tests.el
(connect-to-tls-ipv6-nowait): Add an ipv6 test, too.
2016-02-09 11:28:36 +11:00
Lars Ingebrigtsen
a2d6d79c95 Use gnutls-serv instead of openssh
* test/lisp/net/network-stream-tests.el (make-tls-server): Use
gnutls-serv instead of openssh.
2016-02-09 11:28:26 +11:00
Lars Ingebrigtsen
04913ccfa9 Skip TLS tests if we don't have openssl
* test/lisp/net/network-stream-tests.el (connect-to-tls): Skip
TLS tests if we don't have openssl and GnuTLS.
2016-02-09 11:28:21 +11:00
Lars Ingebrigtsen
ea87d91d57 Add a TLS connection test
* test/lisp/net/network-stream-tests.el (connect-to-tls): Add
a TLS connection test.
2016-02-08 15:37:48 +11:00
Lars Ingebrigtsen
d7e2238176 Add more network tests
* test/lisp/net/network-stream-tests.el (echo-server-nowait):
New test.
2016-02-08 15:37:41 +11:00
Lars Ingebrigtsen
92acfb90c6 Add network tests
* test/lisp/net/network-stream-tests.el: New suite of network tests.
2016-02-08 15:37:34 +11:00
Lars Ingebrigtsen
12702b312b Make url.el use async DNS
* lisp/url/url-gw.el (url-open-stream): Use non-blocking DNS.

* src/process.c (syms_of_process): Add a `dns' subfeature for
make-network-process.
2016-02-05 14:03:26 +11:00
Lars Ingebrigtsen
c85e7d4c8c Only do async DNS if requested with :nowait 'dns
* doc/lispref/processes.texi (Network Processes): Mention the
dns value of :nowait.

* src/process.c (Fmake_network_process): Only do async DNS if
:nowait is `dns'.
2016-02-05 13:57:28 +11:00
Lars Ingebrigtsen
e4c58cf3fe Add sanity check for checking async DNS
* src/process.c (check_for_dns): Disregard processes that have
already been killed.
2016-02-05 13:04:59 +11:00
Lars Ingebrigtsen
894e21df1e Doc fixes and refactorings based on comments from Eli Zaretskii
* doc/lispref/processes.texi (Network Processes): Clarify the
meaning of :tls-parameters.

* lisp/net/gnutls.el (open-gnutls-stream): Clarify :nowait.

* lisp/net/gnutls.el (gnutls-boot-parameters): Factor out into
own function.
(gnutls-negotiate): Use it.
(open-gnutls-stream): Ditto.

* src/eval.c (vformat_string): Refactor out the printing bits
from verror.
(verror): Use it.

* src/gnutls.c (boot_error): Mark failed processes with the
real error message.

* src/lisp.h: Declare vformat_string.
2016-02-03 12:43:24 +11:00
Lars Ingebrigtsen
eb597d4095 Build fix for --enable-check-lisp-object-type
* process.c (check_for_dns): Type fix reported by YAMAMOTO
Mitsuharu.
2016-02-02 03:17:53 +01:00
Lars Ingebrigtsen
3955d6c692 Boot parameter check fix
* process.c (send_process): Fix test for boot parameters noted
by Andy Moreton.
2016-02-02 02:52:03 +01:00
Lars Ingebrigtsen
b75f464186 Style fix 2016-02-01 06:05:53 +01:00
Lars Ingebrigtsen
76bf44370e Return the correct server port number
* process.c (connect_network_socket): Return the correct
server port number.
2016-02-01 05:43:17 +01:00
Lars Ingebrigtsen
68f1797cab Fix autoconf test for getaddrinfo_a
* configure.ac: Make the test for getaddrinfo_a work.
2016-02-01 04:53:27 +01:00
Lars Ingebrigtsen
bf4bbfe16d Better async error reporting
* process.c (connect_network_socket): Mark failed processes
with a better error message.
(check_for_dns): Ditto.
2016-02-01 03:58:03 +01:00
Lars Ingebrigtsen
9de7d90184 Clarify :tls-parameters. 2016-02-01 03:37:31 +01:00
Lars Ingebrigtsen
42ef301378 Always boot TLS if given parameters
* src/process.c (connect_network_socket): If we have the TLS
parameters, then boot the socket.
2016-02-01 03:26:09 +01:00
Lars Ingebrigtsen
072d5357c1 Add documentation for :tls-parameters
* doc/lispref/processes.texi (Network Processes): Mention
:tls-parameters.

* src/process.c (Fmake_network_process): Document the
:tls-parameters parameter.
2016-02-01 03:15:36 +01:00
Lars Ingebrigtsen
2cc69b4573 Build fix for glibc systems. 2016-02-01 03:06:58 +01:00
Lars Ingebrigtsen
0645c0f81b Make network connections work again on non-glibc systems
* lisp/net/gnutls.el (open-gnutls-stream): Pass the TLS
keywords in directly so that they can be used when doing
synchronous DNS on non-synchronous connections.

* lisp/net/network-stream.el (open-network-stream): Allow
passing in the TLS parameters directly.

* src/process.c (conv_numerical_to_lisp): New function to convert
numerical addresses to Lisp.
(Fmake_network_process): Rework the non-HAVE_ADDRINFO code
paths so that they work again.
(syms_of_process): Build fix for non-glibc systems.
2016-02-01 02:57:04 +01:00
Lars Ingebrigtsen
56cd5301f1 Windows build fix
* process.c (Fmake_network_process): Build fix for systems
without local sockets.
2016-02-01 01:19:42 +01:00
Lars Ingebrigtsen
b11531e99f Use XCAR/XCDR instead of Fcar etc 2016-02-01 01:15:43 +01:00
Lars Ingebrigtsen
8858b2ce88 Fix GC problem in async TLS connection
* process.h: All Lisp_Object slots have to come first,
otherwise they won't be protected from gc.
2016-02-01 01:10:57 +01:00
Lars Ingebrigtsen
4ff81f8fac Further TLS async work
* gnutls.c (boot_error): New function to either signal an
error or return an error code.
(Fgnutls_boot): Don't signal errors when running asynchronously.

* process.h (pset_status): Move here from process.c to be
able to use from gnutls.c.

* process.c (connect_network_socket): Do the TLS boot here
when running asynchronously.
(wait_reading_process_output): Rework the dns_processes
handling for more safety.
2016-02-01 00:27:07 +01:00
Lars Ingebrigtsen
9972329387 Clean up dead code
* lisp/net/gnutls.el (gnutls-async-sentinel): Remove.
2016-02-01 00:23:33 +01:00
Lars Ingebrigtsen
cecf6c9ac5 Rework the mechanisms for async GnuTLS connections
* lisp/net/gnutls.el (open-gnutls-stream): Compute the
gnutls-boot parameters and pass them to the process object.
(gnutls-negotiate): New parameter :return-keywords that won't
connect to anything, just compute the keywords.

* lisp/url/url-http.el (url-http): Revert async TLS sentinel
hack, which is no longer necessary.

* src/gnutls.c (Fgnutls_asynchronous_parameters): Rename from
gnutls-mark-process.

* src/process.c (connect_network_socket): If we're connecting to
an asynchronous TLS socket, complete the GnuTLS boot sequence here.

* src/process.h: New parameter gnutls_async_parameters.
2016-01-31 02:32:21 +01:00
Lars Ingebrigtsen
1f71df7aac Fix segfault from double free
* process.c (check_for_dns): Protect against double free
issues.
2016-01-31 02:00:12 +01:00
Lars Ingebrigtsen
e2d0ccc96e Remove debugging 2016-01-31 01:41:33 +01:00
Lars Ingebrigtsen
0f47153b97 Implement asynchronous GnuTLS connections
* doc/misc/emacs-gnutls.texi (Help For Developers): Mention
the nowait parameter.

* lisp/net/gnutls.el (open-gnutls-stream): Allow asynchronous
connections with the new nowait parameter.

* lisp/net/network-stream.el (network-stream-open-tls): Pass
on :nowait to open-gnutls-stream.

* lisp/url/url-http.el (url-http): Don't overwrite the
sentinel created by open-gnutls-stream.

* src/gnutls.c (Fgnutls_mark_process): New function.

* src/process.c (send_process): Don't write to GnuTLS sockets that
haven't been initialised yed.

* src/process.h: New slot gnutls_wait_p.
2016-01-31 01:34:45 +01:00
Lars Ingebrigtsen
cc45809152 Clean up compilation warnings 2016-01-30 09:09:02 +01:00
Lars Ingebrigtsen
4d43071112 Make async resolution more efficient
* process.c (wait_reading_process_output): Use a list of
process objects instead of looping through an array to check
for name resolution.  This should be much faster.
2016-01-30 09:07:24 +01:00