confd: fix check for group membership

Checking if a user is an administratr we cannot rely solely on the
return value of sr_get_items() but also ensure at least one group
matches the search criteria.

Fixes #469

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2024-06-03 23:05:04 +02:00
committed by Tobias Waldekranz
parent 2218901dc7
commit 50e068ef10
+2 -1
View File
@@ -1180,7 +1180,8 @@ static int change_nacm(sr_session_ctx_t *session, uint32_t sub_id, const char *m
continue; /* not found, this is OK */
/* At least one group grants full administrator permissions */
is_admin = true;
if (rule_count > 0)
is_admin = true;
sr_free_values(rules, rule_count);
}