Skip to content

Commit

Permalink
ldap: add every uid to the group list
Browse files Browse the repository at this point in the history
If a user has multiple uids, include them all in the groups
  • Loading branch information
brong committed Jun 10, 2024
1 parent 1948977 commit 4104bd7
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions ptclient/ldap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1429,12 +1429,13 @@ static int ptsmodule_make_authstate_group(
entry = ldap_first_entry(ptsm->ld, res2);
char **uvals = ldap_get_values(ptsm->ld, entry, (char *)ptsm->user_attribute);
int unumvals = ldap_count_values(uvals);
if (!unumvals) continue; // no user attribute on the DN

// create a group item
strlcat((*newstate)->groups[j].id, uvals[0], sizeof((*newstate)->groups[j].id));
(*newstate)->groups[j].hash = strhash((*newstate)->groups[j].id);
j++;
int k;
for (k = 0; k < unumvals; k++) {
// create a group item
strlcat((*newstate)->groups[j].id, uvals[k], sizeof((*newstate)->groups[j].id));
(*newstate)->groups[j].hash = strhash((*newstate)->groups[j].id);
j++;
}
}

rc = PTSM_OK;
Expand Down

0 comments on commit 4104bd7

Please sign in to comment.