From: Glenn Morris Date: Tue, 13 Nov 2018 18:15:39 +0000 (-0500) Subject: Root emacsclient no longer connects to non-root sockets X-Git-Tag: emacs-27.0.90~4170 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=5c0d8bb95bbd5354e6b2cd2e56a91afe4e780759;p=emacs.git Root emacsclient no longer connects to non-root sockets * lib-src/emacsclient.c (set_local_socket): Don't ignore socket ownership when run by root. Ref: http://lists.gnu.org/r/emacs-devel/2018-11/msg00019.html --- diff --git a/etc/NEWS b/etc/NEWS index bbcd7a5747a..2f07abb4eb5 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -119,13 +119,19 @@ the new version of the file again.) * Changes in Emacs 27.1 +** emacsclient + +++ -** emacsclient now supports the 'EMACS_SOCKET_NAME' environment variable. +*** emacsclient now supports the 'EMACS_SOCKET_NAME' environment variable. The behavior is identical to 'EMACS_SERVER_FILE', in that the command-line value specified via '--socket-name' will override the environment, and the natural default to TMPDIR, then "/tmp", continues to apply. +--- +*** 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.) + +++ ** The function 'read-passwd' uses '*' as default character to hide passwords. diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 42b8dd6227b..6fbc2300958 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -1365,14 +1365,9 @@ set_local_socket (const char *local_socket_name) switch (sock_status) { case 1: - /* There's a socket, but it isn't owned by us. This is OK if - we are root. */ - if (0 != geteuid ()) - { - message (true, "%s: Invalid socket owner\n", progname); - return INVALID_SOCKET; - } - break; + /* There's a socket, but it isn't owned by us. */ + message (true, "%s: Invalid socket owner\n", progname); + return INVALID_SOCKET; case 2: /* `stat' failed */