When adding gids to the LDAP filter, only add the primary gid once.

This is consistent with the space computation/allocation.
From Eric Lakin
This commit is contained in:
Todd C. Miller
2012-02-24 15:17:48 -05:00
parent 5a941fb41c
commit 4f9da8fdaa

View File

@@ -1166,6 +1166,8 @@ sudo_ldap_build_pass1(struct passwd *pw)
(void) strlcat(buf, ")", sz);
}
for (i = 0; i < grlist->ngids; i++) {
if (pw->pw_gid == grlist->gids[i])
continue;
(void) snprintf(gidbuf, sizeof(gidbuf), "%u",
(unsigned int)grlist->gids[i]);
(void) strlcat(buf, "(sudoUser=%#", sz);