Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
143 commits
Select commit Hold shift + click to select a range
48946fa
Refactor: libcrmcommon: Unindent a block in xml_acl_filtered_copy()
nrwahl2 Dec 25, 2025
f293036
Refactor: libcrmcommon: Rename some variables in xml_acl_filtered_copy()
nrwahl2 Dec 25, 2025
1fa9e2b
Refactor: libcrmcommon: Unindent a block of xml_acl_filtered_copy()
nrwahl2 Dec 25, 2025
7b7e4f7
Refactor: libcrmcommon: Drop target NULL check in loop condition
nrwahl2 Dec 25, 2025
87d05ee
Refactor: libcrmcommon: pcmk__xe_first_child() in purge_xml_attributes()
nrwahl2 Dec 25, 2025
258c049
Refactor: libcrmcommon: Drop xIter in purge_xml_attributes()
nrwahl2 Dec 25, 2025
7dad5ee
Refactor: libcrmcommon: Functionize applying a single ACL
nrwahl2 Dec 25, 2025
b1db575
Refactor: libcrmcommon: Create GString unconditionally in apply_acl()
nrwahl2 Dec 25, 2025
d99a3b8
Refactor: libcrmcommon: Use const in pcmk__apply_acls()
nrwahl2 Dec 25, 2025
11a7d56
Refactor: libcrmcommon: pcmk__apply_acls() takes an xmlDoc *
nrwahl2 Dec 25, 2025
6ad3e3a
Refactor: libcrmcommon: pcmk__xpath_foreach_result in pcmk__apply_acls
nrwahl2 Dec 25, 2025
298f8d3
Refactor: libcrmcommon: Assert arg not NULL in pcmk__unpack_acl()
nrwahl2 Dec 25, 2025
526ea9c
Refactor: libcrmcommon: Reduce duplication in pcmk__apply_acls()
nrwahl2 Dec 25, 2025
ca82b06
Refactor: libcrmcommon: Continue on NULL id in pcmk__unpack_acls()
nrwahl2 Dec 25, 2025
67c979f
Refactor: libcrmcommon: Reduce some duplication in pcmk__unpack_acls()
nrwahl2 Dec 25, 2025
1784f8c
Refactor: libcrmcommon: Unindent loop in pcmk__unpack_acls()
nrwahl2 Dec 25, 2025
1dd50f3
Refactor: libcrmcommon: Unindent more of pcmk__unpack_acls()
nrwahl2 Dec 25, 2025
53f67aa
Refactor: libcrmcommon: parse_acl_entry() specifies element in iterators
nrwahl2 Dec 25, 2025
4a74e87
Refactor: libcrmcommon: Functionize unpacking ACL permission
nrwahl2 Dec 25, 2025
3611870
Log: libcrmcommon: Set config warnings and errors for acl_permission
nrwahl2 Dec 25, 2025
df00560
Refactor: libcrmcommon: Move pcmk__unpack_acls() definition
nrwahl2 Dec 25, 2025
90ec383
Refactor: libcrmcommon: Functionizing unpacking an ACL role reference
nrwahl2 Dec 25, 2025
207b51a
Refactor: libcrmcommon: Functionize resolving an ACL role reference
nrwahl2 Dec 25, 2025
b75ad84
Fix: libcrmcommon: Make parse_acl_entry() non-recursive
nrwahl2 Dec 26, 2025
2a3a6a3
Refactor: libcrmcommon: Functionize unpacking child of ACL target/group
nrwahl2 Dec 26, 2025
f240fad
Refactor: libcrmcommon: Functionize unpacking ACL target or group
nrwahl2 Dec 26, 2025
0294aec
Refactor: libcrmcommon: Functionize parsing ACL target/group separately
nrwahl2 Dec 26, 2025
9560892
Refactor: libcrmcommon: Use more literals in ACL unpack log messages
nrwahl2 Dec 26, 2025
1870fd4
Refactor: libcrmcommon: Take xml_doc_private_t in pcmk__unpack_acls()
nrwahl2 Dec 26, 2025
288df20
Fix: libcrmcommon: xml_acl_filtered_copy() returns false for NULL source
nrwahl2 Dec 26, 2025
07bb18e
Refactor: libcrmcommon: pcmk__enable_acl() takes xmlDoc args
nrwahl2 Dec 26, 2025
e544ac8
Refactor: libcrmcommon: Use g_clear_pointer in reset_xml_private_data()
nrwahl2 Dec 26, 2025
42b6a57
Refactor: libcrmcommon: Set config error on unspecified ACL permission
nrwahl2 Dec 26, 2025
cc3c8d2
Refactor: libcrmcommon: create_acl() returns xml_acl_t *
nrwahl2 Dec 26, 2025
84ffc35
Refactor: libcrmcommon: Unindent create_acl()
nrwahl2 Dec 26, 2025
4ccbe92
Refactor: libcrmcommon: Use g_string_append_printf() in create_acl()
nrwahl2 Dec 26, 2025
9afc2c4
Log: libcrmcommon: Set config warnings on mismatched ACL perm specs
nrwahl2 Dec 26, 2025
1b55d0e
Doc: libcrmcommon: Drop ACL snippet comment
nrwahl2 Dec 26, 2025
f715196
Refactor: libcrmcommon: Use pcmk__is_privileged() in pcmk_acl_required()
nrwahl2 Dec 26, 2025
de40437
Refactor: libcrmcommon: Use g_list_foreach() in pcmk__apply_acls()
nrwahl2 Dec 26, 2025
43ef2fb
Refactor: libcrmcommon: pcmk__xe_foreach_child in unpack_acl_role_ref
nrwahl2 Dec 26, 2025
87316c7
Refactor: libcrmcommon: Rename acl_to_text() to acl_mode_text()
nrwahl2 Dec 26, 2025
620180e
Doc: libcrmcommon: Add Doxygen to ACL apply functions
nrwahl2 Dec 26, 2025
1504252
Refactor: libcrmcommon: Add Doxygen for test_acl_mode()
nrwahl2 Dec 26, 2025
774b7f4
Refactor: libcrmcommon: Use a switch statement in is_mode_allowed()
nrwahl2 Dec 26, 2025
35afc4c
Doc: libcrmcommon: Clarify that pcmk__element_xpath() returns non-NULL
nrwahl2 Dec 26, 2025
6c02d61
Refactor: libcrmcommon: Use convenience helpers in implicitly_allowed()
nrwahl2 Dec 26, 2025
42fa89f
Refactor: libcrmcommon: Walk up the tree in implicitly_allowed()
nrwahl2 Dec 26, 2025
b149e7e
Refactor: libcrmcommon, libpe_status: Drop strncmp() calls
nrwahl2 Dec 26, 2025
155f67e
Refactor: libcrmcommon: Drop a redundant check in pcmk__xa_remove()
nrwahl2 Dec 26, 2025
dc1ee73
Refactor: libcrmcommon: Check force arg sooner in pcmk__xa_remove()
nrwahl2 Dec 26, 2025
0f90157
Refactor: libcrmcommon: Functionize cases of new_private_data()
nrwahl2 Dec 26, 2025
1695de6
Refactor: libcrmcommon: New pcmk__xe_foreach{,_const}_attr()
nrwahl2 Dec 27, 2025
2c47d6e
Refactor: libcrmcommon: pcmk__xe_foreach_attr() in new_private_data()
nrwahl2 Dec 26, 2025
113d14a
Refactor: libcrmcommon: Clear flags in reset_xml_private_data()
nrwahl2 Dec 27, 2025
b9e65a2
Refactor: libcrmcommon: pcmk__xe_foreach_attr() in free_private_data()
nrwahl2 Dec 27, 2025
2f0845d
Refactor: libcrmcommon: Use a for-loop in xml_diff_old_attrs()
nrwahl2 Dec 27, 2025
8044e05
Refactor: libcrmcommon: Unindent else block in xml_diff_old_attrs()
nrwahl2 Dec 27, 2025
982a37d
Refactor: libcrmcommon: Unindent a bit more of xml_diff_old_attrs()
nrwahl2 Dec 27, 2025
3a916c9
Refactor: libcrmcommon: pcmk__xe_foreach_attr() in xml_diff_old_attrs()
nrwahl2 Dec 27, 2025
1036fce
Refactor: libcrmcommon: Drop redundant check from mark_attr_diff()
nrwahl2 Dec 27, 2025
2727a8d
Refactor: libcrmcommon: Drop redundant args from mark_attr_*() functions
nrwahl2 Dec 27, 2025
6a9ecf4
Refactor: libcrmcommon: Use for loop in mark_created_attrs()
nrwahl2 Dec 27, 2025
4c4e830
Refactor: libcrmcommon: Unindent most of for loop in mark_created_attrs
nrwahl2 Dec 27, 2025
a3920b4
Refactor: libcrmcommon: pcmk__xe_foreach_attr() for mark_created_attrs()
nrwahl2 Dec 27, 2025
52150ca
Refactor: libcrmcommon: New mark_attr_created()
nrwahl2 Dec 27, 2025
d2409a0
Refactor: libcrmcommon: pcmk__xe_copy_attrs pcmk__xe_foreach_const_attr
nrwahl2 Dec 27, 2025
45bb660
Refactor: libcrmcommon: Use foreach functions in pcmk__xe_sort_attrs()
nrwahl2 Dec 27, 2025
d34b178
Refactor: libcrmcommon: pcmk__xe_foreach_attr for matching attr removal
nrwahl2 Dec 27, 2025
9d898b1
Refactor: libcrmcommon: delete matching xe pcmk__xe_foreach_const_attr
nrwahl2 Dec 27, 2025
142f9f3
Refactor: libpe_status: get_meta_attributes pcmk__xe_foreach_const_attr
nrwahl2 Dec 27, 2025
4cc9c8a
Refactor: libcrmcommon: pcmk__xe_foreach_const_attr() in xml2list()
nrwahl2 Dec 27, 2025
34e3c98
Refactor: libcrmcommon: Drop check in add_xml_changes_to_patchset()
nrwahl2 Dec 27, 2025
de715d9
Refactor: libcrmcommon: Drop xpath check in add_xml_changes_to_patchset
nrwahl2 Dec 27, 2025
c21a4b4
Refactor: libcrmcommon: Clarify pointers in add_xml_changes_to_patchset
nrwahl2 Dec 27, 2025
3c35be1
Refactor: libcrmcommon: Use foreach for adding attr changes to patchset
nrwahl2 Dec 27, 2025
a55f03f
Refactor: libcrmcommon: Drop cIter in add_xml_changes_to_patchset()
nrwahl2 Dec 27, 2025
9ae507c
Refactor: libcrmcommon: Functionize adding modify change to patchset
nrwahl2 Dec 27, 2025
c860711
Refactor: libcrmcommon: Functionize adding create change to patchset
nrwahl2 Dec 27, 2025
114ab92
Refactor: libcrmcommon: Functionize adding move change to patchset
nrwahl2 Dec 27, 2025
0654131
Refactor: libcrmcommon: Add modify change only if xml is dirty
nrwahl2 Dec 27, 2025
0df1035
Refactor: libcrmcommon: Functionize adding delete change to patchset
nrwahl2 Dec 27, 2025
00b8c00
Refactor: libcrmcommon: Minor xml_create_patchset_v2() improvements
nrwahl2 Dec 27, 2025
ec6c65f
Refactor: libcrmcommon: Functionize setting version fields in patchset
nrwahl2 Dec 27, 2025
971a83e
Refactor: libcrmcommon: pcmk__xe_copy_attrs() in apply_v2_patchset()
nrwahl2 Dec 27, 2025
264224b
Refactor: libcrmcommon: implicitly_allowed() pcmk__xe_foreach_const_attr
nrwahl2 Dec 27, 2025
2eff356
Refactor: libcrmcommon: Clarify pcmk__xml_attr_value()
nrwahl2 Dec 27, 2025
73567cc
Refactor: libcrmcommon: Simplify/clarify pcmk__dump_xml_attr()
nrwahl2 Dec 27, 2025
5f004fb
Refactor: libcrmcommon: pcmk__xe_foreach_const_attr in dump_xml_element
nrwahl2 Dec 27, 2025
bb0f7d4
Low: libcrmcommon: Drop "<null>" fallback in show_xml_element()
nrwahl2 Dec 28, 2025
aa7615e
Refactor: libcrmcommon: Call pcmk__dump_xml_attr() in show_xml_element()
nrwahl2 Dec 28, 2025
c8665cb
Refactor: libcrmcommon: Drop a couple checks from show_xml_element()
nrwahl2 Dec 28, 2025
3c15b51
Refactor: libcrmcommon: pcmk__xe_foreach_const_attr in show_xml_element
nrwahl2 Dec 28, 2025
5d30c58
Refactor: libcrmcommon: Functionize checking whether attribute is hidden
nrwahl2 Dec 28, 2025
4e417d6
Refactor: libcrmcommon: Rename show_xml_changes_recursive argument
nrwahl2 Dec 28, 2025
b04a80c
Refactor: libcrmcommon: foreach_const_attr in show_xml_changes_recursive
nrwahl2 Dec 28, 2025
5f0ed29
Refactor: libcrmcommon: foreach const attr in pcmk__xe_sort_attrs test
nrwahl2 Dec 28, 2025
50244e5
Refactor: libpe_status: foreach_const_attr in pcmk__unpack_action_meta
nrwahl2 Dec 29, 2025
4f042ab
Refactor: libcrmcommon: foreach_const_attr() in unpack_ticket_state()
nrwahl2 Dec 29, 2025
f4a0fab
Refactor: libcrmcommon: Drop side effect from pcmk__marked_as_deleted()
nrwahl2 Dec 28, 2025
5bd8c8e
Refactor: libcrmcommon: pcmk__xe_remove_matching_attrs() match const arg
nrwahl2 Dec 28, 2025
09b9c3f
Refactor: libcrmcommon: New pcmk__xml_tree_foreach_remove()
nrwahl2 Dec 26, 2025
986fbe9
Refactor: libcrmcommon: Unindent pcmk__apply_creation_acl()
nrwahl2 Dec 26, 2025
b9752a4
Refactor: libcrmcommon: Make pcmk__apply_creation_acl() non-recursive
nrwahl2 Dec 26, 2025
bd8ad0f
Refactor: libcrmcommon: Unindent is_config_change()
nrwahl2 Dec 28, 2025
478692d
Refactor: libcrmcommon: Minor best practices in is_config_change()
nrwahl2 Dec 28, 2025
22dc685
Refactor: libcrmcommon: Functionize search for deleted config element
nrwahl2 Dec 28, 2025
fe96265
Refactor: libcrmcommon: Functionize filtering by one ACL
nrwahl2 Dec 28, 2025
9af1510
Refactor: libcrmcommon: Functionize ACL-filtering one match
nrwahl2 Dec 28, 2025
1ac2900
Refactor: libcrmcommon: Reorganize xml_acl_filtered_copy()
nrwahl2 Dec 28, 2025
7f1975e
Refactor: libcrmcommon: Don't delete attrs if we're going to delete node
nrwahl2 Dec 28, 2025
ab68b35
Refactor: libcrmcommon: Clarify xml_acl_filtered_copy()
nrwahl2 Dec 28, 2025
f49b0d6
Refactor: libcrmcommon: New pcmk__acl_filtered_copy()
nrwahl2 Dec 29, 2025
1a41a8a
API: libcrmcommon: Deprecate xml_acl_filtered_copy()
nrwahl2 Dec 29, 2025
ff20ecd
Refactor: libcrmcommon: Make pcmk__unpack_acls() static
nrwahl2 Dec 29, 2025
313f47e
Refactor: libcrmcommon: Unindent xml_acl_disable()
nrwahl2 Dec 29, 2025
d0366f3
Refactor: libcrmcommon: New pcmk__xml_doc_clear_flags()
nrwahl2 Dec 29, 2025
c9bd875
Refactor: libcrmcommon: Simplify xml_acl_denied()
nrwahl2 Dec 29, 2025
3d1c51b
Refactor: libcrmcommon: Drop xml_acl_denied() internally
nrwahl2 Dec 29, 2025
48f7123
API: libcrmcommon: Deprecate xml_acl_denied()
nrwahl2 Dec 29, 2025
55d49eb
Refactor: libcrmcommon: New pcmk__acl_required()
nrwahl2 Dec 29, 2025
609030f
API: libcrmcommon: Deprecate pcmk_acl_required()
nrwahl2 Dec 29, 2025
2594d9c
Refactor: libcrmcommon: Move pcmk__is_user_in_group_test.c to utils
nrwahl2 Dec 29, 2025
03879a2
Refactor: libcrmcommon: Functionize appending XML-escaped character
nrwahl2 Dec 30, 2025
6204de4
Refactor: libcrmcommon: Functionize XML escape append modes
nrwahl2 Dec 30, 2025
97c840c
Refactor: libcrmcommon: Drop pcmk__xml_needs_escape()
nrwahl2 Dec 30, 2025
3848205
Refactor: libcrmcommon: New pcmk__xml_foreach_child()
nrwahl2 Dec 30, 2025
d689b0c
Refactor: libcrmcommon: Functionize check/set matching XML children
nrwahl2 Dec 30, 2025
4102a60
Refactor: libcrmcommon: Use foreach_child for find_matching_children
nrwahl2 Dec 30, 2025
d539ac7
Refactor: libcrmcommon: Functionize marking child changed or deleted
nrwahl2 Dec 30, 2025
5134bac
Refactor: libcrmcommon: Functionize marking child moved or created
nrwahl2 Dec 30, 2025
3f9a85a
Refactor: libcrmcommon: Functionize marking child as created
nrwahl2 Dec 30, 2025
8e9671a
Refactor: libcrmcommon: Defunctionize mark_xml_tree_dirty_created()
nrwahl2 Dec 30, 2025
bea8f10
Refactor: libcrmcommon: Expose reset_doc_private_data() as lib-private
nrwahl2 Dec 30, 2025
0684d93
Refactor: libcrmcommon: Expose free_xml_with_position() as lib-private
nrwahl2 Dec 30, 2025
2baaaad
Refactor: libcrmcommon: Split XML change code into its own file
nrwahl2 Dec 30, 2025
82e4a7b
Refactor: libcrmcommon: Drop pcmk__xe_set_props()
nrwahl2 Dec 30, 2025
010fb8b
Refactor: libpe_status: Return void from pe__name_and_nvpairs_xml()
nrwahl2 Dec 30, 2025
633e0ac
Refactor: libpe_status: Drop pe__name_and_nvpairs_xml()
nrwahl2 Dec 30, 2025
e18e4cb
Refactor: libcrmcommon: pcmk__output_xml_create_parent() drops list arg
nrwahl2 Dec 30, 2025
554133f
Refactor: libcrmcommon: pcmk__output_create_xml_node() drops list arg
nrwahl2 Dec 31, 2025
cb3ce1f
Refactor: libpe_status: Drop a pcmk__itoa() call
nrwahl2 Dec 31, 2025
bee504d
Refactor: libcrmcommon: Drop pcmk__xe_set_propv()
nrwahl2 Dec 31, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions cts/cli/regression.acls.exp
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ crm_attribute: Error performing operation: Permission denied
* Passed: crm_attribute - unknownguy: Set fencing-enabled
=#=#=#= Begin test: unknownguy: Create a resource =#=#=#=
pcmk__check_acl trace: Lack of ACL denies user 'unknownguy' read/write access to /cib/configuration/resources/primitive[@id='dummy']
pcmk__apply_creation_acl trace: ACLs disallow creation of <primitive> with id="dummy"
check_creation_disallowed trace: ACLs disallow creation of <primitive> with id="dummy"
cibadmin: CIB API call failed: Permission denied
=#=#=#= End test: unknownguy: Create a resource - Insufficient privileges (4) =#=#=#=
* Passed: cibadmin - unknownguy: Create a resource
Expand All @@ -555,7 +555,7 @@ crm_attribute: Error performing operation: Permission denied
* Passed: crm_attribute - l33t-haxor: Set fencing-enabled
=#=#=#= Begin test: l33t-haxor: Create a resource =#=#=#=
pcmk__check_acl trace: Parent ACL denies user 'l33t-haxor' read/write access to /cib/configuration/resources/primitive[@id='dummy']
pcmk__apply_creation_acl trace: ACLs disallow creation of <primitive> with id="dummy"
check_creation_disallowed trace: ACLs disallow creation of <primitive> with id="dummy"
cibadmin: CIB API call failed: Permission denied
=#=#=#= End test: l33t-haxor: Create a resource - Insufficient privileges (4) =#=#=#=
* Passed: cibadmin - l33t-haxor: Create a resource
Expand Down Expand Up @@ -639,7 +639,7 @@ crm_attribute: Error performing operation: Permission denied
=#=#=#= End test: niceguy: Set enable-acl - Insufficient privileges (4) =#=#=#=
* Passed: crm_attribute - niceguy: Set enable-acl
=#=#=#= Begin test: niceguy: Set fencing-enabled =#=#=#=
pcmk__apply_creation_acl trace: ACLs allow creation of <nvpair> with id="cib-bootstrap-options-fencing-enabled"
check_creation_disallowed trace: ACLs allow creation of <nvpair> with id="cib-bootstrap-options-fencing-enabled"
=#=#=#= Current cib after: niceguy: Set fencing-enabled =#=#=#=
<cib epoch="10" num_updates="0" admin_epoch="0">
<configuration>
Expand Down Expand Up @@ -716,7 +716,7 @@ pcmk__apply_creation_acl trace: ACLs allow creation of <nvpair> with id="cib-bo
* Passed: crm_attribute - niceguy: Set fencing-enabled
=#=#=#= Begin test: niceguy: Create a resource =#=#=#=
pcmk__check_acl trace: Default ACL denies user 'niceguy' read/write access to /cib/configuration/resources/primitive[@id='dummy']
pcmk__apply_creation_acl trace: ACLs disallow creation of <primitive> with id="dummy"
check_creation_disallowed trace: ACLs disallow creation of <primitive> with id="dummy"
cibadmin: CIB API call failed: Permission denied
=#=#=#= End test: niceguy: Create a resource - Insufficient privileges (4) =#=#=#=
* Passed: cibadmin - niceguy: Create a resource
Expand Down Expand Up @@ -1041,8 +1041,8 @@ crm_resource: Error performing operation: Insufficient privileges
* Passed: crm_resource - l33t-haxor: Remove a resource meta attribute
=#=#=#= Begin test: niceguy: Create a resource meta attribute =#=#=#=
unpack_resources error: Resource start-up disabled since no fencing resources have been defined. Either configure some or disable fencing with the fencing-enabled option. NOTE: Clusters with shared data need fencing to ensure data integrity.
pcmk__apply_creation_acl trace: Creation of <meta_attributes> scaffolding with id="dummy-meta_attributes" is implicitly allowed
pcmk__apply_creation_acl trace: ACLs allow creation of <nvpair> with id="dummy-meta_attributes-target-role"
check_creation_disallowed trace: Creation of <meta_attributes> scaffolding with id="dummy-meta_attributes" is implicitly allowed
check_creation_disallowed trace: ACLs allow creation of <nvpair> with id="dummy-meta_attributes-target-role"
Set 'dummy' option: id=dummy-meta_attributes-target-role set=dummy-meta_attributes name=target-role value=Stopped
=#=#=#= Current cib after: niceguy: Create a resource meta attribute =#=#=#=
<cib epoch="14" num_updates="0" admin_epoch="0">
Expand Down Expand Up @@ -1293,7 +1293,7 @@ Deleted 'dummy' option: id=dummy-meta_attributes-target-role name=target-role
* Passed: crm_resource - niceguy: Remove a resource meta attribute
=#=#=#= Begin test: niceguy: Create a resource meta attribute =#=#=#=
unpack_resources error: Resource start-up disabled since no fencing resources have been defined. Either configure some or disable fencing with the fencing-enabled option. NOTE: Clusters with shared data need fencing to ensure data integrity.
pcmk__apply_creation_acl trace: ACLs allow creation of <nvpair> with id="dummy-meta_attributes-target-role"
check_creation_disallowed trace: ACLs allow creation of <nvpair> with id="dummy-meta_attributes-target-role"
Set 'dummy' option: id=dummy-meta_attributes-target-role set=dummy-meta_attributes name=target-role value=Started
=#=#=#= Current cib after: niceguy: Create a resource meta attribute =#=#=#=
<cib epoch="16" num_updates="0" admin_epoch="0">
Expand Down Expand Up @@ -1514,7 +1514,7 @@ cibadmin: CIB API call failed: Permission denied
=#=#=#= Begin test: niceguy: Replace - create resource =#=#=#=
pcmk__check_acl trace: Default ACL denies user 'niceguy' read/write access to /cib[@epoch]
pcmk__check_acl trace: Default ACL denies user 'niceguy' read/write access to /cib/configuration/resources/primitive[@id='dummy2']
pcmk__apply_creation_acl trace: ACLs disallow creation of <primitive> with id="dummy2"
check_creation_disallowed trace: ACLs disallow creation of <primitive> with id="dummy2"
cibadmin: CIB API call failed: Permission denied
=#=#=#= End test: niceguy: Replace - create resource - Insufficient privileges (4) =#=#=#=
* Passed: cibadmin - niceguy: Replace - create resource
Expand Down Expand Up @@ -2546,7 +2546,7 @@ cibadmin: CIB API call failed: Permission denied
<status/>
</cib>
=#=#=#= Begin test: mike: Create another resource =#=#=#=
pcmk__apply_creation_acl trace: ACLs allow creation of <primitive> with id="dummy2"
check_creation_disallowed trace: ACLs allow creation of <primitive> with id="dummy2"
=#=#=#= Current cib after: mike: Create another resource =#=#=#=
<cib epoch="26" num_updates="0" admin_epoch="0">
<configuration>
Expand Down
3 changes: 2 additions & 1 deletion cts/cts-cli.in
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ def sanitize_output(s):
(r'(<change-attr name="crm_feature_set" .* value=")[0-9.]*"', r'\1"'),
(r'(<change-attr name="validate-with" .* value="pacemaker-)[0-9.]+"', r'\1X"'),
(r'(<cib.*) cib-last-written="[^"]*"', r'\1'),
(r'\((check_creation_disallowed.*)@.*\.c:[0-9]+\)', r'\1'),
(r'crm_feature_set="[^"]*" ', r''),
(r'@crm_feature_set=[0-9.]+, ', r''),
(r'\(crm_time_parse_duration@.*\.c:[0-9]+\)', r'crm_time_parse_duration'),
Expand Down Expand Up @@ -2942,7 +2943,7 @@ class AclsRegressionTest(RegressionTest):
return [
ShadowTestGroup(basic_tests + [
TestGroup(loop_tests,
env={"PCMK_trace_functions": "pcmk__check_acl,pcmk__apply_creation_acl"})]),
env={"PCMK_trace_functions": "pcmk__check_acl,check_creation_disallowed"})]),
]


