[libvirt PATCH v2 04/10] util: set system token for system identity

Daniel P. Berrangé posted 10 patches 4 years, 9 months ago
There is a newer version of this series
[libvirt PATCH v2 04/10] util: set system token for system identity
Posted by Daniel P. Berrangé 4 years, 9 months ago
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 src/util/viridentity.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/util/viridentity.c b/src/util/viridentity.c
index 8c939a507e..dabe416037 100644
--- a/src/util/viridentity.c
+++ b/src/util/viridentity.c
@@ -263,6 +263,7 @@ virIdentity *virIdentityGetSystem(void)
 #if WITH_SELINUX
     char *con;
 #endif
+    g_autofree char *token = NULL;
 
     if (!(ret = virIdentityNew()))
         return NULL;
@@ -305,6 +306,12 @@ virIdentity *virIdentityGetSystem(void)
     }
 #endif
 
+    if (!(token = virIdentityEnsureSystemToken()))
+        return NULL;
+
+    if (virIdentitySetSystemToken(ret, token) < 0)
+        return NULL;
+
     return g_steal_pointer(&ret);
 }
 
-- 
2.31.1