[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 2/2] Make sure the rundir is accessible by the user



otherwise the user might not have enough permissions to access the
socket if roots umask is 077.

http://bugs.debian.org/614210
---
 daemon/libvirtd.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 610e7fd..a968e05 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -3156,7 +3156,9 @@ static int create_rundir (void)
 {
     const char *rundir = LOCALSTATEDIR "/run/libvirt";
     int ret = 0;
+    mode_t old_umask;
 
+    old_umask = umask(022);
     if (mkdir (rundir, 0755)) {
        if (errno != EEXIST) {
            char ebuf[1024];
@@ -3165,6 +3167,7 @@ static int create_rundir (void)
            ret = VIR_DAEMON_ERR_RUNDIR;
        }
     }
+    umask(old_umask);
     return ret;
 }
 
-- 
1.7.4.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]