diff options
| author | Glenn Morris | 2018-11-13 13:15:39 -0500 |
|---|---|---|
| committer | Glenn Morris | 2018-11-13 13:15:39 -0500 |
| commit | 5c0d8bb95bbd5354e6b2cd2e56a91afe4e780759 (patch) | |
| tree | b7ab493d579c39442b3aa497ca00ceb38894aa32 | |
| parent | 578c905ac758de41145a2e080da1e1c1c5c6b1ee (diff) | |
| download | emacs-5c0d8bb95bbd5354e6b2cd2e56a91afe4e780759.tar.gz emacs-5c0d8bb95bbd5354e6b2cd2e56a91afe4e780759.zip | |
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
| -rw-r--r-- | etc/NEWS | 8 | ||||
| -rw-r--r-- | lib-src/emacsclient.c | 11 |
2 files changed, 10 insertions, 9 deletions
| @@ -119,13 +119,19 @@ the new version of the file again.) | |||
| 119 | 119 | ||
| 120 | * Changes in Emacs 27.1 | 120 | * Changes in Emacs 27.1 |
| 121 | 121 | ||
| 122 | ** emacsclient | ||
| 123 | |||
| 122 | +++ | 124 | +++ |
| 123 | ** emacsclient now supports the 'EMACS_SOCKET_NAME' environment variable. | 125 | *** emacsclient now supports the 'EMACS_SOCKET_NAME' environment variable. |
| 124 | The behavior is identical to 'EMACS_SERVER_FILE', in that the | 126 | The behavior is identical to 'EMACS_SERVER_FILE', in that the |
| 125 | command-line value specified via '--socket-name' will override the | 127 | command-line value specified via '--socket-name' will override the |
| 126 | environment, and the natural default to TMPDIR, then "/tmp", continues | 128 | environment, and the natural default to TMPDIR, then "/tmp", continues |
| 127 | to apply. | 129 | to apply. |
| 128 | 130 | ||
| 131 | --- | ||
| 132 | *** When run by root, emacsclient no longer connects to non-root sockets. | ||
| 133 | (Instead you can use Tramp methods to run root commands in a non-root Emacs.) | ||
| 134 | |||
| 129 | +++ | 135 | +++ |
| 130 | ** The function 'read-passwd' uses '*' as default character to hide passwords. | 136 | ** The function 'read-passwd' uses '*' as default character to hide passwords. |
| 131 | 137 | ||
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) | |||
| 1365 | switch (sock_status) | 1365 | switch (sock_status) |
| 1366 | { | 1366 | { |
| 1367 | case 1: | 1367 | case 1: |
| 1368 | /* There's a socket, but it isn't owned by us. This is OK if | 1368 | /* There's a socket, but it isn't owned by us. */ |
| 1369 | we are root. */ | 1369 | message (true, "%s: Invalid socket owner\n", progname); |
| 1370 | if (0 != geteuid ()) | 1370 | return INVALID_SOCKET; |
| 1371 | { | ||
| 1372 | message (true, "%s: Invalid socket owner\n", progname); | ||
| 1373 | return INVALID_SOCKET; | ||
| 1374 | } | ||
| 1375 | break; | ||
| 1376 | 1371 | ||
| 1377 | case 2: | 1372 | case 2: |
| 1378 | /* `stat' failed */ | 1373 | /* `stat' failed */ |