[PATCH] set UID and GID according to dynamicOwnership

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

 



When called with dynamicOwnership set, the qemuOpenFileAs function ignores it resulting in files not created with proper permissions.

The issue is reported in:

https://www.redhat.com/archives/libvirt-users/2015-November/msg00039.html

and also mentioned in:

https://www.redhat.com/archives/libvir-list/2015-November/msg00453.html


Signed-off-by: Matteo Cafasso <noxdafox@xxxxxxxxx>
---
 src/qemu/qemu_driver.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 92a9961..b3b59b6 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2932,6 +2932,11 @@ qemuOpenFileAs(uid_t fallback_uid, gid_t fallback_gid,
         if (path_shared <= 0 || dynamicOwnership)
             vfoflags |= VIR_FILE_OPEN_FORCE_OWNER;
 
+        if (dynamicOwnership) {
+            uid = fallback_uid;
+            gid = fallback_gid;
+        }
+
         if (stat(path, &sb) == 0) {
             /* It already exists, we don't want to delete it on error */
             need_unlink = false;
-- 
2.6.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]