mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
security_selinux: Add SetDirLabel support
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
99cf04e32d
commit
3f48345f7e
@ -2505,6 +2505,21 @@ virSecuritySELinuxGetSecurityMountOptions(virSecurityManagerPtr mgr,
|
|||||||
return opts;
|
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 = {
|
virSecurityDriver virSecurityDriverSELinux = {
|
||||||
.privateDataLen = sizeof(virSecuritySELinuxData),
|
.privateDataLen = sizeof(virSecuritySELinuxData),
|
||||||
.name = SECURITY_SELINUX_NAME,
|
.name = SECURITY_SELINUX_NAME,
|
||||||
@ -2549,4 +2564,6 @@ virSecurityDriver virSecurityDriverSELinux = {
|
|||||||
|
|
||||||
.domainGetSecurityMountOptions = virSecuritySELinuxGetSecurityMountOptions,
|
.domainGetSecurityMountOptions = virSecuritySELinuxGetSecurityMountOptions,
|
||||||
.getBaseLabel = virSecuritySELinuxGetBaseLabel,
|
.getBaseLabel = virSecuritySELinuxGetBaseLabel,
|
||||||
|
|
||||||
|
.domainSetDirLabel = virSecuritySELinuxDomainSetDirLabel,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user