diff mbox series

[28/30] security: selinux: Restore image label for externalDataStore

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

Commit Message

Cole Robinson Oct. 7, 2019, 9:49 p.m. UTC
Rename the existing virSecuritySELinuxRestoreImageLabelInt
to virSecuritySELinuxRestoreImageLabelSingle, and extend the new
ImageLabelInt handle externalDataStore

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

---
 src/security/security_selinux.c | 28 ++++++++++++++++++++++++----
 1 file changed, 24 insertions(+), 4 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:
> Rename the existing virSecuritySELinuxRestoreImageLabelInt

> to virSecuritySELinuxRestoreImageLabelSingle, and extend the new

> ImageLabelInt handle externalDataStore

>

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

> ---


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


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

>   1 file changed, 24 insertions(+), 4 deletions(-)

>

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

> index fd7dd080c1..c0bfb581e3 100644

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

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

> @@ -1747,10 +1747,10 @@ virSecuritySELinuxRestoreTPMFileLabelInt(virSecurityManagerPtr mgr,

>   

>   

>   static int

> -virSecuritySELinuxRestoreImageLabelInt(virSecurityManagerPtr mgr,

> -                                       virDomainDefPtr def,

> -                                       virStorageSourcePtr src,

> -                                       bool migrated)

> +virSecuritySELinuxRestoreImageLabelSingle(virSecurityManagerPtr mgr,

> +                                          virDomainDefPtr def,

> +                                          virStorageSourcePtr src,

> +                                          bool migrated)

>   {

>       virSecurityLabelDefPtr seclabel;

>       virSecurityDeviceLabelDefPtr disk_seclabel;

> @@ -1802,6 +1802,26 @@ virSecuritySELinuxRestoreImageLabelInt(virSecurityManagerPtr mgr,

>   }

>   

>   

> +static int

> +virSecuritySELinuxRestoreImageLabelInt(virSecurityManagerPtr mgr,

> +                                       virDomainDefPtr def,

> +                                       virStorageSourcePtr src,

> +                                       bool migrated)

> +{

> +    if (virSecuritySELinuxRestoreImageLabelSingle(mgr, def, src, migrated) < 0)

> +        return -1;

> +

> +    if (src->externalDataStore &&

> +        virSecuritySELinuxRestoreImageLabelSingle(mgr,

> +                                                  def,

> +                                                  src->externalDataStore,

> +                                                  migrated) < 0)

> +        return -1;

> +

> +    return 0;

> +}

> +

> +

>   static int

>   virSecuritySELinuxRestoreImageLabel(virSecurityManagerPtr mgr,

>                                       virDomainDefPtr def,


--
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 fd7dd080c1..c0bfb581e3 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -1747,10 +1747,10 @@  virSecuritySELinuxRestoreTPMFileLabelInt(virSecurityManagerPtr mgr,
 
 
 static int
-virSecuritySELinuxRestoreImageLabelInt(virSecurityManagerPtr mgr,
-                                       virDomainDefPtr def,
-                                       virStorageSourcePtr src,
-                                       bool migrated)
+virSecuritySELinuxRestoreImageLabelSingle(virSecurityManagerPtr mgr,
+                                          virDomainDefPtr def,
+                                          virStorageSourcePtr src,
+                                          bool migrated)
 {
     virSecurityLabelDefPtr seclabel;
     virSecurityDeviceLabelDefPtr disk_seclabel;
@@ -1802,6 +1802,26 @@  virSecuritySELinuxRestoreImageLabelInt(virSecurityManagerPtr mgr,
 }
 
 
+static int
+virSecuritySELinuxRestoreImageLabelInt(virSecurityManagerPtr mgr,
+                                       virDomainDefPtr def,
+                                       virStorageSourcePtr src,
+                                       bool migrated)
+{
+    if (virSecuritySELinuxRestoreImageLabelSingle(mgr, def, src, migrated) < 0)
+        return -1;
+
+    if (src->externalDataStore &&
+        virSecuritySELinuxRestoreImageLabelSingle(mgr,
+                                                  def,
+                                                  src->externalDataStore,
+                                                  migrated) < 0)
+        return -1;
+
+    return 0;
+}
+
+
 static int
 virSecuritySELinuxRestoreImageLabel(virSecurityManagerPtr mgr,
                                     virDomainDefPtr def,