1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-13 17:18:01 +03:00

security: dac: Add is_toplevel to SetImageLabelInternal

This will simplify future patches and make the logic easier to follow

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2019-10-07 16:14:02 -04:00
parent a7262a664d
commit c1f0b31267

View File

@ -884,6 +884,7 @@ virSecurityDACSetImageLabelInternal(virSecurityManagerPtr mgr,
virSecurityDeviceLabelDefPtr parent_seclabel = NULL; virSecurityDeviceLabelDefPtr parent_seclabel = NULL;
virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr); virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr);
bool remember; bool remember;
bool is_toplevel = parent == src;
uid_t user; uid_t user;
gid_t group; gid_t group;
@ -928,7 +929,7 @@ virSecurityDACSetImageLabelInternal(virSecurityManagerPtr mgr,
* but the top layer, or read only image, or disk explicitly * but the top layer, or read only image, or disk explicitly
* marked as shared. * marked as shared.
*/ */
remember = src == parent && !src->readonly && !src->shared; remember = is_toplevel && !src->readonly && !src->shared;
return virSecurityDACSetOwnership(mgr, src, NULL, user, group, remember); return virSecurityDACSetOwnership(mgr, src, NULL, user, group, remember);
} }