Make local sockets world-readable.
authorAndre Noll <maan@tuebingen.mpg.de>
Tue, 19 Jul 2016 17:03:15 +0000 (19:03 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Sat, 23 Jul 2016 00:45:44 +0000 (02:45 +0200)
We already have S_IWOTH, so it's kind of pointless to not permit read
access to the socket special. This patch changes afs.c and audiod.c
to create sockets with mode 666 which was probably intended anyway.

The patch should not cause any compatibility issues since on Linux we
check credentials with SCM_CREDENTIALS while *BSD ignores permissions
for UNIX domain sockets. According to unix(7), portable programs
should not rely on them.

afs.c
audiod.c

diff --git a/afs.c b/afs.c
index cc3fc02..0163298 100644 (file)
--- a/afs.c
+++ b/afs.c
@@ -649,7 +649,7 @@ static int setup_command_socket_or_die(void)
        ret = create_local_socket(socket_name, 0);
        if (ret < 0) {
                ret = create_local_socket(socket_name,
-                       S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IWOTH);
+                       S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IROTH);
                if (ret < 0) {
                        PARA_EMERG_LOG("%s: %s\n", para_strerror(-ret),
                                socket_name);
index 5909859..2f9d5da 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -1072,7 +1072,7 @@ static void init_local_sockets(struct command_task *ct)
                unlink(socket_name);
        ct->fd[0] = create_local_socket(socket_name, 0);
        ct->fd[1] = create_local_socket(socket_name,
-               S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IWOTH);
+               S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
        if (ct->fd[0] >= 0 || ct->fd[1] >= 0)
                return;
        PARA_EMERG_LOG("%s\n", para_strerror(-ct->fd[1]));