From 1ada5f286b031bde90d5cdaf8f85311cbfa7db6b Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Tue, 19 Jul 2016 19:03:15 +0200 Subject: [PATCH] Make local sockets world-readable. 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 | 2 +- audiod.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/afs.c b/afs.c index cc3fc020..01632984 100644 --- 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); diff --git a/audiod.c b/audiod.c index 5909859b..2f9d5da3 100644 --- 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])); -- 2.39.5