Skip to content

Commit

Permalink
Fix the pass2 ldap query string when no search filter is defined.
Browse files Browse the repository at this point in the history
Due to the addition of "(sudoUser=*)" to the query we always need
the AND operator, even if no search filter is present.
  • Loading branch information
millert committed Aug 31, 2017
1 parent c3d0982 commit 5cdee2c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions plugins/sudoers/ldap.c
Expand Up @@ -1847,12 +1847,10 @@ sudo_ldap_build_pass2(void)
ldap_conf.timed ? timebuffer : "",
(ldap_conf.timed || ldap_conf.search_filter) ? ")" : "");
} else {
len = asprintf(&filt, "%s%s(sudoUser=*)(sudoUser=%s*)%s%s",
(ldap_conf.timed || ldap_conf.search_filter) ? "(&" : "",
len = asprintf(&filt, "(&%s(sudoUser=*)(sudoUser=%s*)%s)",
ldap_conf.search_filter ? ldap_conf.search_filter : "",
query_netgroups ? "+" : "%:",
ldap_conf.timed ? timebuffer : "",
(ldap_conf.timed || ldap_conf.search_filter) ? ")" : "");
ldap_conf.timed ? timebuffer : "");
}
if (len == -1)
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
Expand Down

0 comments on commit 5cdee2c

Please sign in to comment.