ubusd: use umask of 0177 for now to prevent a world- and group-writable unix socket
authorJo-Philipp Wich <jow@openwrt.org>
Sat, 28 Sep 2013 17:23:01 +0000 (17:23 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Sat, 28 Sep 2013 15:23:29 +0000 (17:23 +0200)
ubusd.c

diff --git a/ubusd.c b/ubusd.c
index 03215b33525f9011d0a681dfb185ae085292ccd4..59dee3e6d92acb2a0bfb9fd5311aeddb7f25bd1c 100644 (file)
--- a/ubusd.c
+++ b/ubusd.c
@@ -12,6 +12,7 @@
  */
 
 #include <sys/socket.h>
+#include <sys/stat.h>
 #include <sys/uio.h>
 #include <signal.h>
 #include <stdio.h>
@@ -321,6 +322,7 @@ int main(int argc, char **argv)
        }
 
        unlink(ubus_socket);
+       umask(0177);
        server_fd.fd = usock(USOCK_UNIX | USOCK_SERVER | USOCK_NONBLOCK, ubus_socket, NULL);
        if (server_fd.fd < 0) {
                perror("usock");