Skip to content

Commit 84ac07c

Browse files
committed
Fix: acl: Do not delay evaluation of added nodes in some situations
It is not appropriate when the node has no children as it is not a placeholder
1 parent e52eef1 commit 84ac07c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/common/xml.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,13 +1020,16 @@ __xml_acl_post_process(xmlNode * xml)
10201020

10211021
if(is_set(p->flags, xpf_created)) {
10221022
xmlAttr *xIter = NULL;
1023+
char *path = xml_get_path(xml);
10231024

1024-
/* Always allow new scaffolding, ie. node with no attributes or only an 'id' */
1025+
/* Always allow new scaffolding, ie. node with no attributes or only an 'id'
1026+
* Except in the ACLs section
1027+
*/
10251028

10261029
for (xIter = crm_first_attr(xml); xIter != NULL; xIter = xIter->next) {
10271030
const char *prop_name = (const char *)xIter->name;
10281031

1029-
if (strcmp(prop_name, XML_ATTR_ID) == 0) {
1032+
if (strcmp(prop_name, XML_ATTR_ID) == 0 && strstr(path, "/"XML_CIB_TAG_ACLS"/") == NULL) {
10301033
/* Delay the acl check */
10311034
continue;
10321035

@@ -1035,7 +1038,6 @@ __xml_acl_post_process(xmlNode * xml)
10351038
break;
10361039

10371040
} else {
1038-
char *path = xml_get_path(xml);
10391041
crm_trace("Cannot add new node %s at %s", crm_element_name(xml), path);
10401042

10411043
if(xml != xmlDocGetRootElement(xml->doc)) {
@@ -1046,6 +1048,7 @@ __xml_acl_post_process(xmlNode * xml)
10461048
return;
10471049
}
10481050
}
1051+
free(path);
10491052
}
10501053

10511054
while (cIter != NULL) {

0 commit comments

Comments
 (0)