Commit graph

47 commits

Author SHA1 Message Date
Lars Magne Ingebrigtsen
04355ac059 Make STARTTLS error messages better
* lisp/net/network-stream.el (network-stream-open-starttls):
Output a better error message when TLS negotiation fails while
doing STARTTLS (bug#23027).
2016-04-24 15:39:44 +02:00
Paul Eggert
59c7a5d711 Assume getaddrinfo in C code
* admin/CPP-DEFINES, configure.ac: Remove HAVE_GETADDRINFO, HAVE_H_ERRNO.
All uses removed.
* doc/lispref/processes.texi (Network, Network Processes), etc/NEWS:
Say that port numbers can be integer strings.
* lib-src/pop.c (h_errno) [!WINDOWSNT && !HAVE_H_ERRNO]: Remove decl.
(socket_connection): Assume HAVE_GETADDRINFO.
* lisp/mpc.el (mpc--proc-connect):
* lisp/net/network-stream.el (open-network-stream):
It’s now OK to use integer strings as port numbers.
* src/process.c (conv_numerical_to_lisp) [!HAVE_GETADDRINFO]: Remove.
(Fmake_network_process): Assume HAVE_GETADDRINFO.
2016-03-07 18:55:20 -08:00
Lars Ingebrigtsen
f577f59a52 Fix merge conflicts in network-stream-tests.el 2016-02-22 15:06:33 +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
598ff2349e Use open-network-stream instead of open-protocol-stream
* lisp/gnus/nnimap.el: Use open-network-stream instead of
open-protocol-stream.

* lisp/gnus/nntp.el: Ditto.

* lisp/gnus/pop3.el: Ditto.

* lisp/gnus/sieve-manage.el: Ditto.

* lisp/net/network-stream.el (open-protocol-stream): Make obsolete.
2016-02-14 15:08:40 +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
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
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
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
John Wiegley
1dd4f26ab6 Merge from origin/emacs-25
ef33bc7 Spelling and grammar fixes
9c3dbab Fix copyright years by hand
0e96320 Update copyright year to 2016
2016-01-11 22:48:07 -08:00
Paul Eggert
0e963201d0 Update copyright year to 2016
Run admin/update-copyright.
2016-01-01 01:34:24 -08:00
Lars Ingebrigtsen
fc3965ed9b IDNA-encode all domain names in `open-network-stream'
* network-stream.el (open-network-stream)
(network-stream-open-plain, network-stream-open-starttls):
IDNA-encode all domain names, if needed.
2015-12-29 00:09:10 +01:00
Paul Eggert
96794d2f97 Don't quote nil and t in doc strings
This is as per "Tips for Documentation Strings" in the elisp manual.
For consistency, do the same in diagnostics and comments.
2015-05-21 10:06:44 -07:00
Wolfgang Jenkner
bc4996520a Respect the :end-of-capability setting
* lisp/net/network-stream.el (network-stream-open-tls): Respect the
:end-of-capability setting.
2015-02-06 13:43:58 +11:00
Paul Eggert
7e09ef09a4 Update copyright year to 2015
Run admin/update-copyright.
2015-01-01 14:26:41 -08:00
Lars Magne Ingebrigtsen
88f3dbc465 Remove more (fboundp 'gnutls-available-p)
* lisp/net/network-stream.el (network-stream-open-starttls): No need to
check for the availability of `gnutls-available-p'.
2014-12-12 12:32:42 +01:00
Lars Magne Ingebrigtsen
4c298b2a73 Implement a Network Security Manager
* processes.texi (Network): Mention the new :warn-unless-encrypted
parameter to `open-network-stream'.
(Network): Mention the Network Security Manager.

* net/nsm.el: New file that implements a Network Security Manager.

* net/network-stream.el (open-network-stream): Add a new
:warn-unless-encrypted parameter.
(network-stream-open-plain): Allow warning unless encrypted.
(network-stream-open-starttls): Call the Network Security Manager.
(network-stream-open-tls): Ditto.
2014-11-23 14:56:43 +01:00
Paul Eggert
ba3189039a Update copyright year to 2014 by running admin/update-copyright. 2014-01-01 07:43:34 +00:00
Dato Simó
3986af6c88 * net/network-stream.el (network-stream-open-starttls): Don't add
--insecure if it's already present, because that gnutls-cli
rejects getting that parameter twice.
2013-10-06 19:14:11 +02:00
Lars Magne Ingebrigtsen
ac38e731d9 Allow talking to STARTTLS servers that have no greeting
* net/network-stream.el (open-network-stream): Mention the new
:nogreeting parameter.
(network-stream-open-starttls): Use the :nogreeting parameter.

Fixes: debbugs:14938
2013-07-30 17:11:58 +02:00
Didier Verna
e5b246e9f3 * lisp/net/network-stream.el (network-stream-open-starttls):
Check that response to the starttls-command is non-nil.

Fixes: debbugs:13706
2013-02-15 18:45:24 -08:00
Paul Eggert
ab422c4d68 Update copyright notices for 2013. 2013-01-01 09:11:05 +00:00
Glenn Morris
016a35dfa7 More process-related doc and manual small edits
* doc/lispref/processes.texi (Output from Processes, Filter Functions):
Mention waiting-for-user-input-p.
(Sentinels, Query Before Exit, System Processes, Transaction Queues):
(Network Servers, Datagrams, Network Processes, Network Options)
(Network Feature Testing, Serial Ports): Copyedits.
(Network): Add encrypted network overview paragraph.
Cross-reference the Emacs-GnuTLS manual.  Use @acronym.

* lisp/net/network-stream.el (open-network-stream): Doc fix.

* src/process.c (Fset_process_inherit_coding_system_flag)
(Fset_process_query_on_exit_flag): Doc fix (mention return value).
(Fmake_network_process): Doc fix.
2012-04-17 20:48:43 -07:00
Lars Magne Ingebrigtsen
c676576a42 Fix starttls-related error message under Windows
* net/network-stream.el (network-stream-open-starttls): Make error
message under Windows be less misleading.
2012-03-22 19:42:12 +01:00
Chong Yidong
96f8741e07 Fix an error message glitch in network-stream.el.
* net/network-stream.el (network-stream-open-starttls): Avoid
emitting a confusing error message when the server gives a bad
response to the capability command.
2012-01-10 18:24:42 +08:00
Glenn Morris
acaf905b11 Add 2012 to FSF copyright years for Emacs files 2012-01-05 01:46:05 -08:00
Paul Eggert
fa46310344 Spelling fixes. 2011-12-05 00:55:25 -08:00
Chong Yidong
ec5c990d86 * net/network-stream.el (network-stream-open-starttls): Improve failure detection
for lack of TLS capability.
2011-10-15 12:57:38 -04:00
Lars Magne Ingebrigtsen
57173b965f (network-stream-open-starttls): Support using starttls.el without using gnutls-cli. 2011-08-17 22:50:33 +02:00
Paul Eggert
9a70f03d70 Merge from trunk. 2011-08-02 22:05:38 -07:00
Lars Magne Ingebrigtsen
12b9eb3527 Work around gnutls failures
* net/network-stream.el (network-stream-open-starttls): If gnutls
negotiation fails, then possibly try again with a non-encrypted
connection.

Fixes: debbugs:9017
2011-07-07 17:14:17 +02:00
Lars Magne Ingebrigtsen
1f2b92cb87 * net/network-stream.el (network-stream-open-starttls): Try using
a plain connection even if the server offered STARTTLS, and we
kinda wanted to use it, if Emacs doesn't have any STARTTLS
capability.  This should make smtpmail.el work in slightly more
configurations.
2011-07-06 17:09:11 +02:00
Lars Magne Ingebrigtsen
2b2167043c Add :end-of-capability keyword for use by pop3.el. 2011-07-03 15:48:59 +02:00
Lars Magne Ingebrigtsen
f6ab314e6e Fix stupid typo with gnutls-clii.
Don't re-get capabilities unless we're reconnecting.
2011-06-27 02:11:22 +02:00
Lars Magne Ingebrigtsen
468d09d44e If the SMTP server supports STARTTLS, but Emacs has no built-in or
external STARTTLS support, then report this in a sensible fashion to
the user.
2011-06-26 23:05:06 +02:00
Lars Magne Ingebrigtsen
2db18f3ffa Use built-in TLS support if `gnutls-available-p' is true. 2011-06-26 10:13:07 +02:00
Lars Magne Ingebrigtsen
6af7a7844e Set :use-starttls-if-possible so that we always use STARTTLS if the server supports it.
SMTP servers that support STARTTLS commonly require it.
2011-06-22 00:55:52 +02:00
Lars Magne Ingebrigtsen
eb8c936238 (network-stream-certificate): Change cert-cert to cert and cert-key to key. 2011-06-21 23:00:45 +02:00
Lars Magne Ingebrigtsen
4ea31e074d Add support for client certificates for built-in and external STARTTLS. 2011-06-21 22:39:08 +02:00
Lars Magne Ingebrigtsen
4bba86e621 (open-network-stream): Add the keyword :always-query-capabilities.
This is for the case where you want to force a `plain' network
connection, but the protocol still requires the capabilitiy command
(i.e., SMTP and EHLO).
2011-06-15 22:44:45 +02:00
Glenn Morris
cf5bee67f9 Declaration fixes.
* lisp/net/network-stream.el (gnutls-negotiate): Fix declaration.

* lisp/simple.el (tabulated-list-print): Fix declaration.

* lisp/progmodes/gud.el (syntax-symbol, syntax-point):
Remove unnecessary and incorrect declarations.
2011-05-04 23:35:41 -07:00
Ted Zlatanov
48e79d6a80 Use CL-style keyword arguments for `gnutls-negotiate' and allow :keylist and :crlfiles arguments.
* lisp/net/gnutls.el (gnutls-negotiate): Use CL-style keyword arguments
instead of positional arguments.  Allow :keylist and :crlfiles
arguments.
(open-gnutls-stream): Call it.

* lisp/net/network-stream.el (network-stream-open-starttls): Adjust to
call `gnutls-negotiate' with :process and :hostname arguments.
2011-05-03 20:44:58 -05:00
Lars Magne Ingebrigtsen
8de66e05c4 (open-network-stream): Take a :nowait parameter and pass it on to `make-network-process'. 2011-05-01 17:39:10 +02:00
Ted Zlatanov
8b492194a9 Bug fixes and certificate and hostname verification for the Emacs GnuTLS support.
* lisp/net/gnutls.el (gnutls-negotiate): Add hostname, verify-flags,
verify-error, and verify-hostname-error parameters.  Check whether
default trustfile exists before going to use it. Add missing
argument to gnutls-message-maybe call. Return return value.
Reported by Claudio Bley <claudio.bley@gmail.com>.
(open-gnutls-stream): Add usage example.

* lisp/net/network-stream.el (network-stream-open-starttls): Give host
parameter to `gnutls-negotiate'.
(gnutls-negotiate): Adjust `gnutls-negotiate' declaration.
2011-04-24 20:31:45 -05:00
Gnus developers
1e3b60017a Merge changes made in Gnus trunk.
gnus.texi (Window Layout): @itemize @code doesn't exist.  It's @table @code.
gnus-registry.el (gnus-registry--split-fancy-with-parent-internal): Fix logic bug.
 (gnus-registry-post-process-groups): Fix logging of no results and quote sender and subject.
network-stream.el (network-stream-open-starttls): Only do opportunistic STARTTLS upgrades if we have built-in gnutls support.  Upgrades via gnutls-cli are too slow to be done opportunistically.
gnus-start.el (gnus-get-unread-articles): Slight cleanup.
 (gnus-read-active-for-groups): Don't try to finish getting stuff where we had no early-data returned.
 (gnus-get-unread-articles): Add a sanity check so that we don't issue two async commands to the same server at the same time.
gnus-sum.el (gnus-summary-select-article-buffer): Doc fix.
gnus-registry.el (gnus-registry-remake-db): Put the warning on a "warning" level.
2011-04-12 22:18:02 +00:00
Chong Yidong
da91b5f294 Merge open-protocol-stream into open-network-stream.
* lisp/subr.el (open-network-stream): Move to net/network-stream.el.

* lisp/gnus/proto-stream.el: Move to net/network-stream.el.

* lisp/net/network-stream.el: Move from gnus/proto-stream.el.
Change prefix to network-stream throughout.
(open-protocol-stream): Merge into open-network-stream, leaving
open-protocol-stream as an alias.  Handle nil BUFFER args.

* lisp/gnus/nnimap.el (nnimap-open-connection-1): Pass explicit :end-of-command
parameter to open-protocol-stream.

* lisp/emacs-lisp/package.el (package--with-work-buffer): Recognize
https URLs.

* lisp/url/url-gw.el (url-open-stream): Use new open-network-stream
functionality to perform encryption.
2011-04-02 19:41:03 -04:00
Renamed from lisp/gnus/proto-stream.el (Browse further)