Skip to content

Commit f242c1e

Browse files
committed
Fix: xml: Always allow new scaffolding - node with no attributes or only an id field
1 parent 9de7df1 commit f242c1e

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

lib/common/xml.c

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -708,11 +708,29 @@ __xml_acl_post_process(xmlNode * xml)
708708
xmlNode *cIter = __xml_first_child(xml);
709709
xml_private_t *p = xml->_private;
710710

711-
if(is_set(p->flags, xpf_created) && __xml_acl_check(xml, NULL, xpf_acl_write) == FALSE) {
712-
char *path = xml_get_path(xml);
713-
crm_trace("Cannot add new node %s at %s", crm_element_name(xml), path);
714-
free_xml(xml);
715-
return;
711+
if(is_set(p->flags, xpf_created)) {
712+
xmlAttr *xIter = NULL;
713+
714+
/* Always allow new scaffolding, ie. node with no attributes or only an 'id' */
715+
716+
for (xIter = crm_first_attr(xml); xIter != NULL; xIter = xIter->next) {
717+
const char *prop_name = (const char *)xIter->name;
718+
719+
if (strcmp(prop_name, XML_ATTR_ID) == 0) {
720+
/* Delay the acl check */
721+
continue;
722+
723+
} else if(__xml_acl_check(xml, NULL, xpf_acl_write)) {
724+
crm_trace("Creation of %s=%s is allowed", crm_element_name(xml), ID(xml));
725+
break;
726+
727+
} else {
728+
char *path = xml_get_path(xml);
729+
crm_trace("Cannot add new node %s at %s", crm_element_name(xml), path);
730+
free_xml(xml);
731+
return;
732+
}
733+
}
716734
}
717735

718736
while (cIter != NULL) {

0 commit comments

Comments
 (0)