]> git.eshelyaron.com Git - emacs.git/commitdiff
Merge remote-tracking branch 'origin/netsec'
authorLars Ingebrigtsen <larsi@gnus.org>
Fri, 23 Aug 2019 02:49:52 +0000 (04:49 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Fri, 23 Aug 2019 02:49:52 +0000 (04:49 +0200)
1  2 
doc/lispref/processes.texi
etc/NEWS
lisp/net/gnutls.el
lisp/net/net-utils.el
lisp/net/nsm.el
src/gnutls.c
src/process.c
test/src/process-tests.el

Simple merge
diff --cc etc/NEWS
index da3c29b1ac5fca4ebd9aa5d923195a53d22607fd,28ce6403c2f05214c58598432896a1a9731507c8..a4a11cc787ab800b2f06dd915116a4920ace3320
+++ b/etc/NEWS
@@@ -182,42 -84,14 +182,45 @@@ loads files during completion of 'C-h f
  \f
  * Changes in Emacs 27.1
  
 +** emacsclient
 +
 +*** emacsclient no longer passes '--eval' arguments to an alternate editor.
 +Previously, '--eval' arguments were passed as file names to any
 +alternate editor started by '--alternate-editor'.
 +
 ++++
 +*** emacsclient now supports an 'EMACS_SOCKET_NAME' environment variable.
 +The command-line argument '--socket-name' overrides it.
 +(The same behavior as for the pre-existing 'EMACS_SERVER_FILE' variable.)
 +
 ++++
 +*** Emacs and emacsclient now default to "$XDG_RUNTIME_DIR/emacs"
 +as the directory for client/server sockets, if Emacs is running
 +under an X Window System desktop that sets the 'XDG_RUNTIME_DIR'
 +environment variable to indicate where session sockets should go.
 +To get the old, less-secure behavior, you can set the
 +'EMACS_SOCKET_NAME' environment variable to an appropriate value.
 +
 +---
 +*** When run by root, emacsclient no longer connects to non-root sockets.
 +(Instead you can use Tramp methods to run root commands in a non-root Emacs.)
 +
+ ** New function 'network-lookup-address-info'.
+ This does IPv4 and/or IPv6 address lookups on hostnames.
  ---
 -** New variable 'xft-ignore-color-fonts'.
 -Default t means don't try to load color fonts when using Xft, as they
 -often cause crashes.  Set it to nil if you really need those fonts.
 -(Bug#30874)
 +** Control of the threshold for using the 'distant-foreground' color.
 +The threshold for color distance below which the 'distant-foreground'
 +color of the face will be used instead of the foreground color can now
 +be controlled via the new variable 'face-near-same-color-threshold'.
 +The default value is 30000, as the previously hard-coded threshold.
 +
 ++++
 +** The function 'read-passwd' uses "*" as default character to hide passwords.
 +
 +** Lexical binding is now used when evaluating interactive Elisp forms.
 +More specifically, lexical-binding is now used for 'M-:', '--eval', as
 +well as in the "*scratch*" and "*ielm*" buffers.
  
  ---
  ** The new option 'tooltip-resize-echo-area' avoids truncating tooltip text
index 61480f358774724c9e0e1135d4c33eb8e840c982,e9d48026d34a03fa6138343aad73a9f07c2ee4d3..da7665089ec2f0b952b2999f901d36980a72a8fb
@@@ -138,10 -133,23 +136,23 @@@ network security is handled at a highe
  `open-network-stream' and the Network Security Manager.  See Info
  node `(emacs) Network Security'."
    :type '(choice (const :tag "Use default value" nil)
-                  (integer :tag "Number of bits" 512))
+                  (integer :tag "Number of bits" 2048))
    :group 'gnutls)
  
 -(defun open-gnutls-stream (name buffer host service &optional nowait)
+ (defcustom gnutls-crlfiles
+   '(
+     "/etc/grid-security/certificates/*.crl.pem"
+     )
+   "List of CRL file paths or a function returning said list.
+ If a file path contains glob wildcards, they will be expanded.
+ The files may be in PEM or DER format, as per the GnuTLS documentation.
+ The files may not exist, in which case they will be ignored."
+   :group 'gnutls
+   :type '(choice (function :tag "Function to produce list of CRL filenames")
+                  (repeat (file :tag "CRL filename")))
+   :version "27.1")
 +(defun open-gnutls-stream (name buffer host service &optional parameters)
    "Open a SSL/TLS connection for a service to a host.
  Returns a subprocess-object to represent the connection.
  Input and output work as for subprocesses; `delete-process' closes it.
Simple merge
diff --cc lisp/net/nsm.el
Simple merge
diff --cc src/gnutls.c
index 267ba9aba35b42e051760ab139d0ec2febb6be9d,117278df35b3c4bda9807de17a860e66fe4b6e33..ce977d901c69989dacbac8166d5a5f346688c40d
@@@ -31,19 -30,20 +31,23 @@@ along with GNU Emacs.  If not, see <htt
  # define HAVE_GNUTLS_X509_SYSTEM_TRUST
  #endif
  
 -/* Although AEAD support started in GnuTLS 3.4.0 and works in 3.5.14,
 -   it was broken through at least GnuTLS 3.4.10; see:
 -   https://lists.gnu.org/r/emacs-devel/2017-07/msg00992.html
 -   The relevant fix seems to have been made in GnuTLS 3.5.1; see:
 -   https://gitlab.com/gnutls/gnutls/commit/568935848dd6b82b9315d8b6c529d00e2605e03d
 -   So, require 3.5.1.  */
 -#if GNUTLS_VERSION_NUMBER >= 0x030501
 -# define HAVE_GNUTLS_AEAD
 +#if GNUTLS_VERSION_NUMBER >= 0x030200
 +# define HAVE_GNUTLS_CIPHER_GET_IV_SIZE
 +#endif
 +
 +#if GNUTLS_VERSION_NUMBER >= 0x030202
 +# define HAVE_GNUTLS_CIPHER_GET_TAG_SIZE
 +# define HAVE_GNUTLS_DIGEST_LIST /* also gnutls_digest_get_name */
 +#endif
 +
 +#if GNUTLS_VERSION_NUMBER >= 0x030205
 +# define HAVE_GNUTLS_EXT__DUMBFW
  #endif
  
+ #if GNUTLS_VERSION_NUMBER >= 0x030400
+ # define HAVE_GNUTLS_ETM_STATUS
+ #endif
  /* gnutls_mac_get_nonce_size was added in GnuTLS 3.2.0, but was
     exported only since 3.3.0. */
  #if GNUTLS_VERSION_NUMBER >= 0x030300
diff --cc src/process.c
Simple merge
index 7745fccaf9d245f7b9afec3e6645ebbd6feb4fce,ff7404f92bd170d748de277679a77acfad4207da..724da1c3e72cf18f0d6237a9988aa94628eb367d
                                        (string-to-list "stdout\n")
                                        (string-to-list "stderr\n"))))))
  
 +(ert-deftest make-process-w32-debug-spawn-error ()
 +  "Check that debugger runs on `make-process' failure (Bug#33016)."
 +  (skip-unless (eq system-type 'windows-nt))
 +  (let* ((debug-on-error t)
 +         (have-called-debugger nil)
 +         (debugger (lambda (&rest _)
 +                     (setq have-called-debugger t)
 +                     ;; Allow entering the debugger later in the same
 +                     ;; test run, before going back to the command
 +                     ;; loop.
 +                     (setq internal-when-entered-debugger -1))))
 +    (should (eq :got-error ;; NOTE: `should-error' would inhibit debugger.
 +                (condition-case-unless-debug ()
 +                    ;; Emacs doesn't search for absolute filenames, so
 +                    ;; the error will be hit in the w32 process spawn
 +                    ;; code.
 +                    (make-process :name "test" :command '("c:/No-Such-Command"))
 +                  (error :got-error))))
 +    (should have-called-debugger)))
 +
 +(ert-deftest make-process/file-handler/found ()
 +  "Check that the ‘:file-handler’ argument of ‘make-process’
 +works as expected if a file name handler is found."
 +  (let ((file-handler-calls 0))
 +    (cl-flet ((file-handler
 +               (&rest args)
 +               (should (equal default-directory "test-handler:/dir/"))
 +               (should (equal args '(make-process :name "name"
 +                                                  :command ("/some/binary")
 +                                                  :file-handler t)))
 +               (cl-incf file-handler-calls)
 +               'fake-process))
 +      (let ((file-name-handler-alist (list (cons (rx bos "test-handler:")
 +                                                 #'file-handler)))
 +            (default-directory "test-handler:/dir/"))
 +        (should (eq (make-process :name "name"
 +                                  :command '("/some/binary")
 +                                  :file-handler t)
 +                    'fake-process))
 +        (should (= file-handler-calls 1))))))
 +
 +(ert-deftest make-process/file-handler/not-found ()
 +  "Check that the ‘:file-handler’ argument of ‘make-process’
 +works as expected if no file name handler is found."
 +  (let ((file-name-handler-alist ())
 +        (default-directory invocation-directory)
 +        (program (expand-file-name invocation-name invocation-directory)))
 +    (should (processp (make-process :name "name"
 +                                    :command (list program "--version")
 +                                    :file-handler t)))))
 +
 +(ert-deftest make-process/file-handler/disable ()
 +  "Check ‘make-process’ works as expected if it shouldn’t use the
 +file name handler."
 +  (let ((file-name-handler-alist (list (cons (rx bos "test-handler:")
 +                                             #'process-tests--file-handler)))
 +        (default-directory "test-handler:/dir/")
 +        (program (expand-file-name invocation-name invocation-directory)))
 +    (should (processp (make-process :name "name"
 +                                    :command (list program "--version"))))))
 +
 +(defun process-tests--file-handler (operation &rest _args)
 +  (cl-ecase operation
 +    (unhandled-file-name-directory "/")
 +    (make-process (ert-fail "file name handler called unexpectedly"))))
 +
 +(put #'process-tests--file-handler 'operations
 +     '(unhandled-file-name-directory make-process))
 +
 +(ert-deftest make-process/stop ()
 +  "Check that `make-process' doesn't accept a `:stop' key.
 +See Bug#30460."
 +  (should-error
 +   (make-process :name "test"
 +                 :command (list (expand-file-name invocation-name
 +                                                  invocation-directory))
 +                 :stop t)))
 +
+ (ert-deftest lookup-family-specification ()
+   "network-lookup-address-info should only accept valid family symbols."
+   (should-error (network-lookup-address-info "google.com" 'both))
+   (should (network-lookup-address-info "google.com" 'ipv4))
+   (should (network-lookup-address-info "google.com" 'ipv6)))
+ (ert-deftest lookup-unicode-domains ()
+   "Unicode domains should fail"
+   (should-error (network-lookup-address-info "faß.de"))
+   (should (length (network-lookup-address-info (puny-encode-domain "faß.de")))))
+ (ert-deftest unibyte-domain-name ()
+   "Unibyte domain names should work"
+   (should (length (network-lookup-address-info (string-to-unibyte "google.com")))))
+ (ert-deftest lookup-google ()
+   "Check that we can look up google IP addresses"
+   (let ((addresses-both (network-lookup-address-info "google.com"))
+         (addresses-v4 (network-lookup-address-info "google.com" 'ipv4))
+         (addresses-v6 (network-lookup-address-info "google.com" 'ipv6)))
+     (should (length addresses-both))
+     (should (length addresses-v4))
+     (should (length addresses-v6))))
+ (ert-deftest non-existent-lookup-failure ()
+   "Check that looking up non-existent domain returns nil"
+   (should (eq nil (network-lookup-address-info "emacs.invalid"))))
  (provide 'process-tests)
  ;; process-tests.el ends here.