* sec_auth.cc (get_user_local_groups): Simplify LookupAccountName code.
This commit is contained in:
parent
b419b631b6
commit
8ec5da1ff6
|
@ -1,3 +1,7 @@
|
||||||
|
2009-02-23 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* sec_auth.cc (get_user_local_groups): Simplify LookupAccountName code.
|
||||||
|
|
||||||
2009-02-20 Corinna Vinschen <corinna@vinschen.de>
|
2009-02-20 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* autoload.cc (NetLocalGroupEnum): Remove.
|
* autoload.cc (NetLocalGroupEnum): Remove.
|
||||||
|
|
|
@ -297,27 +297,34 @@ get_user_local_groups (PWCHAR logonserver, PWCHAR domain,
|
||||||
DWORD glen = MAX_SID_LEN;
|
DWORD glen = MAX_SID_LEN;
|
||||||
WCHAR dom[MAX_DOMAIN_NAME_LEN + 1];
|
WCHAR dom[MAX_DOMAIN_NAME_LEN + 1];
|
||||||
DWORD domlen = sizeof (dom);
|
DWORD domlen = sizeof (dom);
|
||||||
bool builtin = false;
|
|
||||||
|
|
||||||
use = SidTypeInvalid;
|
use = SidTypeInvalid;
|
||||||
wcscpy (dg_ptr, buf[i].lgrpi0_name);
|
wcscpy (dg_ptr, buf[i].lgrpi0_name);
|
||||||
if (!LookupAccountNameW (NULL, domlocal_grp, gsid, &glen,
|
if (LookupAccountNameW (NULL, domlocal_grp, gsid, &glen,
|
||||||
dom, &domlen, &use))
|
dom, &domlen, &use))
|
||||||
{
|
{
|
||||||
if (GetLastError () != ERROR_NONE_MAPPED)
|
if (!legal_sid_type (use))
|
||||||
debug_printf ("LookupAccountName(%W), %E", domlocal_grp);
|
debug_printf ("Rejecting local %W. use: %d", dg_ptr, use);
|
||||||
wcscpy (bg_ptr, dg_ptr);
|
else
|
||||||
if (!LookupAccountNameW (NULL, builtin_grp, gsid, &glen,
|
grp_list += gsid;
|
||||||
dom, &domlen, &use))
|
}
|
||||||
debug_printf ("LookupAccountName(%W), %E", builtin_grp);
|
else if (GetLastError () == ERROR_NONE_MAPPED)
|
||||||
builtin = true;
|
{
|
||||||
|
/* Check if it's a builtin group. */
|
||||||
|
wcscpy (bg_ptr, dg_ptr);
|
||||||
|
if (LookupAccountNameW (NULL, builtin_grp, gsid, &glen,
|
||||||
|
dom, &domlen, &use))
|
||||||
|
{
|
||||||
|
if (!legal_sid_type (use))
|
||||||
|
debug_printf ("Rejecting local %W. use: %d", dg_ptr, use);
|
||||||
|
else
|
||||||
|
grp_list *= gsid;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
debug_printf ("LookupAccountName(%W), %E", builtin_grp);
|
||||||
}
|
}
|
||||||
if (!legal_sid_type (use))
|
|
||||||
debug_printf ("Rejecting local %W. use: %d", dg_ptr, use);
|
|
||||||
else if (builtin)
|
|
||||||
grp_list *= gsid;
|
|
||||||
else
|
else
|
||||||
grp_list += gsid;
|
debug_printf ("LookupAccountName(%W), %E", domlocal_grp);
|
||||||
}
|
}
|
||||||
NetApiBufferFree (buf);
|
NetApiBufferFree (buf);
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue