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
This commit is contained in:
Glenn Morris 2018-11-13 13:15:39 -05:00
parent 578c905ac7
commit 5c0d8bb95b
2 changed files with 10 additions and 9 deletions

View file

@ -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.

View file

@ -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 */