mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
security: Cleanup DAC driver
Fixes several style issues and removes "DEF" (what is it supposed to mean anyway?) from debug messages. Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
fc03eb53c0
commit
c6172260a5
@ -856,14 +856,13 @@ virSecurityDACSetChardevLabel(virSecurityManagerPtr mgr,
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_CHR_TYPE_PIPE:
|
||||
if ((virAsprintf(&in, "%s.in", dev_source->data.file.path) < 0) ||
|
||||
(virAsprintf(&out, "%s.out", dev_source->data.file.path) < 0))
|
||||
if (virAsprintf(&in, "%s.in", dev_source->data.file.path) < 0 ||
|
||||
virAsprintf(&out, "%s.out", dev_source->data.file.path) < 0)
|
||||
goto done;
|
||||
if (virFileExists(in) && virFileExists(out)) {
|
||||
if ((virSecurityDACSetOwnership(priv, NULL, in, user, group) < 0) ||
|
||||
(virSecurityDACSetOwnership(priv, NULL, out, user, group) < 0)) {
|
||||
if (virSecurityDACSetOwnership(priv, NULL, in, user, group) < 0 ||
|
||||
virSecurityDACSetOwnership(priv, NULL, out, user, group) < 0)
|
||||
goto done;
|
||||
}
|
||||
} else if (virSecurityDACSetOwnership(priv, NULL,
|
||||
dev_source->data.file.path,
|
||||
user, group) < 0) {
|
||||
@ -927,14 +926,13 @@ virSecurityDACRestoreChardevLabel(virSecurityManagerPtr mgr,
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_CHR_TYPE_PIPE:
|
||||
if ((virAsprintf(&out, "%s.out", dev_source->data.file.path) < 0) ||
|
||||
(virAsprintf(&in, "%s.in", dev_source->data.file.path) < 0))
|
||||
if (virAsprintf(&out, "%s.out", dev_source->data.file.path) < 0 ||
|
||||
virAsprintf(&in, "%s.in", dev_source->data.file.path) < 0)
|
||||
goto done;
|
||||
if (virFileExists(in) && virFileExists(out)) {
|
||||
if ((virSecurityDACRestoreSecurityFileLabel(priv, out) < 0) ||
|
||||
(virSecurityDACRestoreSecurityFileLabel(priv, in) < 0)) {
|
||||
if (virSecurityDACRestoreSecurityFileLabel(priv, out) < 0 ||
|
||||
virSecurityDACRestoreSecurityFileLabel(priv, in) < 0)
|
||||
goto done;
|
||||
}
|
||||
} else if (virSecurityDACRestoreSecurityFileLabel(priv, dev_source->data.file.path) < 0) {
|
||||
goto done;
|
||||
}
|
||||
@ -1213,7 +1211,7 @@ virSecurityDACSetProcessLabel(virSecurityManagerPtr mgr,
|
||||
if (virSecurityDACGetIds(secdef, priv, &user, &group, &groups, &ngroups) < 0)
|
||||
return -1;
|
||||
|
||||
VIR_DEBUG("Dropping privileges of DEF to %u:%u, %d supplemental groups",
|
||||
VIR_DEBUG("Dropping privileges to %u:%u, %d supplemental groups",
|
||||
(unsigned int) user, (unsigned int) group, ngroups);
|
||||
|
||||
if (virSetUIDGID(user, group, groups, ngroups) < 0)
|
||||
@ -1238,7 +1236,7 @@ virSecurityDACSetChildProcessLabel(virSecurityManagerPtr mgr,
|
||||
if (virSecurityDACGetIds(secdef, priv, &user, &group, NULL, NULL))
|
||||
return -1;
|
||||
|
||||
VIR_DEBUG("Setting child to drop privileges of DEF to %u:%u",
|
||||
VIR_DEBUG("Setting child to drop privileges to %u:%u",
|
||||
(unsigned int) user, (unsigned int) group);
|
||||
|
||||
virCommandSetUID(cmd, user);
|
||||
|
Loading…
x
Reference in New Issue
Block a user