Skip to content

Commit 7993f27

Browse files
committed
sudo_ldap_check_non_unix_group: only call plugin for non-Unix groups
The query for netgroups and non-Unix groups may return other types of sudoUser entries. We must check that the sudoUser value starts with "%:" before incrementing it by 2 and passing it to the non-Unix group plugin. Reported by Christos Papakonstantinou from Cantina (cantina.xyz)
1 parent 5066cce commit 7993f27

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

plugins/sudoers/ldap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,13 +324,13 @@ sudo_ldap_check_non_unix_group(struct sudoers_context *ctx,
324324
val++;
325325
negated = true;
326326
}
327-
if (*val == '+') {
327+
if (val[0] == '+') {
328328
match = netgr_matches(nss, val,
329329
def_netgroup_tuple ? ctx->runas.host : NULL,
330330
def_netgroup_tuple ? ctx->runas.shost : NULL, pw->pw_name);
331331
DPRINTF2("ldap sudoUser netgroup '%s%s' ... %s",
332332
negated ? "!" : "", val, match == ALLOW ? "MATCH!" : "not");
333-
} else {
333+
} else if (val[0] == '%' && val[1] == ':') {
334334
if (group_plugin_query(pw->pw_name, val + 2, pw))
335335
match = ALLOW;
336336
DPRINTF2("ldap sudoUser non-Unix group '%s%s' ... %s",

0 commit comments

Comments
 (0)