提交 82dce087 编写于 作者: M Martin Kletzander 提交者: Cole Robinson

security_selinux: Add SetDirLabel support

Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 3f48345f)
上级 5290876d
......@@ -2506,6 +2506,21 @@ virSecuritySELinuxGetSecurityMountOptions(virSecurityManagerPtr mgr,
return opts;
}
static char *
virSecuritySELinuxDomainSetDirLabel(virSecurityManagerPtr mgr,
virDomainDefPtr def,
const char *path)
{
virSecurityLabelDefPtr seclabel;
int ret = -1;
seclabel = virDomainDefGetSecurityLabelDef(def, SECURITY_SELINUX_NAME);
if (!seclabel || !seclabel->relabel)
return 0;
return virSecuritySELinuxSetFilecon(path, seclabel->imagelabel);
}
virSecurityDriver virSecurityDriverSELinux = {
.privateDataLen = sizeof(virSecuritySELinuxData),
.name = SECURITY_SELINUX_NAME,
......@@ -2550,4 +2565,6 @@ virSecurityDriver virSecurityDriverSELinux = {
.domainGetSecurityMountOptions = virSecuritySELinuxGetSecurityMountOptions,
.getBaseLabel = virSecuritySELinuxGetBaseLabel,
.domainSetDirLabel = virSecuritySELinuxDomainSetDirLabel,
};
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册