So far all items on the chown/setfilecon list have the same
.remember value. But this will change shortly. Therefore, don't
try to lock paths which we won't manipulate XATTRs for.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/security/security_dac.c | 6 ++++--
src/security/security_selinux.c | 6 ++++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index 4b4afef18a..5df50bdcf5 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -232,9 +232,11 @@ virSecurityDACTransactionRun(pid_t pid ATTRIBUTE_UNUSED,
return -1;
for (i = 0; i < list->nItems; i++) {
- const char *p = list->items[i]->path;
+ virSecurityDACChownItemPtr item = list->items[i];
+ const char *p = item->path;
- VIR_APPEND_ELEMENT_COPY_INPLACE(paths, npaths, p);
+ if (item->remember)
+ VIR_APPEND_ELEMENT_COPY_INPLACE(paths, npaths, p);
}
if (!(state = virSecurityManagerMetadataLock(list->manager, paths, npaths)))
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index e879fa39ab..e3be724a2b 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -266,9 +266,11 @@ virSecuritySELinuxTransactionRun(pid_t pid ATTRIBUTE_UNUSED,
return -1;
for (i = 0; i < list->nItems; i++) {
- const char *p = list->items[i]->path;
+ virSecuritySELinuxContextItemPtr item = list->items[i];
+ const char *p = item->path;
- VIR_APPEND_ELEMENT_COPY_INPLACE(paths, npaths, p);
+ if (item->remember)
+ VIR_APPEND_ELEMENT_COPY_INPLACE(paths, npaths, p);
}
if (!(state = virSecurityManagerMetadataLock(list->manager, paths, npaths)))
--
2.21.0