diff mbox series

[29/30] security: selinux: break out SetImageLabelRelative

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

Commit Message

Cole Robinson Oct. 7, 2019, 9:49 p.m. UTC
This will be used for recursing into externalDataStore

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

---
 src/security/security_selinux.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

-- 
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, 4:09 p.m. UTC | #1
On 10/7/19 6:49 PM, Cole Robinson wrote:
> This will be used for recursing into externalDataStore

>

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

> ---


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


>   src/security/security_selinux.c | 20 +++++++++++++++-----

>   1 file changed, 15 insertions(+), 5 deletions(-)

>

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

> index c0bfb581e3..feb703d325 100644

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

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

> @@ -1919,15 +1919,16 @@ virSecuritySELinuxSetImageLabelInternal(virSecurityManagerPtr mgr,

>   

>   

>   static int

> -virSecuritySELinuxSetImageLabel(virSecurityManagerPtr mgr,

> -                                virDomainDefPtr def,

> -                                virStorageSourcePtr src,

> -                                virSecurityDomainImageLabelFlags flags)

> +virSecuritySELinuxSetImageLabelRelative(virSecurityManagerPtr mgr,

> +                                        virDomainDefPtr def,

> +                                        virStorageSourcePtr src,

> +                                        virStorageSourcePtr parent,

> +                                        virSecurityDomainImageLabelFlags flags)

>   {

>       virStorageSourcePtr n;

>   

>       for (n = src; virStorageSourceIsBacking(n); n = n->backingStore) {

> -        if (virSecuritySELinuxSetImageLabelInternal(mgr, def, n, src) < 0)

> +        if (virSecuritySELinuxSetImageLabelInternal(mgr, def, n, parent) < 0)

>               return -1;

>   

>           if (!(flags & VIR_SECURITY_DOMAIN_IMAGE_LABEL_BACKING_CHAIN))

> @@ -1938,6 +1939,15 @@ virSecuritySELinuxSetImageLabel(virSecurityManagerPtr mgr,

>   }

>   

>   

> +static int

> +virSecuritySELinuxSetImageLabel(virSecurityManagerPtr mgr,

> +                                virDomainDefPtr def,

> +                                virStorageSourcePtr src,

> +                                virSecurityDomainImageLabelFlags flags)

> +{

> +    return virSecuritySELinuxSetImageLabelRelative(mgr, def, src, src, flags);

> +}

> +

>   struct virSecuritySELinuxMoveImageMetadataData {

>       virSecurityManagerPtr mgr;

>       const char *src;


--
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_selinux.c b/src/security/security_selinux.c
index c0bfb581e3..feb703d325 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -1919,15 +1919,16 @@  virSecuritySELinuxSetImageLabelInternal(virSecurityManagerPtr mgr,
 
 
 static int
-virSecuritySELinuxSetImageLabel(virSecurityManagerPtr mgr,
-                                virDomainDefPtr def,
-                                virStorageSourcePtr src,
-                                virSecurityDomainImageLabelFlags flags)
+virSecuritySELinuxSetImageLabelRelative(virSecurityManagerPtr mgr,
+                                        virDomainDefPtr def,
+                                        virStorageSourcePtr src,
+                                        virStorageSourcePtr parent,
+                                        virSecurityDomainImageLabelFlags flags)
 {
     virStorageSourcePtr n;
 
     for (n = src; virStorageSourceIsBacking(n); n = n->backingStore) {
-        if (virSecuritySELinuxSetImageLabelInternal(mgr, def, n, src) < 0)
+        if (virSecuritySELinuxSetImageLabelInternal(mgr, def, n, parent) < 0)
             return -1;
 
         if (!(flags & VIR_SECURITY_DOMAIN_IMAGE_LABEL_BACKING_CHAIN))
@@ -1938,6 +1939,15 @@  virSecuritySELinuxSetImageLabel(virSecurityManagerPtr mgr,
 }
 
 
+static int
+virSecuritySELinuxSetImageLabel(virSecurityManagerPtr mgr,
+                                virDomainDefPtr def,
+                                virStorageSourcePtr src,
+                                virSecurityDomainImageLabelFlags flags)
+{
+    return virSecuritySELinuxSetImageLabelRelative(mgr, def, src, src, flags);
+}
+
 struct virSecuritySELinuxMoveImageMetadataData {
     virSecurityManagerPtr mgr;
     const char *src;