* grp.cc (getgroups): Change so that SIDs get compared instead
of strings to SIDs.
This commit is contained in:
parent
c0d1968a18
commit
bfbc1aecdc
|
@ -1,3 +1,8 @@
|
||||||
|
Fri Apr 20 16:29:00 2001 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* grp.cc (getgroups): Change so that SIDs get compared instead
|
||||||
|
of strings to SIDs.
|
||||||
|
|
||||||
Fri Apr 20 14:50:00 2001 Corinna Vinschen <corinna@vinschen.de>
|
Fri Apr 20 14:50:00 2001 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* Makefile.in: Add object files `sec_helper.cc' and `sec_acl.cc'.
|
* Makefile.in: Add object files `sec_helper.cc' and `sec_acl.cc'.
|
||||||
|
|
|
@ -274,24 +274,26 @@ getgroups (int gidsetsize, gid_t *grouplist, gid_t gid, const char *username)
|
||||||
GetTokenInformation (hToken, TokenGroups, buf, 4096, &size))
|
GetTokenInformation (hToken, TokenGroups, buf, 4096, &size))
|
||||||
{
|
{
|
||||||
TOKEN_GROUPS *groups = (TOKEN_GROUPS *) buf;
|
TOKEN_GROUPS *groups = (TOKEN_GROUPS *) buf;
|
||||||
char ssid[256];
|
char ssid[MAX_SID_LEN];
|
||||||
|
PSID sid = (PSID) ssid;
|
||||||
|
|
||||||
for (DWORD pg = 0; pg < groups->GroupCount; ++pg)
|
for (DWORD pg = 0; pg < groups->GroupCount; ++pg)
|
||||||
{
|
{
|
||||||
convert_sid_to_string_sid (groups->Groups[pg].Sid, ssid);
|
struct group *gr;
|
||||||
for (int gg = 0; gg < curr_lines; ++gg)
|
while ((gr = getgrent ()) != NULL)
|
||||||
{
|
{
|
||||||
if (group_buf[gg].gr_passwd &&
|
if (get_gr_sid (sid, gr) &&
|
||||||
!strcmp (group_buf[gg].gr_passwd, ssid))
|
EqualSid (sid, groups->Groups[pg].Sid))
|
||||||
{
|
{
|
||||||
if (cnt < gidsetsize)
|
if (cnt < gidsetsize)
|
||||||
grouplist[cnt] = group_buf[gg].gr_gid;
|
grouplist[cnt] = gr->gr_gid;
|
||||||
++cnt;
|
++cnt;
|
||||||
if (gidsetsize && cnt > gidsetsize)
|
if (gidsetsize && cnt > gidsetsize)
|
||||||
goto error;
|
goto error;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
endgrent ();
|
||||||
}
|
}
|
||||||
CloseHandle (hToken);
|
CloseHandle (hToken);
|
||||||
return cnt;
|
return cnt;
|
||||||
|
|
Loading…
Reference in New Issue