Skip to content

WIP: ACLs#4013

Draft
nrwahl2 wants to merge 101 commits intoClusterLabs:mainfrom
nrwahl2:nrwahl2-acls
Draft

WIP: ACLs#4013
nrwahl2 wants to merge 101 commits intoClusterLabs:mainfrom
nrwahl2:nrwahl2-acls

Conversation

@nrwahl2
Copy link
Copy Markdown
Contributor

@nrwahl2 nrwahl2 commented Dec 26, 2025

No description provided.

nrwahl2 added 15 commits May 3, 2026 16:20
I prefer to list the three meaningful values explicitly. Otherwise we
could accept an arbitrary flag that happens to be set in the flag group.

Signed-off-by: Reid Wahl <[email protected]>
Use pcmk__xe_first_attr() and attr_is_not_id().

Signed-off-by: Reid Wahl <[email protected]>
Instead of creating an XPath string and looking for a substring. It
seems clearer this way, though that is debatable.

Signed-off-by: Reid Wahl <[email protected]>
Replace with g_str_has_prefix() in all but one place for clarity.

The remaining place is pcmk__ipc_is_authentic_process_active(). In that
case, use pcmk__str_eq(). Note that the former length argument was
sizeof(last_asked_name), not sizeof(last_asked_name) - 1. This means we
were checking whether the two strings were the same length and every
character matched up to that length -- in other words, we were checking
whether the strings were equal.

Signed-off-by: Reid Wahl <[email protected]>
We return at the very beginning if attr->parent is NULL. element is then
assigned attr->parent, so we know that element is not NULL.

Signed-off-by: Reid Wahl <[email protected]>
The whole function seems clearer to me this way.

Signed-off-by: Reid Wahl <[email protected]>
Notes:
* The tracking flag can never be set when the argument is a document
  node. If node->_private is not NULL, we return before the switch
  statement. But pcmk__xml_doc_all_flags_set() returns false when the
  document's private data is NULL. So tracking is relevant only for
  element, attribute, and comment nodes.
* pcmk__mark_xml_node_dirty() sets the pcmk__xf_dirty flag on the node
  itself as well as all of its parents. For an element, it doesn't
  matter whether we call it before or after creating the attributes'
  private data.

Signed-off-by: Reid Wahl <[email protected]>
Nothing uses these yet.

Signed-off-by: Reid Wahl <[email protected]>
Also rename to reset_doc_private_data(), move the definition to a
position below new_private_data() and above its first caller, and add
Doxygen.

Signed-off-by: Reid Wahl <[email protected]>
To enable this, functionize the pieces of free_private_data().

Signed-off-by: Reid Wahl <[email protected]>
Also rename attr_iter to old_attr and drop the declaration of old_attr
within the body.

Signed-off-by: Reid Wahl <[email protected]>
nrwahl2 added 29 commits May 3, 2026 21:40
To replace pcmk_acl_required().

Signed-off-by: Reid Wahl <[email protected]>
It's in utils.c, not acl.c.

Signed-off-by: Reid Wahl <[email protected]>
I really doubt that any performance savings we may be getting are enough
to justify the readability cost of (a) defining and testing this
function and (b) calling it before each call to pcmk__xml_escape().

Signed-off-by: Reid Wahl <[email protected]>
Nothing uses this yet.

Also assert on NULL fn in other XML foreach functions.

Signed-off-by: Reid Wahl <[email protected]>
It only has one caller, and its checks (non-NULL argument and tracking
flag set) will always pass in that caller. So we end up with two lines
of code, which are straightforward to pull into mark_child_created().

Signed-off-by: Reid Wahl <[email protected]>
We'll use it in an upcoming commit that splits XML
change-tracking/committing into a separate file.

Signed-off-by: Reid Wahl <[email protected]>
We'll use it in an upcoming commit that splits XML
change-tracking/committing into a separate file.

Signed-off-by: Reid Wahl <[email protected]>
I wanted to call it xml_change.c. This code is much more about
calculating and committing changes than about tracking them. However, we
already have patchset{,_display}.c, which deals with XML changes in its
own way. I'm trying to introduce as little confusion as possible. I went
with tracking based on the flag name pcmk__xf_tracking.

Signed-off-by: Reid Wahl <[email protected]>
It takes up more space and is slightly less efficient than the
corresponding series of pcmk__xe_set() calls. I don't see an advantage
for readability or performance, so we might as well drop it.

Signed-off-by: Reid Wahl <[email protected]>
It's the same as pcmk__output_xml_create_parent() when is_list is true,
and it's the same as pcmk__output_create_xml_node() when is_list is
false.

Signed-off-by: Reid Wahl <[email protected]>
I don't think the variadic argument helps readability much. It avoids
the need to store the result in an xmlNode * variable in the caller,
which can save a line. But it requires an extra line for the NULL
terminator, and it requires indenting each line much farther, which is
one reason we have so many temp variables.

Signed-off-by: Reid Wahl <[email protected]>
I don't think the variadic argument helps readability much. It avoids
the need to store the result in an xmlNode * variable in the caller,
which can save a line. But it requires an extra line for the NULL
terminator, and it requires indenting each line much farther, which is
one reason we have so many temp variables.

Signed-off-by: Reid Wahl <[email protected]>
Use pcmk__xe_set_int() instead.

Signed-off-by: Reid Wahl <[email protected]>
Nothing calls it anymore.

Signed-off-by: Reid Wahl <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: in progress PRs that aren't ready yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants