Skip to content

Commit 273e094

Browse files
committed
sudo_ldap_build_pass1: add support for matching "sudoUser: !ALL"
1 parent 7993f27 commit 273e094

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

plugins/sudoers/ldap.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ sudo_ldap_build_pass1(struct sudoers_context *ctx, LDAP *ld, struct passwd *pw)
832832
}
833833

834834
/* Add space for the global OR clause + (sudoUser=ALL) + NOT + NUL. */
835-
sz += sizeof("(|(sudoUser=ALL)(!(|)))");
835+
sz += sizeof("(|(sudoUser=ALL)(!(|(sudoUser=!ALL))))");
836836

837837
/* Add space for username and uid, including the negated versions. */
838838
sz += ((sizeof("(sudoUser=)(sudoUser=#)") - 1 +
@@ -969,12 +969,13 @@ sudo_ldap_build_pass1(struct sudoers_context *ctx, LDAP *ld, struct passwd *pw)
969969
free(ng);
970970
}
971971

972-
/* Add ALL to list. */
972+
/* Add ALL to the list and close it. */
973973
CHECK_STRLCAT(buf, "(sudoUser=ALL))", sz);
974974

975975
/* Add filter for negated entries. */
976976
CHECK_STRLCAT(buf, "(!(|", sz);
977977
CHECK_STRLCAT(buf, notbuf, sz);
978+
CHECK_STRLCAT(buf, "(sudoUser=!ALL)", sz);
978979
CHECK_STRLCAT(buf, ")", sz);
979980

980981
/* Add the time restriction, or simply end the global OR. */

0 commit comments

Comments
 (0)