Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
2cb04a5
Refactor: libcrmcommon: Use a switch statement in is_mode_allowed()
nrwahl2 Dec 26, 2025
bab2a81
Doc: libcrmcommon: Clarify that pcmk__element_xpath() returns non-NULL
nrwahl2 Dec 26, 2025
ada7abf
Refactor: libcrmcommon: Use convenience helpers in implicitly_allowed()
nrwahl2 Dec 26, 2025
787684e
Refactor: libcrmcommon: Walk up the tree in implicitly_allowed()
nrwahl2 Dec 26, 2025
116d335
Refactor: libcrmcommon, libpe_status: Drop strncmp() calls
nrwahl2 Dec 26, 2025
7930f74
Refactor: libcrmcommon: Drop a redundant check in pcmk__xa_remove()
nrwahl2 Dec 26, 2025
741c622
Refactor: libcrmcommon: Check force arg sooner in pcmk__xa_remove()
nrwahl2 Dec 26, 2025
7e9d332
Refactor: libcrmcommon: Functionize cases of new_private_data()
nrwahl2 Dec 26, 2025
f9d0e8b
Refactor: libcrmcommon: New pcmk__xe_foreach{,_const}_attr()
nrwahl2 Dec 27, 2025
ce29d7c
Refactor: libcrmcommon: pcmk__xe_foreach_attr() in new_private_data()
nrwahl2 Dec 26, 2025
7b498d0
Refactor: libcrmcommon: Clear flags in reset_xml_private_data()
nrwahl2 Dec 27, 2025
271ecc5
Refactor: libcrmcommon: pcmk__xe_foreach_attr() in free_private_data()
nrwahl2 Dec 27, 2025
f08d15e
Refactor: libcrmcommon: Use a for-loop in xml_diff_old_attrs()
nrwahl2 Dec 27, 2025
94645a1
Refactor: libcrmcommon: Unindent else block in xml_diff_old_attrs()
nrwahl2 Dec 27, 2025
8114b17
Refactor: libcrmcommon: Unindent a bit more of xml_diff_old_attrs()
nrwahl2 Dec 27, 2025
ec3fc57
Refactor: libcrmcommon: pcmk__xe_foreach_attr() in xml_diff_old_attrs()
nrwahl2 Dec 27, 2025
fe37abc
Refactor: libcrmcommon: Drop redundant check from mark_attr_diff()
nrwahl2 Dec 27, 2025
d6ed0ea
Refactor: libcrmcommon: Drop redundant args from mark_attr_*() functions
nrwahl2 Dec 27, 2025
d954673
Refactor: libcrmcommon: Use for loop in mark_created_attrs()
nrwahl2 Dec 27, 2025
b3186d1
Refactor: libcrmcommon: Unindent most of for loop in mark_created_attrs
nrwahl2 Dec 27, 2025
19ba225
Refactor: libcrmcommon: pcmk__xe_foreach_attr() for mark_created_attrs()
nrwahl2 Dec 27, 2025
200b4e4
Refactor: libcrmcommon: New mark_attr_created()
nrwahl2 Dec 27, 2025
1a65ed3
Refactor: various: Assert fn argument not NULL in foreach functions
nrwahl2 Apr 29, 2026
3042204
Build: devel: Disable Coverity's inconsistent union warnings
nrwahl2 Apr 29, 2026
d6b687c
Refactor: libcrmcommon: pcmk__xe_copy_attrs pcmk__xe_foreach_const_attr
nrwahl2 Dec 27, 2025
b39ffab
Refactor: libcrmcommon: Use foreach functions in pcmk__xe_sort_attrs()
nrwahl2 Dec 27, 2025
9997480
Refactor: libcrmcommon: pcmk__xe_foreach_attr for matching attr removal
nrwahl2 Dec 27, 2025
59b3db8
Refactor: libcrmcommon: delete matching xe pcmk__xe_foreach_const_attr
nrwahl2 Dec 27, 2025
2cd11a1
Refactor: libpe_status: get_meta_attributes pcmk__xe_foreach_const_attr
nrwahl2 Dec 27, 2025
e95f4c8
Refactor: libcrmcommon: pcmk__xe_foreach_const_attr() in xml2list()
nrwahl2 Dec 27, 2025
3db5904
Refactor: libcrmcommon: Drop check in add_xml_changes_to_patchset()
nrwahl2 Dec 27, 2025
0251a0a
Refactor: libcrmcommon: Drop xpath check in add_xml_changes_to_patchset
nrwahl2 Dec 27, 2025
c219665
Refactor: libcrmcommon: Clarify pointers in add_xml_changes_to_patchset
nrwahl2 Dec 27, 2025
eb2f334
Refactor: libcrmcommon: Use foreach for adding attr changes to patchset
nrwahl2 Dec 27, 2025
2e91f45
Refactor: libcrmcommon: Drop cIter in add_xml_changes_to_patchset()
nrwahl2 Dec 27, 2025
3057e3e
Refactor: libcrmcommon: Functionize adding modify change to patchset
nrwahl2 Dec 27, 2025
d743ad8
Refactor: libcrmcommon: Functionize adding create change to patchset
nrwahl2 Dec 27, 2025
9da03c5
Refactor: libcrmcommon: Functionize adding move change to patchset
nrwahl2 Dec 27, 2025
b5e236f
Refactor: libcrmcommon: Add modify change only if xml is dirty
nrwahl2 Dec 27, 2025
104257f
Refactor: libcrmcommon: Functionize adding delete change to patchset
nrwahl2 Dec 27, 2025
b5ca4b2
Refactor: libcrmcommon: Minor xml_create_patchset_v2() improvements
nrwahl2 Dec 27, 2025
a64929d
Refactor: libcrmcommon: Functionize setting version fields in patchset
nrwahl2 Dec 27, 2025
3e32b4d
Refactor: libcrmcommon: pcmk__xe_copy_attrs() in apply_v2_patchset()
nrwahl2 Dec 27, 2025
17bb690
Refactor: libcrmcommon: implicitly_allowed() pcmk__xe_foreach_const_attr
nrwahl2 Dec 27, 2025
523611a
Refactor: libcrmcommon: Clarify pcmk__xml_attr_value()
nrwahl2 Dec 27, 2025
a3609ce
Refactor: libcrmcommon: Simplify/clarify pcmk__dump_xml_attr()
nrwahl2 Dec 27, 2025
6074c85
Refactor: libcrmcommon: pcmk__xe_foreach_const_attr in dump_xml_element
nrwahl2 Dec 27, 2025
d74bda5
Low: libcrmcommon: Drop "<null>" fallback in show_xml_element()
nrwahl2 Dec 28, 2025
377ea82
Refactor: libcrmcommon: Call pcmk__dump_xml_attr() in show_xml_element()
nrwahl2 Dec 28, 2025
57562e3
Refactor: libcrmcommon: Drop a couple checks from show_xml_element()
nrwahl2 Dec 28, 2025
c7541ad
Refactor: libcrmcommon: pcmk__xe_foreach_const_attr in show_xml_element
nrwahl2 Dec 28, 2025
c5570fd
Refactor: libcrmcommon: Functionize checking whether attribute is hidden
nrwahl2 Dec 28, 2025
567ab17
Refactor: libcrmcommon: Rename show_xml_changes_recursive argument
nrwahl2 Dec 28, 2025
00f9d66
Refactor: libcrmcommon: foreach_const_attr in show_xml_changes_recursive
nrwahl2 Dec 28, 2025
c4994da
Refactor: libcrmcommon: foreach const attr in pcmk__xe_sort_attrs test
nrwahl2 Dec 28, 2025
3c09841
Refactor: libpe_status: foreach_const_attr in pcmk__unpack_action_meta
nrwahl2 Dec 29, 2025
4aaf54d
Refactor: libcrmcommon: foreach_const_attr() in unpack_ticket_state()
nrwahl2 Dec 29, 2025
a9622cd
Refactor: libcrmcommon: Drop side effect from pcmk__marked_as_deleted()
nrwahl2 Dec 28, 2025
712c53e
Refactor: libcrmcommon: pcmk__xe_remove_matching_attrs() match const arg
nrwahl2 Dec 28, 2025
1052ef5
Refactor: libcrmcommon: New pcmk__xml_tree_foreach_remove()
nrwahl2 Dec 26, 2025
c9d3090
Refactor: libcrmcommon: Unindent pcmk__apply_creation_acl()
nrwahl2 Dec 26, 2025
602f494
Refactor: libcrmcommon: Make pcmk__apply_creation_acl() non-recursive
nrwahl2 Dec 26, 2025
0c2269e
Refactor: libcrmcommon: Unindent is_config_change()
nrwahl2 Dec 28, 2025
2850ffe
Refactor: libcrmcommon: Minor best practices in is_config_change()
nrwahl2 Dec 28, 2025
24f500e
Refactor: libcrmcommon: Functionize search for deleted config element
nrwahl2 Dec 28, 2025
09388ec
Refactor: libcrmcommon: Functionize filtering by one ACL
nrwahl2 Dec 28, 2025
12f5cc1
Refactor: libcrmcommon: Functionize ACL-filtering one match
nrwahl2 Dec 28, 2025
7aa044f
Refactor: libcrmcommon: Check "no ACLs" sooner in xml_acl_filtered_copy
nrwahl2 Dec 28, 2025
a54cd92
Refactor: libcrmcommon: Don't delete attrs if we're going to delete node
nrwahl2 Dec 28, 2025
7623a47
Refactor: libcrmcommon: Clarify xml_acl_filtered_copy()
nrwahl2 Dec 28, 2025
5ba0e12
Refactor: libcrmcommon: New pcmk__acl_filtered_copy()
nrwahl2 Dec 29, 2025
8c8becc
API: libcrmcommon: Deprecate xml_acl_filtered_copy()
nrwahl2 Dec 29, 2025
c4438f2
Refactor: libcrmcommon: Make pcmk__unpack_acls() static
nrwahl2 Dec 29, 2025
f6a5df5
Refactor: libcrmcommon: Unindent xml_acl_disable()
nrwahl2 Dec 29, 2025
90f0a58
Refactor: libcrmcommon: New pcmk__xml_doc_clear_flags()
nrwahl2 Dec 29, 2025
2ffb84e
Refactor: libcrmcommon: Simplify xml_acl_denied()
nrwahl2 Dec 29, 2025
39d5143
Refactor: libcrmcommon: Drop xml_acl_denied() internally
nrwahl2 Dec 29, 2025
308aa30
API: libcrmcommon: Deprecate xml_acl_denied()
nrwahl2 Dec 29, 2025
67eb046
Refactor: libcrmcommon: New pcmk__acl_required()
nrwahl2 Dec 29, 2025
ae20e61
API: libcrmcommon: Deprecate pcmk_acl_required()
nrwahl2 Dec 29, 2025
839323a
Refactor: libcrmcommon: Move pcmk__is_user_in_group_test.c to utils
nrwahl2 Dec 29, 2025
e3057cf
Refactor: libcrmcommon: Functionize appending XML-escaped character
nrwahl2 Dec 30, 2025
97a197c
Refactor: libcrmcommon: Functionize XML escape append modes
nrwahl2 Dec 30, 2025
ab025b3
Refactor: libcrmcommon: Drop pcmk__xml_needs_escape()
nrwahl2 Dec 30, 2025
85910d8
Refactor: libcrmcommon: New pcmk__xml_foreach_child()
nrwahl2 Dec 30, 2025
1f123af
Refactor: libcrmcommon: Functionize check/set matching XML children
nrwahl2 Dec 30, 2025
95f1585
Refactor: libcrmcommon: Use foreach_child for find_matching_children
nrwahl2 Dec 30, 2025
e006a49
Refactor: libcrmcommon: Functionize marking child changed or deleted
nrwahl2 Dec 30, 2025
e138218
Refactor: libcrmcommon: Functionize marking child moved or created
nrwahl2 Dec 30, 2025
faf45fd
Refactor: libcrmcommon: Functionize marking child as created
nrwahl2 Dec 30, 2025
b2c6846
Refactor: libcrmcommon: Defunctionize mark_xml_tree_dirty_created()
nrwahl2 Dec 30, 2025
6451c28
Refactor: libcrmcommon: Expose reset_doc_private_data() as lib-private
nrwahl2 Dec 30, 2025
77c7d3d
Refactor: libcrmcommon: Expose free_xml_with_position() as lib-private
nrwahl2 Dec 30, 2025
9418882
Refactor: libcrmcommon: Split XML change code into its own file
nrwahl2 Dec 30, 2025
0dfe6b6
Refactor: libcrmcommon: Drop pcmk__xe_set_props()
nrwahl2 Dec 30, 2025
d644a63
Refactor: libpe_status: Return void from pe__name_and_nvpairs_xml()
nrwahl2 Dec 30, 2025
c5ff648
Refactor: libpe_status: Drop pe__name_and_nvpairs_xml()
nrwahl2 Dec 30, 2025
d9cc374
Refactor: libcrmcommon: pcmk__output_xml_create_parent() drops list arg
nrwahl2 Dec 30, 2025
e14e4d8
Refactor: libcrmcommon: pcmk__output_create_xml_node() drops list arg
nrwahl2 Dec 31, 2025
b27d13d
Refactor: libpe_status: Drop a pcmk__itoa() call
nrwahl2 Dec 31, 2025
f57c112
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 admin_epoch="0" epoch="10" num_updates="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 admin_epoch="0" epoch="14" num_updates="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 admin_epoch="0" epoch="16" num_updates="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 admin_epoch="0" epoch="26" num_updates="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 @@ -962,11 +962,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
4 changes: 4 additions & 0 deletions daemons/fenced/fenced_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ fenced_has_watchdog_device(void)
void
fenced_foreach_device(GHFunc fn, gpointer user_data)
{
pcmk__assert(fn != NULL);

if (device_table == NULL) {
return;
}
Expand All @@ -170,6 +172,8 @@ fenced_foreach_device(GHFunc fn, gpointer user_data)
void
fenced_foreach_device_remove(GHRFunc fn)
{
pcmk__assert(fn != NULL);

if (device_table == NULL) {
return;
}
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: 4 additions & 1 deletion devel/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,15 @@ coverity: $(COVTAR)
# of them are designed so that things execute in the proper order (which is
# not the same as GNU make's order-only prerequisites).

# @COMPAT Prior to GLib 2.58, the implementation of g_clear_pointer()
# triggers the INCONSISTENT_UNION_ACCESS warning
.PHONY: coverity-analyze
coverity-analyze: $(COVERITY_DIR)
@echo ""
@echo "Analyzing (waiting for coverity license if necessary) ..."
cd $(top_builddir) && cov-analyze --dir "$<" --wait-for-license \
--security --aggressiveness-level "$(COVLEVEL)"
--security --aggressiveness-level "$(COVLEVEL)" \
--disable INCONSISTENT_UNION_ACCESS

.PHONY: $(COVEMACS)
$(COVEMACS): coverity-analyze
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
18 changes: 18 additions & 0 deletions include/crm/common/acl_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,26 @@ pcmk__is_privileged(const char *user)
return user && (!strcmp(user, CRM_DAEMON_USER) || !strcmp(user, "root"));
}

/*!
* \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
Loading