|
|
7a3408 |
From 34526e81d64c72c7a562774d110c552eb864dba0 Mon Sep 17 00:00:00 2001
|
|
|
7a3408 |
Message-Id: <34526e81d64c72c7a562774d110c552eb864dba0@dist-git>
|
|
|
7a3408 |
From: Martin Kletzander <mkletzan@redhat.com>
|
|
|
7a3408 |
Date: Mon, 24 Aug 2015 13:04:50 +0200
|
|
|
7a3408 |
Subject: [PATCH] security_dac: Add SetDirLabel support
|
|
|
7a3408 |
|
|
|
7a3408 |
https://bugzilla.redhat.com/show_bug.cgi?id=1146886
|
|
|
7a3408 |
|
|
|
7a3408 |
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
7a3408 |
(cherry picked from commit f4c60dfbf2ec606a5fc148b4c6ff1cd17ffd79ec)
|
|
|
7a3408 |
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
7a3408 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
7a3408 |
---
|
|
|
7a3408 |
src/security/security_dac.c | 20 ++++++++++++++++++++
|
|
|
7a3408 |
1 file changed, 20 insertions(+)
|
|
|
7a3408 |
|
|
|
7a3408 |
diff --git a/src/security/security_dac.c b/src/security/security_dac.c
|
|
|
7a3408 |
index bed23c3..864d75b 100644
|
|
|
7a3408 |
--- a/src/security/security_dac.c
|
|
|
7a3408 |
+++ b/src/security/security_dac.c
|
|
|
7a3408 |
@@ -1394,6 +1394,24 @@ virSecurityDACGetBaseLabel(virSecurityManagerPtr mgr,
|
|
|
7a3408 |
return priv->baselabel;
|
|
|
7a3408 |
}
|
|
|
7a3408 |
|
|
|
7a3408 |
+static int
|
|
|
7a3408 |
+virSecurityDACDomainSetDirLabel(virSecurityManagerPtr mgr,
|
|
|
7a3408 |
+ virDomainDefPtr def,
|
|
|
7a3408 |
+ const char *path)
|
|
|
7a3408 |
+{
|
|
|
7a3408 |
+ virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr);
|
|
|
7a3408 |
+ virSecurityLabelDefPtr seclabel;
|
|
|
7a3408 |
+ uid_t user;
|
|
|
7a3408 |
+ gid_t group;
|
|
|
7a3408 |
+
|
|
|
7a3408 |
+ seclabel = virDomainDefGetSecurityLabelDef(def, SECURITY_DAC_NAME);
|
|
|
7a3408 |
+
|
|
|
7a3408 |
+ if (virSecurityDACGetIds(seclabel, priv, &user, &group, NULL, NULL) < 0)
|
|
|
7a3408 |
+ return -1;
|
|
|
7a3408 |
+
|
|
|
7a3408 |
+ return virSecurityDACSetOwnership(path, user, group);
|
|
|
7a3408 |
+}
|
|
|
7a3408 |
+
|
|
|
7a3408 |
virSecurityDriver virSecurityDriverDAC = {
|
|
|
7a3408 |
.privateDataLen = sizeof(virSecurityDACData),
|
|
|
7a3408 |
.name = SECURITY_DAC_NAME,
|
|
|
7a3408 |
@@ -1441,4 +1459,6 @@ virSecurityDriver virSecurityDriverDAC = {
|
|
|
7a3408 |
.domainGetSecurityMountOptions = virSecurityDACGetMountOptions,
|
|
|
7a3408 |
|
|
|
7a3408 |
.getBaseLabel = virSecurityDACGetBaseLabel,
|
|
|
7a3408 |
+
|
|
|
7a3408 |
+ .domainSetDirLabel = virSecurityDACDomainSetDirLabel,
|
|
|
7a3408 |
};
|
|
|
7a3408 |
--
|
|
|
7a3408 |
2.5.1
|
|
|
7a3408 |
|