Tweak the warning display to be less like a TLS decoding page
* lisp/net/nsm.el (nsm-parse-subject, nsm-certificate-part):
Restore functions for parsing subjects.
(nsm-format-certificate): Use them to display more user-friendly
data. Also change the display to have fewer lines again so that
the data of interest isn't pushed off the screen.
Robert Pluim [Wed, 7 Aug 2019 12:07:07 +0000 (14:07 +0200)]
Change nsm-should-check to look at local subnets
* lisp/net/nsm.el (nsm-network-same-subnet): New function. Checks
if an ip address is in the same subnet as another one.
(nsm-should-check): Use nsm-network-same-subnet to see if we're
connecting to a local subnet machine. Remove checks for RFC1918 addresses.
* test/lisp/net/nsm-tests.el: New file. Test nsm-should-check functionality.
Robert Pluim [Tue, 17 Jul 2018 11:10:21 +0000 (13:10 +0200)]
Add tests for network-lookup-address-info
* test/src/process-tests.el (lookup-family-specification): Test
network-lookup-address-info api.
(lookup-unicode-domains): Test that unicode domains fail.
(lookup-google): Test that normal lookups succeed.
(non-existent-lookup-failure): Check that known non-existent
domains fail.
Robert Pluim [Tue, 17 Jul 2018 11:08:12 +0000 (13:08 +0200)]
Refactor getaddrinfo usage
* src/process.c:
(network_lookup_address_info_1): New function, does most of the
work to call getaddrinfo. Now checks hostname for pure-ASCII.
(Fmake_network_process): Use it.
(Fnetwork_lookup_address_info): Likewise. Error check family
argument.
Robert Pluim [Mon, 16 Jul 2018 17:43:41 +0000 (19:43 +0200)]
Implement hostname->ip lookup function
* src/process.c (conv_sockaddr_to_lisp): Add include_port
argument. Don't put a port in the result if this is false.
(conv_addrinfo_to_lisp, Fprocess_datagram_address)
(connect_network_socket, network_interface_list)
(network_interface_info, server_accept_connection)
(init_process_emacs): Update callers.
(Fnetwork_lookup_address_info): New function. Performs hostname to
ip address lookups.
* src/w32.c (network_interface_get_info): Update callers of
conv_sockaddr_to_lisp
* etc/NEWS : mention addition of 'network-lookup-address-info'
CAs like Let's Encrypt do not put O and OU into the Subject's DN.
Similarly, O and OU are often used to indicate Domain Validated or
Organization Validation as opposed to the actual OU.
Issuer CN often contains the issuer's server or as an indication of
Extended Validation certificate as opposed to the actual issuer
organization.
The Hostname part as extracted from the Subject is also confusing, as
in the case of a hostname mismatch, the Subject's CN, which
`nsm-format-certificate' naively calls the Hostname, will not actually
match the hostname in the problem preamble.
* lisp/net/nsm.el (nsm-format-certificate): Show full DN of Issuer and
Subject. Remove Hostname.
(nsm-certificate-part, nsm-parse-subject): Removed.
* lisp/net/nsm.el (nsm-check-tls-connection): Fix issue with plural
problems in message. Prefix every problem with a bullet.
(nsm-query-user): Add new view the full certificate chain by
pressing d.
(nsm-format-certificate): Improve basic certificate and session info
formatting.
* src/gnutls.c (emacs_gnutls_certificate_export_pem): New function.
(gnutls_certificate_details): Rename to
emacs_gnutls_certificate_details. Add :pem to result list.
(Fgnutls_format_certificate): New function for formatting a PEM to
human-readable text.
Add option to bypass NSM TLS checks on local networks
* lisp/net/net-utils.el (nslookup-host-ipv4, nslookup-host-ipv6,
ipv6-expand): New functions to lookup IPv4 and IPv6 addresses from
DNS.
* lisp/net/nsm.el (nsm-trust-local-network, nsm-should-check,
nsm-check-tls-connection, nsm-check-plain-connection): New defcustom
`nsm-trust-local-network' lets users customize whether NSM should
check for TLS problems when connecting to the hosts on their local
networks. `nsm-should-check' determines whether
`nsm-check-tls-connection' and `nsm-check-plain-connection' should
perform checks. localhost is implicitly trusted, thus checks are
never performed there.
* lisp/net/nsm.el (nsm-check-certificate,
network-security-protocol-checks,
nsm-protocol-check--diffie-hellman-prime-bits,
nsm-protocol-check--3des, nsm-protocol-check--rc4,
nsm-protocol-check--signature-sha1,
nsm-protocol-check--intermediate-sha1, nsm-protocol-check--ssl,
nsm-check-protocol): Remove in favor of `nsm-tls-checks' and
`nsm-tls-check-*' functions.
* lisp/net/nsm.el (nsm-verify-connection): Ensure connection is
checked even when `network-security-level' is `low'.
* lisp/net/nsm.el (nsm-check-tls-connection): Batch all problems found
before querying the user.
* lisp/net/nsm.el (nsm--encryption): Renamed to `nsm-cipher-suite'.
* lisp/net/nsm.el (nsm-fingerprint-ok-p): No longer prompt when
certificate fingerprints mismatch. Returns a boolean instead when
the fingerprint of the certificate received matches the saved
fingerprints.
* lisp/net/nsm.el (nsm-query): Change signature. Accepts a list of
problems and a preformatted message instead of just a message format
and the arguments for the message.
* lisp/net/nsm.el (nsm-query-user): Change signature. Accepts a
preformatted message and the peer status of the handshake instead of
a message format, its arguments and the certificate for the host.
* lisp/net/nsm.el (nsm-save-host): Change signature. Accepts a list of
problems after the WHAT parameter. Saves multiple fingerprints for
the same host in case the host load balances a TLS server with more
than one certificates signed with different keys. Makes sure
conditions are not removed when updating a fingerprint.
* lisp/net/nsm.el (nsm-format-certificate): Display the TLS handshake's
renegotiation info extension, compression level, encrypt-then-MAC
extension, and key exchange prime bit length.
* src/gnutls.c (gnutls-peer-status-warning-describe,
gnutls-peer-status): Check for certificate verification problems
introduced since GnuTLS 3.1.
* src/gnutls.c (gnutls-peer-status): `:compression', `:encrypt-then-mac'
and `:safe-renegotiation' are now contained in the peer status
result return value.
* lisp/net/gnutls.el (gnutls-boot-parameters): Return
`gnutls-crlfiles' in `:crlfiles'.
(gnutls-crlfiles): New defcustom.
(gnutls--get-files): New defun.
(gnutls-trustfiles, gnutls-crlfiles): Delegate to
`gnutls--get-files' to return a list of filenames, accepts glob pattern.
Avoid infloop in redisplay due to faulty mode-line properties
* xdisp.c (safe_set_text_properties): New function.
(display_mode_element): Call Fset_text_properties through
internal_condition_case_n, using safe_set_text_properties as a
wrapper. (Bug#32038)
17ebb6e (origin/emacs-26) Use consistent function names in thread-tes... 1c86229 Fix format error in Faccept_process_output b38b91a Lessen stack consumption in recursive read1 3eb4603 Match w32 paths in grep sans --null hits (Bug#32051) 5cc7c4b Fix previous make-network-process change d6a1b69 Another documentation improvement in flyspell.el 9b49a8e Improve documentation of Flyspell 3744fda Provide feature 'threads ef9025f Save the server alias on reconnect (Bug#29657) db3874b Refer to "proper lists" instead of "true lists" 35e0305 Avoid turning on the global-minor-mode recursively 51bf4e4 Fix Bug#32085
* lisp/emacs-lisp/subr-x.el (string-join): #'-quote function symbol.
(string-trim-left, string-trim-right):
Make better use of substring for minor speedup.
* test/lisp/emacs-lisp/subr-x-tests.el
(subr-x-test-string-trim-left, subr-x-test-string-trim-right)
(subr-x-test-string-remove-prefix)
(subr-x-test-string-remove-suffix): New tests.
For discussion, see thread starting at
https://lists.gnu.org/archive/html/emacs-devel/2018-05/msg00222.html.
* lisp/custom.el: (custom-available-themes): Use directory-files
instead of performing arbitrary wildcard expansion in file names.
(custom-theme--load-path): Document return value.
* test/lisp/custom-tests.el: New file.
(custom-theme--load-path): New test.
Michael Albinus [Fri, 13 Jul 2018 12:28:12 +0000 (14:28 +0200)]
Use consistent function names in thread-tests.el
* test/src/thread-tests.el (threads-call-error, threads-custom)
(threads-errors, threads-sticky-point, threads-signal-early):
Rename, using naming convention to prefix with "threads-".
Match w32 paths in grep sans --null hits (Bug#32051)
* lisp/progmodes/grep.el (grep-regexp-alist): Add an optional part to
match paths starting with C: (other drive letters).
* test/lisp/progmodes/compile-tests.el
(compile-tests--grep-regexp-testcases)
(compile-tests--grep-regexp-tricky-testcases)
(compile-test-grep-regexps): New tests.
(compile--test-error-line): Return `compilation-message'.
* lisp/vc/smerge-mode.el (smerge-refine-regions): Bind
write-region-inhibit-fsync to t. This was reported in
https://github.com/magit/magit/pull/2834 to give a noticable speedup.
Don't skip epg-tests even with gpg 2.0 (Bug#23561)
* test/lisp/epg-tests.el (epg-tests--config-program-alist): New
constant, which allows gpg2 version 2.0+.
(epg-tests-find-usable-gpg-configuration): Pass it to
epg-find-configuration.
* src/process.c (Fmake_network_process): On 2018-07-09 "Explicitly
reject :server and :nowait (Bug#31903)", the sense of the SERVER check
was accidentally reversed so that we ended up looking for the wrong
ADDRESS. Reported by T.V Raman in
<https://lists.gnu.org/archive/html/emacs-devel/2018-07/msg00437.html>.
* lisp/subr.el (zerop): Add commentary explaining why moving the
function's location within the file broke bootstrap in
2018-07-10T23:08:58-07:00!contovob@tcd.ie.
Miciah Masters [Mon, 11 Dec 2017 01:14:09 +0000 (20:14 -0500)]
Save the server alias on reconnect (Bug#29657)
rcirc does not retain the server alias on reconnect. As a result, rcirc
fails to re-use server and channel buffers when an alias is used. Further
problems may ensue when aliases are used to differentiate multiple
connections to the same host, for example when using a single IRC bouncer
or proxy to connect to multiple IRC networks.
Save the server alias when connecting to a server so that reconnect will
retain the alias.
* lisp/net/rcirc.el (rcirc-connect): Include server-alias when setting
rcirc-connection-info.
* doc/lispref/lists.texi (Cons Cells, Building Lists):
* doc/lispref/sequences.texi (Vector Functions): Use the more
popular term "proper", rather than "true", to qualify nil-terminated
lists.
For discussion, see the following emacs-devel subthreads:
https://lists.gnu.org/archive/html/emacs-devel/2018-06/msg00112.html
https://lists.gnu.org/archive/html/emacs-devel/2018-06/msg00138.html
Stefan Monnier [Wed, 11 Jul 2018 02:52:21 +0000 (22:52 -0400)]
* lisp/vc/diff-mode.el: Perform hunk refinement from font-lock
Remove redundant :group arguments.
(diff-font-lock-refine): New var.
(diff--refine-hunk): New function, extracted from diff-refine-hunk.
(diff-refine-hunk): Use it.
(diff--font-lock-refine--refresh): New function.
(diff--font-lock-refined): New function.
(diff-font-lock-keywords): Use it.
Fix infinite recursion in eshell/clear (Bug#31326)
* lisp/eshell/esh-mode.el (eshell/clear): Bind
eshell-input-filter-functions to nil to prevent entries like
eshell-smart-display-setup from causing infinite recursion.
John Shahid [Sat, 23 Jun 2018 15:12:44 +0000 (11:12 -0400)]
Avoid turning on the global-minor-mode recursively
* lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Clear
the buffer-list inside MODE-enable-in-buffers to avoid enabling the
mode recursively. (Bug#31793)
Noam Postavsky [Sat, 30 Jun 2018 13:14:22 +0000 (09:14 -0400)]
Respect field boundaries in indent-line-to (Bug#32014)
* lisp/indent.el (indent-line-to): Use the back-to-indentation point
as the end-point of whitespace removal, rather than
backward-to-indentation which doesn't respect field boundaries.
* test/lisp/emacs-lisp/lisp-mode-tests.el
(lisp-indent-with-read-only-field): Don't expect to fail.
65889a6d12 Fix bootstrap infloop in GNU/Linux alpha 48efd1c98b Minor fix of a recent documentation change 3302b7cd7f Mention the NSM in the gnutls variable doc strings 40c2ce743b Remove test code from last commit e02d8e29c6 Fix Bug#32084 da5d6dbe39 Fix (length NON-SEQUENCE) documentation
Noam Postavsky [Fri, 29 Jun 2018 23:58:58 +0000 (19:58 -0400)]
Stop using indent-line-to in lisp-indent-line (Bug#32014)
This is partial revert of "Remove ignored argument from
lisp-indent-line", because `indent-line-to' doesn't respect field
boundaries.
* lisp/emacs-lisp/lisp-mode.el (lisp-indent-line): Use delete-region
and indent-to instead of `indent-line-to'.
* test/lisp/emacs-lisp/lisp-mode-tests.el
(lisp-indent-with-read-only-field): Expect to pass.
Don't merge to master, we will fix indent-line-to there instead.
* src/process.c (Fmake_network_process): Explicitly check for and
signal an error when passed both :server and :nowait non-nil. In
Emacs 25, :nowait would be ignored in this case, but as of Emacs 26.1
this gives an error, albeit an unclear one. Also remove obsolete
comment regarding configurations lacking non-blocking mode, the
corresponding code was removed in 2012-11-17 "Assume POSIX 1003.1-1988
or later for fcntl.h."
Michael Albinus [Mon, 9 Jul 2018 14:03:49 +0000 (16:03 +0200)]
Fix Bug#32090
* lisp/files-x.el (connection-local-normalize-criteria): Do not
use PROPERTIES anymore.
(connection-local-get-profiles): Rewrite, in order to accept any
property as optional. (Bug#32090)
(connection-local-set-profiles):
Adapt ´connection-local-normalize-criteria' call.
Paul Eggert [Sun, 8 Jul 2018 17:00:17 +0000 (10:00 -0700)]
Fix etc/HELLO searching in grep.el
* lisp/progmodes/grep.el (grep-compute-defaults):
Search for "^Copyright", not "^English", as the latter is no
longer present in etc/HELLO and the former is more likely to
survive future changes to etc/HELLO (Bug#32093).
Mention the NSM in the gnutls variable doc strings
* gnutls.el (gnutls-algorithm-priority): Mention the Network
Security Manager here since this variable is an obvious place
for people concerned about network security to look.
(gnutls-verify-error): Ditto.
(gnutls-min-prime-bits): Ditto.
* doc/emacs/misc.texi (Network Security): Rearrange the
network-security-protocol-checks documentation and try to explain
more what this all means and what checks are triggered.
Michael Albinus [Sun, 8 Jul 2018 11:02:19 +0000 (13:02 +0200)]
Fix Bug#32084
* test/lisp/net/dbus-tests.el (dbus-test02-register-service-own-bus):
Unset $DISPLAY when calling dbus-launch, in order to avoid
possible X11 authentication errors. (Bug#32084)
Suggested by Eli Zaretskii <eliz@gnu.org> in the following threads:
https://lists.gnu.org/archive/html/emacs-devel/2018-07/msg00171.html
https://lists.gnu.org/archive/html/emacs-devel/2018-07/msg00206.html
* doc/lispref/sequences.texi (Sequence Functions): Mention that
'length' signals a 'wrong-type-argument' also when given a
non-sequencep argument.
a427de9 (origin/emacs-26) Fix bug #11732 3a04e15 Improve documentation of 'emacs-lock-mode' 9d6ca5a * lisp/imenu.el (imenu-generic-expression): Doc fix. (Bug#32... fdd7e7d Improve indexing of 'eval-defun' in ELisp manual 10af989 Fix (length CIRCULAR) documentation 271d1f7 Tramp editorials 4abf94f Clarify and improve doc strings of 'eval-last-sexp' and friends 6cfc7a7 Automate upload of Emacs manuals to gnu.org b73cde5 Fix MH-E mail composition with GNU Mailutils (SF#485) 0dce5e5 Speed up 'replace-buffer-contents' some more 00fdce0 * doc/emacs/docstyle.texi: Avoid messing up the html output.
* lisp/imenu.el (imenu--generic-function): Move point to START
before checking whether the current item is inside a comment
or a string. Remove any empty menus that could have been
added before returning. (Bug#32024)
John Shahid [Sun, 1 Jul 2018 18:48:24 +0000 (14:48 -0400)]
Keep interactive uses of 'recenter' backward compatible (Bug#31325)
* window.c (Frecenter): Change the interactive spec to always pass
a non-nil value to the REDISPLAY argument when called interactively.
* window.el (recenter-top-bottom): Make sure 'recenter's second
argument is non-nil everywhere.
* windows.texi (Textual Scrolling): Update documentation of
'recenter'.
Eli Zaretskii [Sat, 7 Jul 2018 07:45:45 +0000 (10:45 +0300)]
Fix recent change in window.c
* src/window.c (scroll_command): Fix minor inefficiency in
last change: don't call Fset_buffer if the buffer is already set to be
what we want. (Bug#31988)
Paul Eggert [Sat, 7 Jul 2018 06:17:30 +0000 (23:17 -0700)]
Update from gnulib
This incorporates:
2018-07-04 gnulib-tool: minor tweaks for --gnu-make
* build-aux/config.guess, build-aux/config.sub: Copy from Gnulib.
* lib/gnulib.mk.in: Regenerate.
Eli Zaretskii [Tue, 3 Jul 2018 19:16:20 +0000 (22:16 +0300)]
Speed up 'replace-buffer-contents' some more
* src/editfns.c (EXTRA_CONTEXT_FIELDS): New members beg_a and beg_b.
(Freplace_buffer_contents): Set up ctx.beg_a and ctx.beg_b.
(buffer_chars_equal): Use ctx->beg_a and ctx->beg_b instead of
calling BUF_BEGV, which is expensive. This speeds up the recipe
in bug#31888 by 30%.