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

Guido Günther agx at sigxcpu.org
Wed Mar 9 08:20:50 UTC 2011


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




More information about the libvir-list mailing list