mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-18 18:45:16 +00:00
security_dac: Add SetDirLabel support
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
3f48345f7e
commit
f4c60dfbf2
@ -1394,6 +1394,24 @@ virSecurityDACGetBaseLabel(virSecurityManagerPtr mgr,
|
|||||||
return priv->baselabel;
|
return priv->baselabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
virSecurityDACDomainSetDirLabel(virSecurityManagerPtr mgr,
|
||||||
|
virDomainDefPtr def,
|
||||||
|
const char *path)
|
||||||
|
{
|
||||||
|
virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr);
|
||||||
|
virSecurityLabelDefPtr seclabel;
|
||||||
|
uid_t user;
|
||||||
|
gid_t group;
|
||||||
|
|
||||||
|
seclabel = virDomainDefGetSecurityLabelDef(def, SECURITY_DAC_NAME);
|
||||||
|
|
||||||
|
if (virSecurityDACGetIds(seclabel, priv, &user, &group, NULL, NULL) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return virSecurityDACSetOwnership(path, user, group);
|
||||||
|
}
|
||||||
|
|
||||||
virSecurityDriver virSecurityDriverDAC = {
|
virSecurityDriver virSecurityDriverDAC = {
|
||||||
.privateDataLen = sizeof(virSecurityDACData),
|
.privateDataLen = sizeof(virSecurityDACData),
|
||||||
.name = SECURITY_DAC_NAME,
|
.name = SECURITY_DAC_NAME,
|
||||||
@ -1441,4 +1459,6 @@ virSecurityDriver virSecurityDriverDAC = {
|
|||||||
.domainGetSecurityMountOptions = virSecurityDACGetMountOptions,
|
.domainGetSecurityMountOptions = virSecurityDACGetMountOptions,
|
||||||
|
|
||||||
.getBaseLabel = virSecurityDACGetBaseLabel,
|
.getBaseLabel = virSecurityDACGetBaseLabel,
|
||||||
|
|
||||||
|
.domainSetDirLabel = virSecurityDACDomainSetDirLabel,
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user