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
8d9d278
Refactor: libcrmcommon: Unindent a block in xml_acl_filtered_copy()
nrwahl2 Dec 25, 2025
908319a
Refactor: libcrmcommon: Rename some variables in xml_acl_filtered_copy()
nrwahl2 Dec 25, 2025
bbbbedf
Refactor: libcrmcommon: Unindent a block of xml_acl_filtered_copy()
nrwahl2 Dec 25, 2025
ba110bb
Refactor: libcrmcommon: Drop target NULL check in loop condition
nrwahl2 Dec 25, 2025
293beee
Refactor: libcrmcommon: pcmk__xe_first_child() in purge_xml_attributes()
nrwahl2 Dec 25, 2025
3462a01
Refactor: libcrmcommon: Drop xIter in purge_xml_attributes()
nrwahl2 Dec 25, 2025
9d1b839
Refactor: libcrmcommon: Functionize applying a single ACL
nrwahl2 Dec 25, 2025
e59fa42
Refactor: libcrmcommon: Create GString unconditionally in apply_acl()
nrwahl2 Dec 25, 2025
52776b9
Refactor: libcrmcommon: Use const in pcmk__apply_acls()
nrwahl2 Dec 25, 2025
ed9da9f
Refactor: libcrmcommon: pcmk__apply_acls() takes an xmlDoc *
nrwahl2 Dec 25, 2025
6251f81
Refactor: libcrmcommon: pcmk__xpath_foreach_result in pcmk__apply_acls
nrwahl2 Dec 25, 2025
086c129
Refactor: libcrmcommon: Assert arg not NULL in pcmk__unpack_acl()
nrwahl2 Dec 25, 2025
e059305
Refactor: libcrmcommon: Reduce duplication in pcmk__apply_acls()
nrwahl2 Dec 25, 2025
aa767ba
Refactor: libcrmcommon: Continue on NULL id in pcmk__unpack_acls()
nrwahl2 Dec 25, 2025
602d2f1
Refactor: libcrmcommon: Reduce some duplication in pcmk__unpack_acls()
nrwahl2 Dec 25, 2025
07cd34c
Refactor: libcrmcommon: Unindent loop in pcmk__unpack_acls()
nrwahl2 Dec 25, 2025
d6f1616
Refactor: libcrmcommon: Unindent more of pcmk__unpack_acls()
nrwahl2 Dec 25, 2025
763931d
Refactor: libcrmcommon: parse_acl_entry() specifies element in iterators
nrwahl2 Dec 25, 2025
b32e616
Refactor: libcrmcommon: Functionize unpacking ACL permission
nrwahl2 Dec 25, 2025
11bac90
Log: libcrmcommon: Set config warnings and errors for acl_permission
nrwahl2 Dec 25, 2025
61361e4
Refactor: libcrmcommon: Move pcmk__unpack_acls() definition
nrwahl2 Dec 25, 2025
06ba3ca
Refactor: libcrmcommon: Functionizing unpacking an ACL role reference
nrwahl2 Dec 25, 2025
5187948
Refactor: libcrmcommon: Functionize resolving an ACL role reference
nrwahl2 Dec 25, 2025
796ec94
Fix: libcrmcommon: Make parse_acl_entry() non-recursive
nrwahl2 Dec 26, 2025
7e3ce90
Refactor: libcrmcommon: Functionize unpacking child of ACL target/group
nrwahl2 Dec 26, 2025
1485195
Refactor: libcrmcommon: Functionize unpacking ACL target or group
nrwahl2 Dec 26, 2025
a6f1b73
Refactor: libcrmcommon: Functionize parsing ACL target/group separately
nrwahl2 Dec 26, 2025
4b9a97f
Refactor: libcrmcommon: Use more literals in ACL unpack log messages
nrwahl2 Dec 26, 2025
f841377
Refactor: libcrmcommon: Take xml_doc_private_t in pcmk__unpack_acls()
nrwahl2 Dec 26, 2025
2a3a358
Fix: libcrmcommon: xml_acl_filtered_copy() returns false for NULL source
nrwahl2 Dec 26, 2025
5461967
Refactor: libcrmcommon: pcmk__enable_acl() takes xmlDoc args
nrwahl2 Dec 26, 2025
25f54f9
Refactor: libcrmcommon: Use g_clear_pointer in reset_xml_private_data()
nrwahl2 Dec 26, 2025
76bc60a
Refactor: libcrmcommon: Set config error on unspecified ACL permission
nrwahl2 Dec 26, 2025
d0b9b38
Refactor: libcrmcommon: create_acl() returns xml_acl_t *
nrwahl2 Dec 26, 2025
1b30792
Refactor: libcrmcommon: Unindent create_acl()
nrwahl2 Dec 26, 2025
30b31ec
Refactor: libcrmcommon: Use g_string_append_printf() in create_acl()
nrwahl2 Dec 26, 2025
c631786
Log: libcrmcommon: Set config warnings on mismatched ACL perm specs
nrwahl2 Dec 26, 2025
7a5bf1e
Doc: libcrmcommon: Drop ACL snippet comment
nrwahl2 Dec 26, 2025
73454d5
Refactor: libcrmcommon: Use pcmk__is_privileged() in pcmk_acl_required()
nrwahl2 Dec 26, 2025
c66d4fd
Refactor: libcrmcommon: Use g_list_foreach() in pcmk__apply_acls()
nrwahl2 Dec 26, 2025
46f8e1e
Refactor: libcrmcommon: pcmk__xe_foreach_child in unpack_acl_role_ref
nrwahl2 Dec 26, 2025
d1931f9
Refactor: libcrmcommon: Rename acl_to_text() to acl_mode_text()
nrwahl2 Dec 26, 2025
9e38a57
Doc: libcrmcommon: Add Doxygen to ACL apply functions
nrwahl2 Dec 26, 2025
577bcfc
Refactor: libcrmcommon: Add Doxygen for test_acl_mode()
nrwahl2 Dec 26, 2025
ef23a09
Refactor: libcrmcommon: Use a switch statement in is_mode_allowed()
nrwahl2 Dec 26, 2025
613a97f
Doc: libcrmcommon: Clarify that pcmk__element_xpath() returns non-NULL
nrwahl2 Dec 26, 2025
ddb7929
Refactor: libcrmcommon: Use convenience helpers in implicitly_allowed()
nrwahl2 Dec 26, 2025
10f7f18
Refactor: libcrmcommon: Walk up the tree in implicitly_allowed()
nrwahl2 Dec 26, 2025
0fb3351
Refactor: libcrmcommon, libpe_status: Drop strncmp() calls
nrwahl2 Dec 26, 2025
78988fd
Refactor: libcrmcommon: Drop a redundant check in pcmk__xa_remove()
nrwahl2 Dec 26, 2025
f4ff721
Refactor: libcrmcommon: Check force arg sooner in pcmk__xa_remove()
nrwahl2 Dec 26, 2025
ca96e73
Refactor: libcrmcommon: Functionize cases of new_private_data()
nrwahl2 Dec 26, 2025
7f7df11
Refactor: libcrmcommon: New pcmk__xe_foreach{,_const}_attr()
nrwahl2 Dec 27, 2025
7479ab0
Refactor: libcrmcommon: pcmk__xe_foreach_attr() in new_private_data()
nrwahl2 Dec 26, 2025
6157860
Refactor: libcrmcommon: Clear flags in reset_xml_private_data()
nrwahl2 Dec 27, 2025
d6836bd
Refactor: libcrmcommon: pcmk__xe_foreach_attr() in free_private_data()
nrwahl2 Dec 27, 2025
26431a9
Refactor: libcrmcommon: Use a for-loop in xml_diff_old_attrs()
nrwahl2 Dec 27, 2025
10a4b90
Refactor: libcrmcommon: Unindent else block in xml_diff_old_attrs()
nrwahl2 Dec 27, 2025
002eb12
Refactor: libcrmcommon: Unindent a bit more of xml_diff_old_attrs()
nrwahl2 Dec 27, 2025
25f6cd8
Refactor: libcrmcommon: pcmk__xe_foreach_attr() in xml_diff_old_attrs()
nrwahl2 Dec 27, 2025
9a17ccb
Refactor: libcrmcommon: Drop redundant check from mark_attr_diff()
nrwahl2 Dec 27, 2025
89d054d
Refactor: libcrmcommon: Drop redundant args from mark_attr_*() functions
nrwahl2 Dec 27, 2025
c93c09f
Refactor: libcrmcommon: Use for loop in mark_created_attrs()
nrwahl2 Dec 27, 2025
aa17ba3
Refactor: libcrmcommon: Unindent most of for loop in mark_created_attrs
nrwahl2 Dec 27, 2025
ee86104
Refactor: libcrmcommon: pcmk__xe_foreach_attr() for mark_created_attrs()
nrwahl2 Dec 27, 2025
96ab50b
Refactor: libcrmcommon: New mark_attr_created()
nrwahl2 Dec 27, 2025
23fa3d7
Refactor: libcrmcommon: pcmk__xe_copy_attrs pcmk__xe_foreach_const_attr
nrwahl2 Dec 27, 2025
343a882
Refactor: libcrmcommon: Use foreach functions in pcmk__xe_sort_attrs()
nrwahl2 Dec 27, 2025
f25226b
Refactor: libcrmcommon: pcmk__xe_foreach_attr for matching attr removal
nrwahl2 Dec 27, 2025
928266b
Refactor: libcrmcommon: delete matching xe pcmk__xe_foreach_const_attr
nrwahl2 Dec 27, 2025
a1f6b17
Refactor: libpe_status: get_meta_attributes pcmk__xe_foreach_const_attr
nrwahl2 Dec 27, 2025
eec1304
Refactor: libcrmcommon: pcmk__xe_foreach_const_attr() in xml2list()
nrwahl2 Dec 27, 2025
4468abe
Refactor: libcrmcommon: Drop check in add_xml_changes_to_patchset()
nrwahl2 Dec 27, 2025
56f7f7e
Refactor: libcrmcommon: Drop xpath check in add_xml_changes_to_patchset
nrwahl2 Dec 27, 2025
b7a1556
Refactor: libcrmcommon: Clarify pointers in add_xml_changes_to_patchset
nrwahl2 Dec 27, 2025
e5dbc42
Refactor: libcrmcommon: Use foreach for adding attr changes to patchset
nrwahl2 Dec 27, 2025
d2ed262
Refactor: libcrmcommon: Drop cIter in add_xml_changes_to_patchset()
nrwahl2 Dec 27, 2025
3320d33
Refactor: libcrmcommon: Functionize adding modify change to patchset
nrwahl2 Dec 27, 2025
f90835e
Refactor: libcrmcommon: Functionize adding create change to patchset
nrwahl2 Dec 27, 2025
d73daba
Refactor: libcrmcommon: Functionize adding move change to patchset
nrwahl2 Dec 27, 2025
856124a
Refactor: libcrmcommon: Add modify change only if xml is dirty
nrwahl2 Dec 27, 2025
91e3981
Refactor: libcrmcommon: Functionize adding delete change to patchset
nrwahl2 Dec 27, 2025
44835ba
Refactor: libcrmcommon: Minor xml_create_patchset_v2() improvements
nrwahl2 Dec 27, 2025
84d9865
Refactor: libcrmcommon: Functionize setting version fields in patchset
nrwahl2 Dec 27, 2025
dd55f92
Refactor: libcrmcommon: pcmk__xe_copy_attrs() in apply_v2_patchset()
nrwahl2 Dec 27, 2025
9dce5f1
Refactor: libcrmcommon: implicitly_allowed() pcmk__xe_foreach_const_attr
nrwahl2 Dec 27, 2025
45729d5
Refactor: libcrmcommon: Clarify pcmk__xml_attr_value()
nrwahl2 Dec 27, 2025
e4aac99
Refactor: libcrmcommon: Simplify/clarify pcmk__dump_xml_attr()
nrwahl2 Dec 27, 2025
5e2cab9
Refactor: libcrmcommon: pcmk__xe_foreach_const_attr in dump_xml_element
nrwahl2 Dec 27, 2025
8b7adef
Low: libcrmcommon: Drop "<null>" fallback in show_xml_element()
nrwahl2 Dec 28, 2025
a83b98f
Refactor: libcrmcommon: Call pcmk__dump_xml_attr() in show_xml_element()
nrwahl2 Dec 28, 2025
8595d26
Refactor: libcrmcommon: Drop a couple checks from show_xml_element()
nrwahl2 Dec 28, 2025
05e21ea
Refactor: libcrmcommon: pcmk__xe_foreach_const_attr in show_xml_element
nrwahl2 Dec 28, 2025
04eadef
Refactor: libcrmcommon: Functionize checking whether attribute is hidden
nrwahl2 Dec 28, 2025
382f87e
Refactor: libcrmcommon: Rename show_xml_changes_recursive argument
nrwahl2 Dec 28, 2025
e97308d
Refactor: libcrmcommon: foreach_const_attr in show_xml_changes_recursive
nrwahl2 Dec 28, 2025
64f86ee
Refactor: libcrmcommon: foreach const attr in pcmk__xe_sort_attrs test
nrwahl2 Dec 28, 2025
39eb920
Refactor: libpe_status: foreach_const_attr in pcmk__unpack_action_meta
nrwahl2 Dec 29, 2025
e375dfd
Refactor: libcrmcommon: foreach_const_attr() in unpack_ticket_state()
nrwahl2 Dec 29, 2025
c123d0a
Refactor: libcrmcommon: Drop side effect from pcmk__marked_as_deleted()
nrwahl2 Dec 28, 2025
f10b2e8
Refactor: libcrmcommon: pcmk__xe_remove_matching_attrs() match const arg
nrwahl2 Dec 28, 2025
a5ff591
Refactor: libcrmcommon: New pcmk__xml_tree_foreach_remove()
nrwahl2 Dec 26, 2025
c2079f8
Refactor: libcrmcommon: Unindent pcmk__apply_creation_acl()
nrwahl2 Dec 26, 2025
93acde1
Refactor: libcrmcommon: Make pcmk__apply_creation_acl() non-recursive
nrwahl2 Dec 26, 2025
98fe183
Refactor: libcrmcommon: Unindent is_config_change()
nrwahl2 Dec 28, 2025
ccdf527
Refactor: libcrmcommon: Minor best practices in is_config_change()
nrwahl2 Dec 28, 2025
ea7ed94
Refactor: libcrmcommon: Functionize search for deleted config element
nrwahl2 Dec 28, 2025
b534d57
Refactor: libcrmcommon: Functionize filtering by one ACL
nrwahl2 Dec 28, 2025
df68530
Refactor: libcrmcommon: Functionize ACL-filtering one match
nrwahl2 Dec 28, 2025
c7ce4ab
Refactor: libcrmcommon: Reorganize xml_acl_filtered_copy()
nrwahl2 Dec 28, 2025
1de7e33
Refactor: libcrmcommon: Don't delete attrs if we're going to delete node
nrwahl2 Dec 28, 2025
7cfa02d
Refactor: libcrmcommon: Clarify xml_acl_filtered_copy()
nrwahl2 Dec 28, 2025
d9c003d
Refactor: libcrmcommon: New pcmk__acl_filtered_copy()
nrwahl2 Dec 29, 2025
85e299e
API: libcrmcommon: Deprecate xml_acl_filtered_copy()
nrwahl2 Dec 29, 2025
a66c82b
Refactor: libcrmcommon: Make pcmk__unpack_acls() static
nrwahl2 Dec 29, 2025
2eaf74f
Refactor: libcrmcommon: Unindent xml_acl_disable()
nrwahl2 Dec 29, 2025
c955374
Refactor: libcrmcommon: New pcmk__xml_doc_clear_flags()
nrwahl2 Dec 29, 2025
455f352
Refactor: libcrmcommon: Simplify xml_acl_denied()
nrwahl2 Dec 29, 2025
953ecbc
Refactor: libcrmcommon: Drop xml_acl_denied() internally
nrwahl2 Dec 29, 2025
426a8df
API: libcrmcommon: Deprecate xml_acl_denied()
nrwahl2 Dec 29, 2025
9cc2536
Refactor: libcrmcommon: New pcmk__acl_required()
nrwahl2 Dec 29, 2025
4b7792e
API: libcrmcommon: Deprecate pcmk_acl_required()
nrwahl2 Dec 29, 2025
204d349
Refactor: libcrmcommon: Move pcmk__is_user_in_group_test.c to utils
nrwahl2 Dec 29, 2025
8eac054
Refactor: libcrmcommon: Functionize appending XML-escaped character
nrwahl2 Dec 30, 2025
61ac8e0
Refactor: libcrmcommon: Functionize XML escape append modes
nrwahl2 Dec 30, 2025
92faadd
Refactor: libcrmcommon: Drop pcmk__xml_needs_escape()
nrwahl2 Dec 30, 2025
d126845
Refactor: libcrmcommon: New pcmk__xml_foreach_child()
nrwahl2 Dec 30, 2025
9259082
Refactor: libcrmcommon: Functionize check/set matching XML children
nrwahl2 Dec 30, 2025
3a3dd7d
Refactor: libcrmcommon: Use foreach_child for find_matching_children
nrwahl2 Dec 30, 2025
39bd4ce
Refactor: libcrmcommon: Functionize marking child changed or deleted
nrwahl2 Dec 30, 2025
24c1ed9
Refactor: libcrmcommon: Functionize marking child moved or created
nrwahl2 Dec 30, 2025
e76912e
Refactor: libcrmcommon: Functionize marking child as created
nrwahl2 Dec 30, 2025
5b2b6b6
Refactor: libcrmcommon: Defunctionize mark_xml_tree_dirty_created()
nrwahl2 Dec 30, 2025
ddc5e10
Refactor: libcrmcommon: Expose reset_doc_private_data() as lib-private
nrwahl2 Dec 30, 2025
e2c7feb
Refactor: libcrmcommon: Expose free_xml_with_position() as lib-private
nrwahl2 Dec 30, 2025
a46e735
Refactor: libcrmcommon: Split XML change code into its own file
nrwahl2 Dec 30, 2025
40aeefc
Refactor: libcrmcommon: Drop pcmk__xe_set_props()
nrwahl2 Dec 30, 2025
9e4ed1b
Refactor: libpe_status: Return void from pe__name_and_nvpairs_xml()
nrwahl2 Dec 30, 2025
9c93783
Refactor: libpe_status: Drop pe__name_and_nvpairs_xml()
nrwahl2 Dec 30, 2025
ccddd68
Refactor: libcrmcommon: pcmk__output_xml_create_parent() drops list arg
nrwahl2 Dec 30, 2025
614e73c
Refactor: libcrmcommon: pcmk__output_create_xml_node() drops list arg
nrwahl2 Dec 31, 2025
cd8df93
Refactor: libpe_status: Drop a pcmk__itoa() call
nrwahl2 Dec 31, 2025
ecb02d1
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 @@ -25,9 +25,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 @@ -32,7 +32,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 @@ -32,6 +32,7 @@
#include <crm/common/nvpair_internal.h>
#include <crm/common/scores_internal.h>
#include <crm/common/strings_internal.h> // pcmk__assert_asprintf()
#include <crm/common/xml_attr_internal.h>
#include <crm/common/acl_internal.h>

#ifdef __cplusplus
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 @@ -753,11 +753,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 @@ -777,11 +775,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 @@ -33,13 +33,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 @@ -76,31 +82,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
23 changes: 17 additions & 6 deletions include/crm/common/xml_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#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 @@ -255,7 +256,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 @@ -421,17 +421,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
30 changes: 30 additions & 0 deletions include/crm/common/xml_tracking_internal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright 2017-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_TRACKING_INTERNAL__H
#define PCMK__CRM_COMMON_XML_TRACKING_INTERNAL__H

/*
* Internal-only functions for tracking, calculating, and committing XML changes
*/

#include <libxml/tree.h> // xmlDoc, xmlNode

#ifdef __cplusplus
extern "C" {
#endif

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

#ifdef __cplusplus
}
#endif

#endif // PCMK__CRM_COMMON_XML_TRACKING_INTERNAL__H
Loading