[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: icecream/daemon
From: Luboš Luňák <l.lunak () kde ! org>
Date: 2012-07-08 19:24:02
Message-ID: 20120708192402.E422BAC7A9 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1304648 by lunakl:
allow normal users to actually connect to the daemon's unix socket
M +6 -0 main.cpp
--- trunk/icecream/daemon/main.cpp #1304647:1304648
@@ -505,9 +505,11 @@
struct sockaddr_un myaddr;
memset(&myaddr, 0, sizeof(myaddr));
myaddr.sun_family = AF_UNIX;
+ mode_t old_umask = -1U;
if (getuid()==0) {
strncpy(myaddr.sun_path, "/var/run/iceccd.socket", sizeof(myaddr.sun_path)-1);
unlink(myaddr.sun_path);
+ old_umask = umask(0);
} else {
strncpy(myaddr.sun_path, getenv("HOME"), sizeof(myaddr.sun_path)-1);
strncat(myaddr.sun_path, "/.iceccd.socket", sizeof(myaddr.sun_path)-1-strlen(myaddr.sun_path));
@@ -516,8 +518,12 @@
if (bind(unix_listen_fd, (struct sockaddr*)&myaddr, sizeof(myaddr)) < 0) {
log_perror("bind()");
+ if (old_umask != -1U)
+ umask(old_umask);
return false;
}
+ if (old_umask != -1U)
+ umask(old_umask);
if (listen (unix_listen_fd, 20) < 0) {
log_perror ("listen()");
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic