Commit graph

133670 commits

Author SHA1 Message Date
Lars Ingebrigtsen
29d485fb76 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.
2019-08-23 04:07:10 +02:00
Robert Pluim
bc1cf28da5 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.
2019-08-07 14:07:07 +02:00
Robert Pluim
76662cc47d fixup! Implement hostname->ip lookup function 2019-08-07 13:55:38 +02:00
Robert Pluim
742c2344bf Don't check unibyte hostnames for pure-ASCII
* src/process.c (network_lookup_address_info_1): Only check multibyte
hostnames for pure-ASCII.

* test/src/process-tests.el (unibyte-domain-name): Test unibyte domain
names with network-lookup-address-info.
2018-07-17 20:04:13 +02:00
Robert Pluim
93638b0677 Add network-lookup-address-info description
* doc/lispref/processes.texi (Misc Network): Document
  network-lookup-address-info.
2018-07-17 13:11:57 +02:00
Robert Pluim
f8d9d00b0e 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.
2018-07-17 13:10:21 +02:00
Robert Pluim
adff0d5f75 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.
2018-07-17 13:08:12 +02:00
Robert Pluim
e89c06e8ce 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'
2018-07-16 19:44:54 +02:00
Jimmy Yuen Ho Wong
fab6139b89
Show full issuer and subject distinguished names
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.
2018-07-14 17:50:46 +01:00
Jimmy Yuen Ho Wong
87484dc27e
Full certificate chain details for NSM
* 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.
2018-07-14 17:50:45 +01:00
Jimmy Yuen Ho Wong
682578fcf7
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.
2018-07-14 17:50:44 +01:00
Jimmy Yuen Ho Wong
534a3d5d3a
Revamp Network Security manager checks for TLS
* lisp/net/nsm.el (network-security-level, nsm-level,
  nsm-new-fingerprint-ok-p): Remove `paranoid' level and related code.

* lisp/net/nsm.el (nsm-tls-checks, nsm-tls-check-version,
    nsm-tls-check-compression, nsm-tls-check-renegotiation-info-ext,
    nsm-tls-check-verify-cert, nsm-tls-check-same-cert,
    nsm-tls-check-null-suite, nsm-tls-check-export-kx,
    nsm-tls-check-anon-kx, nsm-tls-check-md5-sig,
    nsm-tls-check-rc4-cipher, nsm-tls-check-dhe-prime-kx,
    nsm-tls-check-sha1-sig, nsm-tls-check-ecdsa-cbc-cipher
    nsm-tls-check-dhe-kx, nsm-tls-check-rsa-kx,
    nsm-tls-check-3des-cipher, nsm-tls-check-cbc-cipher,
    nsm-save-fingerprint-maybe, nsm-tls-post-check-functions): New
    options and functions for checking TLS handshake problems.

* 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.
2018-07-14 17:50:44 +01:00
Jimmy Yuen Ho Wong
023f4c60e9
Set standard value of `gnutls-min-primes-bits' to nil
* lisp/net/gnutls.el (gnutls-min-prime-bits): Set standard value to
  nil in order to let GnuTLS manage the minimum DH prime bits
  accepted.
2018-07-14 17:50:43 +01:00
Jimmy Yuen Ho Wong
a9f09f721e
Check TLS certs against CRL
* 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.
2018-07-14 17:50:42 +01:00
Charles A. Roelli
155d730380 Add to documentation of 'jump-to-register'
* lisp/register.el (jump-to-register):
* doc/emacs/regs.texi (Position Registers): Document that
jumping to a register can push the mark.
2018-07-14 15:14:25 +02:00
Noam Postavsky
5936f6cdac ; Trace epg-tests gpg config finding (Bug#23561) 2018-07-14 09:01:39 -04:00
Jonathan Kyle Mitchell
9f25231f35 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)
2018-07-14 14:26:04 +03:00
Stefan Monnier
41f5de7c8a * lisp/vc/diff-mode.el (diff-font-lock-prettify): New var
(diff--font-lock-prettify): New function.
(diff-font-lock-keywords): Use it.
2018-07-13 12:35:25 -04:00
Glenn Morris
cda7e1850f Merge from origin/emacs-26
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
2018-07-13 09:28:15 -07:00
Basil L. Contovounesios
1013e0392b Tweak subr-x.el substring functions
* 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.
2018-07-13 11:28:16 -04:00
Basil L. Contovounesios
34eba3e333 Minor cus-theme.el simplifications
* lisp/cus-theme.el (custom-new-theme-mode, customize-themes)
(custom-theme-choose-mode): Use setq-local.
(customize-create-theme): Ditto.  Use delete-all-overlays.
(describe-theme-1, custom-theme-summary): Simplify logic.
2018-07-13 11:28:16 -04:00
Basil L. Contovounesios
b16f08015f Minor custom.el simplifications
* lisp/custom.el (custom-quote): Duplicate macroexp-quote.
(custom-load-symbol, customize-mark-to-save, customize-mark-as-set)
(custom-theme-name-valid-p, enable-theme, custom-enabled-themes)
(disable-theme): Simplify logic.
2018-07-13 11:28:16 -04:00
Basil L. Contovounesios
feb6863e64 * lisp/cus-theme.el: Use lexical-binding 2018-07-13 11:28:16 -04:00
Basil L. Contovounesios
5c3db91692 * lisp/custom.el: Use lexical-binding
Remove duplicate 'Custom Themes' comment heading.
(deftheme, custom-declare-theme): Fix advertised calling convention.
(custom-enabled-themes): Fix message grammar.
2018-07-13 11:28:16 -04:00
Basil L. Contovounesios
70d702d3b1 Fix custom-available-themes file expansion
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.
2018-07-13 11:28:16 -04:00
Basil L. Contovounesios
530aa469a4 Disable no-byte-compile in built-in themes
* etc/themes/adwaita-theme.el:
* etc/themes/deeper-blue-theme.el:
* etc/themes/dichromacy-theme.el:
* etc/themes/leuven-theme.el:
* etc/themes/light-blue-theme.el:
* etc/themes/manoj-dark-theme.el:
* etc/themes/misterioso-theme.el:
* etc/themes/tango-dark-theme.el:
* etc/themes/tango-theme.el:
* etc/themes/tsdh-dark-theme.el:
* etc/themes/tsdh-light-theme.el:
* etc/themes/wheatgrass-theme.el:
* etc/themes/whiteboard-theme.el:
* etc/themes/wombat-theme.el: Disable no-byte-compile.

