提交 f4c60dfb 编写于 作者: M Martin Kletzander

security_dac: Add SetDirLabel support

Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
上级 3f48345f
...@@ -1394,6 +1394,24 @@ virSecurityDACGetBaseLabel(virSecurityManagerPtr mgr, ...@@ -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 = { ...@@ -1441,4 +1459,6 @@ virSecurityDriver virSecurityDriverDAC = {
.domainGetSecurityMountOptions = virSecurityDACGetMountOptions, .domainGetSecurityMountOptions = virSecurityDACGetMountOptions,
.getBaseLabel = virSecurityDACGetBaseLabel, .getBaseLabel = virSecurityDACGetBaseLabel,
.domainSetDirLabel = virSecurityDACDomainSetDirLabel,
}; };
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册