[PATCH 03/17] security_dac: Pass manager to virSecurityDACSetImageLabel

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

 



This change alone is not needed, but it prepares environment for
subsequent patches where we will need virSecurityManager much
deeper in the code.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/security/security_dac.c | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index fd74e8b..97be862 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -349,12 +349,13 @@ virSecurityDACSetOwnershipInternal(virSecurityDACDataPtr priv,
 
 
 static int
-virSecurityDACSetOwnership(virSecurityDACDataPtr priv,
+virSecurityDACSetOwnership(virSecurityManagerPtr mgr,
                            virStorageSourcePtr src,
                            const char *path,
                            uid_t uid,
                            gid_t gid)
 {
+    virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr);
     struct stat sb;
 
     if (!path && src && src->path &&
@@ -442,7 +443,7 @@ virSecurityDACSetImageLabel(virSecurityManagerPtr mgr,
             return -1;
     }
 
-    return virSecurityDACSetOwnership(priv, src, NULL, user, group);
+    return virSecurityDACSetOwnership(mgr, src, NULL, user, group);
 }
 
 
@@ -550,7 +551,7 @@ virSecurityDACSetHostdevLabelHelper(const char *file,
     if (virSecurityDACGetIds(secdef, priv, &user, &group, NULL, NULL) < 0)
         return -1;
 
-    return virSecurityDACSetOwnership(priv, NULL, file, user, group);
+    return virSecurityDACSetOwnership(mgr, NULL, file, user, group);
 }
 
 
@@ -850,7 +851,7 @@ virSecurityDACSetChardevLabel(virSecurityManagerPtr mgr,
     switch ((virDomainChrType) dev_source->type) {
     case VIR_DOMAIN_CHR_TYPE_DEV:
     case VIR_DOMAIN_CHR_TYPE_FILE:
-        ret = virSecurityDACSetOwnership(priv, NULL,
+        ret = virSecurityDACSetOwnership(mgr, NULL,
                                          dev_source->data.file.path,
                                          user, group);
         break;
@@ -860,10 +861,10 @@ virSecurityDACSetChardevLabel(virSecurityManagerPtr mgr,
             virAsprintf(&out, "%s.out", dev_source->data.file.path) < 0)
             goto done;
         if (virFileExists(in) && virFileExists(out)) {
-            if (virSecurityDACSetOwnership(priv, NULL, in, user, group) < 0 ||
-                virSecurityDACSetOwnership(priv, NULL, out, user, group) < 0)
+            if (virSecurityDACSetOwnership(mgr, NULL, in, user, group) < 0 ||
+                virSecurityDACSetOwnership(mgr, NULL, out, user, group) < 0)
                 goto done;
-        } else if (virSecurityDACSetOwnership(priv, NULL,
+        } else if (virSecurityDACSetOwnership(mgr, NULL,
                                               dev_source->data.file.path,
                                               user, group) < 0) {
             goto done;
@@ -873,7 +874,7 @@ virSecurityDACSetChardevLabel(virSecurityManagerPtr mgr,
 
     case VIR_DOMAIN_CHR_TYPE_UNIX:
         if (!dev_source->data.nix.listen) {
-            if (virSecurityDACSetOwnership(priv, NULL,
+            if (virSecurityDACSetOwnership(mgr, NULL,
                                            dev_source->data.nix.path,
                                            user, group) < 0)
                 goto done;
@@ -1033,7 +1034,7 @@ virSecurityDACSetInputLabel(virSecurityManagerPtr mgr,
         if (virSecurityDACGetIds(seclabel, priv, &user, &group, NULL, NULL) < 0)
             return -1;
 
-        ret = virSecurityDACSetOwnership(priv, NULL, input->source.evdev, user, group);
+        ret = virSecurityDACSetOwnership(mgr, NULL, input->source.evdev, user, group);
         break;
 
     case VIR_DOMAIN_INPUT_TYPE_MOUSE:
@@ -1199,27 +1200,27 @@ virSecurityDACSetAllLabel(virSecurityManagerPtr mgr,
         return -1;
 
     if (def->os.loader && def->os.loader->nvram &&
-        virSecurityDACSetOwnership(priv, NULL,
+        virSecurityDACSetOwnership(mgr, NULL,
                                    def->os.loader->nvram, user, group) < 0)
         return -1;
 
     if (def->os.kernel &&
-        virSecurityDACSetOwnership(priv, NULL,
+        virSecurityDACSetOwnership(mgr, NULL,
                                    def->os.kernel, user, group) < 0)
         return -1;
 
     if (def->os.initrd &&
-        virSecurityDACSetOwnership(priv, NULL,
+        virSecurityDACSetOwnership(mgr, NULL,
                                    def->os.initrd, user, group) < 0)
         return -1;
 
     if (def->os.dtb &&
-        virSecurityDACSetOwnership(priv, NULL,
+        virSecurityDACSetOwnership(mgr, NULL,
                                    def->os.dtb, user, group) < 0)
         return -1;
 
     if (def->os.slic_table &&
-        virSecurityDACSetOwnership(priv, NULL,
+        virSecurityDACSetOwnership(mgr, NULL,
                                    def->os.slic_table, user, group) < 0)
         return -1;
 
@@ -1242,7 +1243,7 @@ virSecurityDACSetSavedStateLabel(virSecurityManagerPtr mgr,
     if (virSecurityDACGetImageIds(secdef, priv, &user, &group) < 0)
         return -1;
 
-    return virSecurityDACSetOwnership(priv, NULL, savefile, user, group);
+    return virSecurityDACSetOwnership(mgr, NULL, savefile, user, group);
 }
 
 
@@ -1561,7 +1562,7 @@ virSecurityDACDomainSetPathLabel(virSecurityManagerPtr mgr,
     if (virSecurityDACGetIds(seclabel, priv, &user, &group, NULL, NULL) < 0)
         return -1;
 
-    return virSecurityDACSetOwnership(priv, NULL, path, user, group);
+    return virSecurityDACSetOwnership(mgr, NULL, path, user, group);
 }
 
 virSecurityDriver virSecurityDriverDAC = {
-- 
2.8.4

--
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]