https://lists.gnu.org/archive/html/emacs-devel/2018-01/msg00614.html
https://lists.gnu.org/archive/html/emacs-devel/2018-02/msg00060.html
2018-07-13 11:28:16 -04:00
Basil L. Contovounesios
82e19fede8 Improve loading of byte-compiled custom themes
* lisp/custom.el (load-theme):
Load byte-compiled file of safe themes when available.

https://lists.gnu.org/archive/html/emacs-devel/2018-01/msg00614.html
https://lists.gnu.org/archive/html/emacs-devel/2018-02/msg00060.html
2018-07-13 11:28:16 -04:00
Michael Albinus
17ebb6e5ae 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-".
2018-07-13 14:28:12 +02:00
Michael Albinus
1c862297e4 Fix format error in Faccept_process_output
* src/process.c (Faccept_process_output): Do not use format spec
"%p", it isn't valid for error().
2018-07-13 14:27:33 +02:00
Paul Eggert
b38b91a834 Lessen stack consumption in recursive read1
* src/lread.c (read1): Shrink local buffer size from
MAX_ALLOCA to 128 (Bug#31995).
2018-07-12 20:23:47 -07:00
Noam Postavsky
3eb4603b0d 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'.
2018-07-12 21:49:50 -04:00
Noam Postavsky
01dbf2a347 Speed up smerge-refine-regions by avoiding fsync
* 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.
2018-07-12 21:45:31 -04:00
Noam Postavsky
1222ff5275 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.
2018-07-12 21:45:30 -04:00
Noam Postavsky
5cc7c4b48a Fix previous make-network-process change
* 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>.
2018-07-12 19:43:00 -04:00
Eli Zaretskii
d6a1b69cf3 Another documentation improvement in flyspell.el
* lisp/textmodes/flyspell.el (flyspell-persistent-highlight): Doc
fix.
2018-07-12 19:24:06 +03:00
Eli Zaretskii
9b49a8ed4a Improve documentation of Flyspell
For the background, see
http://lists.gnu.org/archive/html/help-gnu-emacs/2018-07/msg00099.html.

* doc/emacs/fixit.texi (Spelling): Add a couple of caveats.
* lisp/textmodes/flyspell.el: Update commentary.
2018-07-12 18:59:18 +03:00
Stefan Monnier
aeefbc41be Fix the bootstrap differently, so zerop can be where it belongs
Suggested by Robert Pluim <rpluim@gmail.com>.

* lisp/emacs-lisp/byte-run.el (defun-declarations-alist): Avoid cadr/cddr.
* lisp/subr.el (zerop): Un-revert 2018-07-10T23:08:58-07:00!contovob@tcd.ie.
2018-07-12 10:29:28 -04:00
Michael Albinus
3744fda5fa Provide feature 'threads
* src/thread.c (syms_of_threads): Provide feature "threads".

* test/src/thread-tests.el (top): Declare the functions.
(all): Use (featurep 'threads) check.
2018-07-12 10:49:06 +02:00
Basil L. Contovounesios
84e5986902 ; Add commentary on location of zerop
* 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.
2018-07-11 10:31:49 -07:00
Glenn Morris
78125f3744 Unbreak bootstrap
* lisp/subr.el (zerop): Revert previous change, which caused
bootstrap to fail with void function cadr.
2018-07-11 08:27:14 -07:00
Basil L. Contovounesios
babe0d4508 ; Rearrange definition of zerop in subr.el
* lisp/subr.el (zerop): Move from under 'List functions' heading to
under 'Basic Lisp functions' heading.
2018-07-10 23:08:58 -07:00
Miciah Masters
ef9025f5bc 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.

Copyright-paperwork-exempt: yes
2018-07-10 23:10:53 -04:00
Basil L. Contovounesios
db3874b161 Refer to "proper lists" instead of "true lists"
* 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
2018-07-10 19:54:31 -07:00
Stefan Monnier
f8b1e40fb6 * 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.
2018-07-10 22:52:21 -04:00
Filipp Gunbin
1d7151e98e Fix Bug#32107
* lisp/progmodes/sql.el (sql-buffer-live-p): Fix handling of optional
  connection argument.  (Bug#32107)
2018-07-11 05:30:10 +03:00
Jonathan Kyle Mitchell
39489f782e 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.
2018-07-10 21:22:52 -04:00
Noam Postavsky
c249e17324 * lisp/indent.el (indent-line-to): Fix dedenting of tabs. 2018-07-10 12:07:01 -04:00
John Shahid
35e0305dc2 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)
2018-07-10 08:13:39 -04:00
Michael Albinus
51bf4e4650 Fix Bug#32085
* doc/misc/tramp.texi (GVFS based methods): `dav' and `davs' do
not support paths in the volume name.  (Bug#32085)
2018-07-10 09:49:49 +02:00
Paul Eggert
cc74539a19 * lisp/format.el (format-annotate-single-property-change): Simplify. 2018-07-09 19:00:43 -07:00