[PATCH] Fix privileges on /var/run/libvirt directory

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

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

Previous commit

  commit 32a9aac2e04c991340b66c855a1095e4e6445e54
  Author: William Jon McCann <william.jon.mccann@xxxxxxxxx>
  Date:   Thu May 3 12:36:27 2012 -0400

    Use XDG Base Directories instead of storing in home directory

Accidentally changed the umask when creating /var/run/libvirt
to 077. This prevents /var/run/libvirt being readable by non-root,
which is required for non-root to connect to libvirtd. Fix the
code so that umask 077 is only used for the non-privileged libvirtd
instance.
---
 daemon/libvirtd.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index de6c96e..c1ee3f4 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -1131,7 +1131,10 @@ int main(int argc, char **argv) {
         goto cleanup;
     }
 
-    old_umask = umask(077);
+    if (privileged)
+        old_umask = umask(022);
+    else
+        old_umask = umask(077);
     if (virFileMakePath(run_dir) < 0) {
         char ebuf[1024];
         VIR_ERROR(_("unable to create rundir %s: %s"), run_dir,
-- 
1.7.10.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]