[PATCH v2 04/10] security: implement domainUpdateSecurityImageLabel for DAC

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

 



Signed-off-by: Peng Liang <liangpeng10@xxxxxxxxxx>
---
 src/security/security_dac.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index 1733d63410b3..d1e1552bb683 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -1132,6 +1132,23 @@ virSecurityDACMoveImageMetadata(virSecurityManager *mgr,
 }
 
 
+static int
+virSecurityDACUpdateImageLabel(virSecurityManager *mgr G_GNUC_UNUSED,
+                               virDomainDef *def G_GNUC_UNUSED,
+                               virStorageSource *src,
+                               virSecurityDomainImageLabelFlags flags G_GNUC_UNUSED)
+{
+    virStorageSource *n;
+
+    for (n = src; virStorageSourceIsBacking(n); n = n->backingStore) {
+        if (virSecurityUpdateTimestampIfexists(SECURITY_DAC_NAME, src->path) < 0)
+            return -1;
+    }
+
+    return 0;
+}
+
+
 static int
 virSecurityDACSetHostdevLabelHelper(const char *file,
                                     bool remember,
@@ -2539,6 +2556,7 @@ virSecurityDriver virSecurityDriverDAC = {
     .domainSetSecurityImageLabel        = virSecurityDACSetImageLabel,
     .domainRestoreSecurityImageLabel    = virSecurityDACRestoreImageLabel,
     .domainMoveImageMetadata            = virSecurityDACMoveImageMetadata,
+    .domainUpdateSecurityImageLabel     = virSecurityDACUpdateImageLabel,
 
     .domainSetSecurityMemoryLabel       = virSecurityDACSetMemoryLabel,
     .domainRestoreSecurityMemoryLabel   = virSecurityDACRestoreMemoryLabel,
-- 
2.31.1





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

  Powered by Linux