Expand Down
5 changes: 3 additions & 2 deletions daemons/attrd/attrd_messages.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ int minimum_protocol_version = -1;
static GHashTable *attrd_handlers = NULL;

static bool
is_sync_point_attr(xmlAttrPtr attr, void *data)
is_sync_point_attr(const xmlAttr *attr, void *data)
{
return pcmk__str_eq((const char *) attr->name, PCMK__XA_ATTR_SYNC_POINT, pcmk__str_none);
return pcmk__str_eq((const char *) attr->name, PCMK__XA_ATTR_SYNC_POINT,
pcmk__str_none);
}

static int
Expand Down
8 changes: 3 additions & 5 deletions daemons/controld/controld_join_dc.c
Original file line number Diff line number Diff line change
Expand Up @@ -968,11 +968,9 @@ finalize_join_for(gpointer key, gpointer value, gpointer user_data)
}

remote = pcmk__xe_create(remotes, PCMK_XE_NODE);
pcmk__xe_set_props(remote,
PCMK_XA_ID, node->name,
PCMK__XA_NODE_STATE, node->state,
PCMK__XA_CONNECTION_HOST, node->conn_host,
NULL);
pcmk__xe_set(remote, PCMK_XA_ID, node->name);
pcmk__xe_set(remote, PCMK__XA_NODE_STATE, node->state);
pcmk__xe_set(remote, PCMK__XA_CONNECTION_HOST, node->conn_host);
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions daemons/pacemakerd/pacemakerd.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ PCMK__OUTPUT_ARGS("features")
static int
pacemakerd_features_xml(pcmk__output_t *out, va_list args) {
gchar **feature_list = g_strsplit(CRM_FEATURES, " ", 0);
xmlNode *xml = pcmk__output_xml_create_parent(out, PCMK_XE_PACEMAKERD);

pcmk__xe_set(xml, PCMK_XA_VERSION, PACEMAKER_VERSION);
pcmk__xe_set(xml, PCMK_XA_BUILD, BUILD_VERSION);
pcmk__xe_set(xml, PCMK_XA_FEATURE_SET, CRM_FEATURE_SET);

pcmk__output_xml_create_parent(out, PCMK_XE_PACEMAKERD,
PCMK_XA_VERSION, PACEMAKER_VERSION,
PCMK_XA_BUILD, BUILD_VERSION,
PCMK_XA_FEATURE_SET, CRM_FEATURE_SET,
NULL);
out->begin_list(out, NULL, NULL, PCMK_XE_FEATURES);

for (char **s = feature_list; *s != NULL; s++) {
Expand Down
5 changes: 0 additions & 5 deletions include/crm/common/acl.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ extern "C" {
*/

void xml_acl_disable(xmlNode *xml);
bool xml_acl_denied(const xmlNode *xml);
bool xml_acl_filtered_copy(const char *user, xmlNode* acl_source, xmlNode *xml,
xmlNode **result);

bool pcmk_acl_required(const char *user);

#ifdef __cplusplus
}
Expand Down
10 changes: 10 additions & 0 deletions include/crm/common/acl_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ extern "C" {
//! \deprecated Do not use
bool xml_acl_enabled(const xmlNode *xml);

//! \deprecated Do not use
bool xml_acl_filtered_copy(const char *user, xmlNode *acl_source, xmlNode *xml,
xmlNode **result);

//! \deprecated Do not use
bool xml_acl_denied(const xmlNode *xml);

//! \deprecated Do not use
bool pcmk_acl_required(const char *user);

#ifdef __cplusplus
}
#endif
Expand Down
20 changes: 19 additions & 1 deletion include/crm/common/acl_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,25 @@ pcmk__is_privileged(const char *user)
return user && (!strcmp(user, CRM_DAEMON_USER) || !strcmp(user, "root"));
}

void pcmk__enable_acl(xmlNode *acl_source, xmlNode *target, const char *user);
/*!
* \internal
* \brief Check whether an ACL is required for a given user to access the CIB
*
* \param[in] user User name
*
* \return \c true if \p user requires an ACL to access the CIB, or \c false
* otherwise
*/
static inline bool
pcmk__acl_required(const char *user)
{
return !pcmk__str_empty(user) && !pcmk__is_privileged(user);
}

void pcmk__enable_acls(xmlDoc *source, xmlDoc *target, const char *user);

xmlNode *pcmk__acl_filtered_copy(const char *user, xmlDoc *acl_source,
xmlNode *xml);

bool pcmk__check_acl(xmlNode *xml, const char *attr_name,
enum pcmk__xml_flags mode);
Expand Down
1 change: 1 addition & 0 deletions include/crm/common/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
#include <crm/common/servers_internal.h>
#include <crm/common/tls_internal.h>
#include <crm/common/utils_internal.h>
// xml_attr_internal.h intentionally left out
// xml_comment_internal.h intentionally left out
// xml_element_internal.h intentionally left out
// xml_idref_internal.h intentionally left out
Expand Down
12 changes: 4 additions & 8 deletions include/crm/common/output_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -757,11 +757,9 @@ void pcmk__output_set_log_filter(pcmk__output_t *out, const char *file,
*
* \param[in,out] out The output functions structure.
* \param[in] name The name of the node to be created.
* \param[in] ... Name/value pairs to set as XML properties.
*/
xmlNodePtr
pcmk__output_xml_create_parent(pcmk__output_t *out, const char *name, ...)
G_GNUC_NULL_TERMINATED;
xmlNode *
pcmk__output_xml_create_parent(pcmk__output_t *out, const char *name);

/*!
* \internal
Expand All @@ -781,11 +779,9 @@ pcmk__output_xml_add_node_copy(pcmk__output_t *out, xmlNodePtr node);
*
* \param[in,out] out The output functions structure.
* \param[in] name The name of the node to be created.
* \param[in] ... Name/value pairs to set as XML properties.
*/
xmlNodePtr
pcmk__output_create_xml_node(pcmk__output_t *out, const char *name, ...)
G_GNUC_NULL_TERMINATED;
xmlNode *
pcmk__output_create_xml_node(pcmk__output_t *out, const char *name);

/*!
* \internal
Expand Down
32 changes: 32 additions & 0 deletions include/crm/common/xml_attr_internal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright 2025 the Pacemaker project contributors
*
* The version control history for this file may have further details.
*
* This source code is licensed under the GNU Lesser General Public License
* version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
*/

#ifndef PCMK__CRM_COMMON_XML_ATTR_INTERNAL__H
#define PCMK__CRM_COMMON_XML_ATTR_INTERNAL__H

/*
* Internal-only wrappers for and extensions to libxml2 for processing XML
* attributes
*/

#include <stdbool.h> // bool

#include <libxml/tree.h> // xmlAttr

#ifdef __cplusplus
extern "C" {
#endif

bool pcmk__xa_insert_dup(const xmlAttr *attr, void *user_data);

#ifdef __cplusplus
}
#endif

#endif // PCMK__XML_ATTR_INTERNAL__H
33 changes: 7 additions & 26 deletions include/crm/common/xml_element_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,19 @@ extern "C" {

const char *pcmk__xe_add_last_written(xmlNode *xe);

bool pcmk__xe_foreach_attr(xmlNode *xml, bool (*fn)(xmlAttr *, void *),
void *user_data);
bool pcmk__xe_foreach_const_attr(const xmlNode *xml,
bool (*fn)(const xmlAttr *, void *),
void *user_data);

xmlNode *pcmk__xe_first_child(const xmlNode *parent, const char *node_name,
const char *attr_n, const char *attr_v);

void pcmk__xe_remove_attr(xmlNode *element, const char *name);
bool pcmk__xe_remove_attr_cb(xmlNode *xml, void *user_data);
void pcmk__xe_remove_matching_attrs(xmlNode *element, bool force,
bool (*match)(xmlAttrPtr, void *),
bool (*match)(const xmlAttr *, void *),
void *user_data);
int pcmk__xe_delete_match(xmlNode *xml, xmlNode *search);
int pcmk__xe_replace_match(xmlNode *xml, xmlNode *replace);
Expand Down Expand Up @@ -80,31 +86,6 @@ void pcmk__xe_sort_attrs(xmlNode *xml);
void pcmk__xe_set_id(xmlNode *xml, const char *format, ...)
G_GNUC_PRINTF(2, 3);

/*!
* \internal
* \brief Like pcmk__xe_set_props, but takes a va_list instead of
* arguments directly.
*
* \param[in,out] node XML to add attributes to
* \param[in] pairs NULL-terminated list of name/value pairs to add
*/
void
pcmk__xe_set_propv(xmlNodePtr node, va_list pairs);

/*!
* \internal
* \brief Add a NULL-terminated list of name/value pairs to the given
* XML node as properties.
*
* \param[in,out] node XML node to add properties to
* \param[in] ... NULL-terminated list of name/value pairs
*
* \note A NULL name terminates the arguments; a NULL value will be skipped.
*/
void
pcmk__xe_set_props(xmlNodePtr node, ...)
G_GNUC_NULL_TERMINATED;

/*!
* \internal
* \brief Get first attribute of an XML element
Expand Down
24 changes: 18 additions & 6 deletions include/crm/common/xml_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@
#include <crm/common/xml_names.h> // PCMK_XA_ID, PCMK_XE_CLONE

// This file is a wrapper for other {xml_*,xpath}_internal.h headers
#include <crm/common/xml_attr_internal.h>
#include <crm/common/xml_comment_internal.h>
#include <crm/common/xml_element_internal.h>
#include <crm/common/xml_idref_internal.h>
#include <crm/common/xml_io_internal.h>
#include <crm/common/xml_names_internal.h>
#include <crm/common/xml_tracking_internal.h>
#include <crm/common/xpath_internal.h>

#include <libxml/relaxng.h>
Expand Down Expand Up @@ -259,7 +261,6 @@ enum pcmk__xml_escape_type {
pcmk__xml_escape_attr_pretty,
};

bool pcmk__xml_needs_escape(const char *text, enum pcmk__xml_escape_type type);
char *pcmk__xml_escape(const char *text, enum pcmk__xml_escape_type type);

/*!
Expand Down Expand Up @@ -425,17 +426,28 @@ enum pcmk__xml_flags {
void pcmk__xml_doc_set_flags(xmlDoc *doc, uint32_t flags);
bool pcmk__xml_doc_all_flags_set(const xmlDoc *xml, uint32_t flags);

void pcmk__xml_commit_changes(xmlDoc *doc);
void pcmk__xml_mark_changes(xmlNode *old_xml, xmlNode *new_xml);

bool pcmk__xml_foreach_child(xmlNode *xml, bool (*fn)(xmlNode *, void *),
void *user_data);
bool pcmk__xml_tree_foreach(xmlNode *xml, bool (*fn)(xmlNode *, void *),
void *user_data);

/*!
* \internal
* \brief Get an XML attribute's value
*
* \param[in] attr XML attribute
*
* \return Value of \p attr, or \c NULL if \p attr is \c NULL or its value is
* unset
*/
static inline const char *
pcmk__xml_attr_value(const xmlAttr *attr)
{
return ((attr == NULL) || (attr->children == NULL))? NULL
: (const char *) attr->children->content;
if ((attr == NULL) || (attr->children == NULL)) {
return NULL;
}

return (const char *) attr->children->content;
}

void pcmk__xml_patchset_add_digest(xmlNode *patchset, const xmlNode *target);
Expand Down
Loading