emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 5c0d8bb: Root emacsclient no longer connects to non


From: Glenn Morris
Subject: [Emacs-diffs] master 5c0d8bb: Root emacsclient no longer connects to non-root sockets
Date: Tue, 13 Nov 2018 13:16:04 -0500 (EST)

branch: master
commit 5c0d8bb95bbd5354e6b2cd2e56a91afe4e780759
Author: Glenn Morris <address@hidden>
Commit: Glenn Morris <address@hidden>

    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
---
 etc/NEWS              |  8 +++++++-
 lib-src/emacsclient.c | 11 +++--------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index bbcd7a5..2f07abb 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 42b8dd6..6fbc230 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 */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]