diff mbox series

[24/30] security: dac: Label externalDataStore

Message ID e4f83d512755493e434b45788d8d8ee377532ce2.1570482718.git.crobinso@redhat.com
State Accepted
Commit efe3575e60697ac8e55e16393b9e7cc56af598d5
Headers show
Series storagefile, security: qcow2 data_file support | expand

Commit Message

Cole Robinson Oct. 7, 2019, 9:49 p.m. UTC
We mirror the labeling strategy that was used for its sibling
image

Signed-off-by: Cole Robinson <crobinso@redhat.com>

---
 src/security/security_dac.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

-- 
2.23.0

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

Comments

Daniel Henrique Barboza Oct. 10, 2019, 3:59 p.m. UTC | #1
On 10/7/19 6:49 PM, Cole Robinson wrote:
> We mirror the labeling strategy that was used for its sibling

> image

>

> Signed-off-by: Cole Robinson <crobinso@redhat.com>

> ---


Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>


>   src/security/security_dac.c | 10 +++++++++-

>   1 file changed, 9 insertions(+), 1 deletion(-)

>

> diff --git a/src/security/security_dac.c b/src/security/security_dac.c

> index 326b9b1a3c..2bbf773dd3 100644

> --- a/src/security/security_dac.c

> +++ b/src/security/security_dac.c

> @@ -882,7 +882,7 @@ virSecurityDACSetImageLabelInternal(virSecurityManagerPtr mgr,

>       virSecurityDeviceLabelDefPtr parent_seclabel = NULL;

>       virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr);

>       bool remember;

> -    bool is_toplevel = parent == src;

> +    bool is_toplevel = parent == src || parent->externalDataStore == src;

>       uid_t user;

>       gid_t group;

>   

> @@ -946,6 +946,14 @@ virSecurityDACSetImageLabelRelative(virSecurityManagerPtr mgr,

>           if (virSecurityDACSetImageLabelInternal(mgr, def, n, parent) < 0)

>               return -1;

>   

> +        if (n->externalDataStore &&

> +            virSecurityDACSetImageLabelRelative(mgr,

> +                                                def,

> +                                                n->externalDataStore,

> +                                                parent,

> +                                                flags) < 0)

> +            return -1;

> +

>           if (!(flags & VIR_SECURITY_DOMAIN_IMAGE_LABEL_BACKING_CHAIN))

>               break;

>       }


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff mbox series

Patch

diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index 326b9b1a3c..2bbf773dd3 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -882,7 +882,7 @@  virSecurityDACSetImageLabelInternal(virSecurityManagerPtr mgr,
     virSecurityDeviceLabelDefPtr parent_seclabel = NULL;
     virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr);
     bool remember;
-    bool is_toplevel = parent == src;
+    bool is_toplevel = parent == src || parent->externalDataStore == src;
     uid_t user;
     gid_t group;
 
@@ -946,6 +946,14 @@  virSecurityDACSetImageLabelRelative(virSecurityManagerPtr mgr,
         if (virSecurityDACSetImageLabelInternal(mgr, def, n, parent) < 0)
             return -1;
 
+        if (n->externalDataStore &&
+            virSecurityDACSetImageLabelRelative(mgr,
+                                                def,
+                                                n->externalDataStore,
+                                                parent,
+                                                flags) < 0)
+            return -1;
+
         if (!(flags & VIR_SECURITY_DOMAIN_IMAGE_LABEL_BACKING_CHAIN))
             break;
     }