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
62dae2e
Refactor: libcrmcommon: Unindent a block in xml_acl_filtered_copy()
nrwahl2 Dec 25, 2025
97f49e1
Refactor: libcrmcommon: Rename some variables in xml_acl_filtered_copy()
nrwahl2 Dec 25, 2025
55b423d
Refactor: libcrmcommon: Unindent a block of xml_acl_filtered_copy()
nrwahl2 Dec 25, 2025
c08b755
Refactor: libcrmcommon: Drop target NULL check in loop condition
nrwahl2 Dec 25, 2025
82600d8
Refactor: libcrmcommon: pcmk__xe_first_child() in purge_xml_attributes()
nrwahl2 Dec 25, 2025
3fcb626
Refactor: libcrmcommon: Drop xIter in purge_xml_attributes()
nrwahl2 Dec 25, 2025
9998517
Refactor: libcrmcommon: Functionize applying a single ACL
nrwahl2 Dec 25, 2025
fddf237
Refactor: libcrmcommon: Create GString unconditionally in apply_acl()
nrwahl2 Dec 25, 2025
039a6fa
Refactor: libcrmcommon: Use const in pcmk__apply_acls()
nrwahl2 Dec 25, 2025
219d56c
Refactor: libcrmcommon: pcmk__apply_acls() takes an xmlDoc *
nrwahl2 Dec 25, 2025
d26f591
Refactor: libcrmcommon: pcmk__xpath_foreach_result in pcmk__apply_acls
nrwahl2 Dec 25, 2025
f7726f3
Refactor: libcrmcommon: Assert arg not NULL in pcmk__unpack_acl()
nrwahl2 Dec 25, 2025
795c87e
Refactor: libcrmcommon: Reduce duplication in pcmk__apply_acls()
nrwahl2 Dec 25, 2025
cb20b2e
Refactor: libcrmcommon: Continue on NULL id in pcmk__unpack_acls()
nrwahl2 Dec 25, 2025
220cc9d
Refactor: libcrmcommon: Reduce some duplication in pcmk__unpack_acls()
nrwahl2 Dec 25, 2025
bc94853
Refactor: libcrmcommon: Unindent loop in pcmk__unpack_acls()
nrwahl2 Dec 25, 2025
f39faae
Refactor: libcrmcommon: Unindent more of pcmk__unpack_acls()
nrwahl2 Dec 25, 2025
646c849
Refactor: libcrmcommon: parse_acl_entry() specifies element in iterators
nrwahl2 Dec 25, 2025
8586caf
Refactor: libcrmcommon: Functionize unpacking ACL permission
nrwahl2 Dec 25, 2025
65e0ba3
Log: libcrmcommon: Set config warnings and errors for acl_permission
nrwahl2 Dec 25, 2025
5653d8a
Refactor: libcrmcommon: Move pcmk__unpack_acls() definition
nrwahl2 Dec 25, 2025
fad3b6c
Refactor: libcrmcommon: Functionizing unpacking an ACL role reference
nrwahl2 Dec 25, 2025
af06450
Refactor: libcrmcommon: Functionize resolving an ACL role reference
nrwahl2 Dec 25, 2025
a1d3637
Fix: libcrmcommon: Make parse_acl_entry() non-recursive
nrwahl2 Dec 26, 2025
10f9253
Refactor: libcrmcommon: Functionize unpacking child of ACL target/group
nrwahl2 Dec 26, 2025
8cbf8ae
Refactor: libcrmcommon: Functionize unpacking ACL target or group
nrwahl2 Dec 26, 2025
81ead5b
Refactor: libcrmcommon: Functionize parsing ACL target/group separately
nrwahl2 Dec 26, 2025
ae5e0c3
Refactor: libcrmcommon: Use more literals in ACL unpack log messages
nrwahl2 Dec 26, 2025
893c5a7
Refactor: libcrmcommon: Take xml_doc_private_t in pcmk__unpack_acls()
nrwahl2 Dec 26, 2025
f73cbdb
Fix: libcrmcommon: xml_acl_filtered_copy() returns false for NULL source
nrwahl2 Dec 26, 2025
f52940e
Refactor: libcrmcommon: pcmk__enable_acl() takes xmlDoc args
nrwahl2 Dec 26, 2025
aeb68cc
Refactor: libcrmcommon: Use g_clear_pointer in reset_xml_private_data()
nrwahl2 Dec 26, 2025
05f9a38
Refactor: libcrmcommon: Set config error on unspecified ACL permission
nrwahl2 Dec 26, 2025
ed2097f
Refactor: libcrmcommon: create_acl() returns xml_acl_t *
nrwahl2 Dec 26, 2025
d623cd3
Refactor: libcrmcommon: Unindent create_acl()
nrwahl2 Dec 26, 2025
f08c68c
Refactor: libcrmcommon: Use g_string_append_printf() in create_acl()
nrwahl2 Dec 26, 2025
bed4d89
Log: libcrmcommon: Set config warnings on mismatched ACL perm specs
nrwahl2 Dec 26, 2025
6253a43
Doc: libcrmcommon: Drop ACL snippet comment
nrwahl2 Dec 26, 2025
e9ad11d
Refactor: libcrmcommon: Use pcmk__is_privileged() in pcmk_acl_required()
nrwahl2 Dec 26, 2025
a82b84c
Refactor: libcrmcommon: Use g_list_foreach() in pcmk__apply_acls()
nrwahl2 Dec 26, 2025
9dfee39
Refactor: libcrmcommon: pcmk__xe_foreach_child in unpack_acl_role_ref
nrwahl2 Dec 26, 2025
f0df250
Refactor: libcrmcommon: Rename acl_to_text() to acl_mode_text()
nrwahl2 Dec 26, 2025
ca88b97
Doc: libcrmcommon: Add Doxygen to ACL apply functions
nrwahl2 Dec 26, 2025
8e3a386
Refactor: libcrmcommon: Add Doxygen for test_acl_mode()
nrwahl2 Dec 26, 2025
afd9432
Refactor: libcrmcommon: Use a switch statement in is_mode_allowed()
nrwahl2 Dec 26, 2025
01682dd
Doc: libcrmcommon: Clarify that pcmk__element_xpath() returns non-NULL
nrwahl2 Dec 26, 2025
9ec9d45
Refactor: libcrmcommon: Use convenience helpers in implicitly_allowed()
nrwahl2 Dec 26, 2025
dafb260
Refactor: libcrmcommon: Walk up the tree in implicitly_allowed()
nrwahl2 Dec 26, 2025
f2dae35
Refactor: libcrmcommon, libpe_status: Drop strncmp() calls
nrwahl2 Dec 26, 2025
3669d06
Refactor: libcrmcommon: Drop a redundant check in pcmk__xa_remove()
nrwahl2 Dec 26, 2025
cd4780b
Refactor: libcrmcommon: Check force arg sooner in pcmk__xa_remove()
nrwahl2 Dec 26, 2025
e405a1d
Refactor: libcrmcommon: Functionize cases of new_private_data()
nrwahl2 Dec 26, 2025
cce579e
Refactor: libcrmcommon: New pcmk__xe_foreach{,_const}_attr()
nrwahl2 Dec 27, 2025
21b1e54
Refactor: libcrmcommon: pcmk__xe_foreach_attr() in new_private_data()
nrwahl2 Dec 26, 2025
a62b455
Refactor: libcrmcommon: Clear flags in reset_xml_private_data()
nrwahl2 Dec 27, 2025
1f979b3
Refactor: libcrmcommon: pcmk__xe_foreach_attr() in free_private_data()
nrwahl2 Dec 27, 2025
4cdcb41
Refactor: libcrmcommon: Use a for-loop in xml_diff_old_attrs()
nrwahl2 Dec 27, 2025
724576d
Refactor: libcrmcommon: Unindent else block in xml_diff_old_attrs()
nrwahl2 Dec 27, 2025
86025c8
Refactor: libcrmcommon: Unindent a bit more of xml_diff_old_attrs()
nrwahl2 Dec 27, 2025
c77dfb3
Refactor: libcrmcommon: pcmk__xe_foreach_attr() in xml_diff_old_attrs()
nrwahl2 Dec 27, 2025
f2f2656
Refactor: libcrmcommon: Drop redundant check from mark_attr_diff()
nrwahl2 Dec 27, 2025
b947072
Refactor: libcrmcommon: Drop redundant args from mark_attr_*() functions
nrwahl2 Dec 27, 2025
f380d41
Refactor: libcrmcommon: Use for loop in mark_created_attrs()
nrwahl2 Dec 27, 2025
930aebe
Refactor: libcrmcommon: Unindent most of for loop in mark_created_attrs
nrwahl2 Dec 27, 2025
11de7d5
Refactor: libcrmcommon: pcmk__xe_foreach_attr() for mark_created_attrs()
nrwahl2 Dec 27, 2025
4129bd6
Refactor: libcrmcommon: New mark_attr_created()
nrwahl2 Dec 27, 2025
d18b5a1
Refactor: libcrmcommon: pcmk__xe_copy_attrs pcmk__xe_foreach_const_attr
nrwahl2 Dec 27, 2025
28c5bb4
Refactor: libcrmcommon: Use foreach functions in pcmk__xe_sort_attrs()
nrwahl2 Dec 27, 2025
8358ea5
Refactor: libcrmcommon: pcmk__xe_foreach_attr for matching attr removal
nrwahl2 Dec 27, 2025
21e9c7e
Refactor: libcrmcommon: delete matching xe pcmk__xe_foreach_const_attr
nrwahl2 Dec 27, 2025
b47d401
Refactor: libpe_status: get_meta_attributes pcmk__xe_foreach_const_attr
nrwahl2 Dec 27, 2025
e3dbe30
Refactor: libcrmcommon: pcmk__xe_foreach_const_attr() in xml2list()
nrwahl2 Dec 27, 2025
f5a1adc
Refactor: libcrmcommon: Drop check in add_xml_changes_to_patchset()
nrwahl2 Dec 27, 2025
e0ab911
Refactor: libcrmcommon: Drop xpath check in add_xml_changes_to_patchset
nrwahl2 Dec 27, 2025
7d63854
Refactor: libcrmcommon: Clarify pointers in add_xml_changes_to_patchset
nrwahl2 Dec 27, 2025
1b9f2e9
Refactor: libcrmcommon: Use foreach for adding attr changes to patchset
nrwahl2 Dec 27, 2025
49e6076
Refactor: libcrmcommon: Drop cIter in add_xml_changes_to_patchset()
nrwahl2 Dec 27, 2025
6923009
Refactor: libcrmcommon: Functionize adding modify change to patchset
nrwahl2 Dec 27, 2025
a290006
Refactor: libcrmcommon: Functionize adding create change to patchset
nrwahl2 Dec 27, 2025
91bc993
Refactor: libcrmcommon: Functionize adding move change to patchset
nrwahl2 Dec 27, 2025
f6b5eeb
Refactor: libcrmcommon: Add modify change only if xml is dirty
nrwahl2 Dec 27, 2025
edc951c
Refactor: libcrmcommon: Functionize adding delete change to patchset
nrwahl2 Dec 27, 2025
a1fb007
Refactor: libcrmcommon: Minor xml_create_patchset_v2() improvements
nrwahl2 Dec 27, 2025
45673f2
Refactor: libcrmcommon: Functionize setting version fields in patchset
nrwahl2 Dec 27, 2025
26793d8
Refactor: libcrmcommon: pcmk__xe_copy_attrs() in apply_v2_patchset()
nrwahl2 Dec 27, 2025
8960a7c
Refactor: libcrmcommon: implicitly_allowed() pcmk__xe_foreach_const_attr
nrwahl2 Dec 27, 2025
668fbde
Refactor: libcrmcommon: Clarify pcmk__xml_attr_value()
nrwahl2 Dec 27, 2025
c266e79
Refactor: libcrmcommon: Simplify/clarify pcmk__dump_xml_attr()
nrwahl2 Dec 27, 2025
a8fa49a
Refactor: libcrmcommon: pcmk__xe_foreach_const_attr in dump_xml_element
nrwahl2 Dec 27, 2025
e88a137
Low: libcrmcommon: Drop "<null>" fallback in show_xml_element()
nrwahl2 Dec 28, 2025
1a88d76
Refactor: libcrmcommon: Call pcmk__dump_xml_attr() in show_xml_element()
nrwahl2 Dec 28, 2025
c017b7b
Refactor: libcrmcommon: Drop a couple checks from show_xml_element()
nrwahl2 Dec 28, 2025
66c7e4e
Refactor: libcrmcommon: pcmk__xe_foreach_const_attr in show_xml_element
nrwahl2 Dec 28, 2025
98a7921
Refactor: libcrmcommon: Functionize checking whether attribute is hidden
nrwahl2 Dec 28, 2025
22ee7e6
Refactor: libcrmcommon: Rename show_xml_changes_recursive argument
nrwahl2 Dec 28, 2025
77f52ca
Refactor: libcrmcommon: foreach_const_attr in show_xml_changes_recursive
nrwahl2 Dec 28, 2025
3beded6
Refactor: libcrmcommon: foreach const attr in pcmk__xe_sort_attrs test
nrwahl2 Dec 28, 2025
8f8ed13
Refactor: libpe_status: foreach_const_attr in pcmk__unpack_action_meta
nrwahl2 Dec 29, 2025
ca2c1ad
Refactor: libcrmcommon: foreach_const_attr() in unpack_ticket_state()
nrwahl2 Dec 29, 2025
1c02a84
Refactor: libcrmcommon: Drop side effect from pcmk__marked_as_deleted()
nrwahl2 Dec 28, 2025
9058a2e
Refactor: libcrmcommon: pcmk__xe_remove_matching_attrs() match const arg
nrwahl2 Dec 28, 2025
8e81e9e
Refactor: libcrmcommon: New pcmk__xml_tree_foreach_remove()
nrwahl2 Dec 26, 2025
6c24b11
Refactor: libcrmcommon: Unindent pcmk__apply_creation_acl()
nrwahl2 Dec 26, 2025
6b6647f
Refactor: libcrmcommon: Make pcmk__apply_creation_acl() non-recursive
nrwahl2 Dec 26, 2025
5a01fc2
Refactor: libcrmcommon: Unindent is_config_change()
nrwahl2 Dec 28, 2025
a285f35
Refactor: libcrmcommon: Minor best practices in is_config_change()
nrwahl2 Dec 28, 2025
50f7fd8
Refactor: libcrmcommon: Functionize search for deleted config element
nrwahl2 Dec 28, 2025
a493cc2
Refactor: libcrmcommon: Functionize filtering by one ACL
nrwahl2 Dec 28, 2025
fabf0ab
Refactor: libcrmcommon: Functionize ACL-filtering one match
nrwahl2 Dec 28, 2025
0e7a667
Refactor: libcrmcommon: Reorganize xml_acl_filtered_copy()
nrwahl2 Dec 28, 2025
20f0224
Refactor: libcrmcommon: Don't delete attrs if we're going to delete node
nrwahl2 Dec 28, 2025
af56614
Refactor: libcrmcommon: Clarify xml_acl_filtered_copy()
nrwahl2 Dec 28, 2025
64d3e56
Refactor: libcrmcommon: New pcmk__acl_filtered_copy()
nrwahl2 Dec 29, 2025
d0fbafb
API: libcrmcommon: Deprecate xml_acl_filtered_copy()
nrwahl2 Dec 29, 2025
6e38d6f
Refactor: libcrmcommon: Make pcmk__unpack_acls() static
nrwahl2 Dec 29, 2025
26b72ac
Refactor: libcrmcommon: Unindent xml_acl_disable()
nrwahl2 Dec 29, 2025
c56fc95
Refactor: libcrmcommon: New pcmk__xml_doc_clear_flags()
nrwahl2 Dec 29, 2025
868edc8
Refactor: libcrmcommon: Simplify xml_acl_denied()
nrwahl2 Dec 29, 2025
44cf798
Refactor: libcrmcommon: Drop xml_acl_denied() internally
nrwahl2 Dec 29, 2025
d66b9a0
API: libcrmcommon: Deprecate xml_acl_denied()
nrwahl2 Dec 29, 2025
b90dd57
Refactor: libcrmcommon: New pcmk__acl_required()
nrwahl2 Dec 29, 2025
83128e4
API: libcrmcommon: Deprecate pcmk_acl_required()
nrwahl2 Dec 29, 2025
bc4ca6c
Refactor: libcrmcommon: Move pcmk__is_user_in_group_test.c to utils
nrwahl2 Dec 29, 2025
27ff61f
Refactor: libcrmcommon: Functionize appending XML-escaped character
nrwahl2 Dec 30, 2025
6360108
Refactor: libcrmcommon: Functionize XML escape append modes
nrwahl2 Dec 30, 2025
bad3c89
Refactor: libcrmcommon: Drop pcmk__xml_needs_escape()
nrwahl2 Dec 30, 2025
284b446
Refactor: libcrmcommon: New pcmk__xml_foreach_child()
nrwahl2 Dec 30, 2025
026834d
Refactor: libcrmcommon: Functionize check/set matching XML children
nrwahl2 Dec 30, 2025
8e8f404
Refactor: libcrmcommon: Use foreach_child for find_matching_children
nrwahl2 Dec 30, 2025
671d913
Refactor: libcrmcommon: Functionize marking child changed or deleted
nrwahl2 Dec 30, 2025
3533310
Refactor: libcrmcommon: Functionize marking child moved or created
nrwahl2 Dec 30, 2025
90eec34
Refactor: libcrmcommon: Functionize marking child as created
nrwahl2 Dec 30, 2025
1767d61
Refactor: libcrmcommon: Defunctionize mark_xml_tree_dirty_created()
nrwahl2 Dec 30, 2025
ba1a27c
Refactor: libcrmcommon: Expose reset_doc_private_data() as lib-private
nrwahl2 Dec 30, 2025
71bfa68
Refactor: libcrmcommon: Expose free_xml_with_position() as lib-private
nrwahl2 Dec 30, 2025
3436a58
Refactor: libcrmcommon: Split XML change code into its own file
nrwahl2 Dec 30, 2025
2301eb0
Refactor: libcrmcommon: Drop pcmk__xe_set_props()
nrwahl2 Dec 30, 2025
0bd5ff4
Refactor: libpe_status: Return void from pe__name_and_nvpairs_xml()
nrwahl2 Dec 30, 2025
447a929
Refactor: libpe_status: Drop pe__name_and_nvpairs_xml()
nrwahl2 Dec 30, 2025
528489b
Refactor: libcrmcommon: pcmk__output_xml_create_parent() drops list arg
nrwahl2 Dec 30, 2025
b41a21b
Refactor: libcrmcommon: pcmk__output_create_xml_node() drops list arg
nrwahl2 Dec 31, 2025
4ab2d0e
Refactor: libpe_status: Drop a pcmk__itoa() call
nrwahl2 Dec 31, 2025
4141f17
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