diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2009-02-23 18:27:48 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2009-02-23 18:27:48 +0000 |
commit | 8ec5da1ff6c169f34f9d85d98129814fb40dd4f8 (patch) | |
tree | 98643a266c2ae9493fb53e3e1ade6fddbc1168a6 | |
parent | b419b631b64a0b8eeae4bd988efd4a52a5de45db (diff) | |
download | newlib-8ec5da1ff6c169f34f9d85d98129814fb40dd4f8.zip newlib-8ec5da1ff6c169f34f9d85d98129814fb40dd4f8.tar.gz newlib-8ec5da1ff6c169f34f9d85d98129814fb40dd4f8.tar.bz2 |
* sec_auth.cc (get_user_local_groups): Simplify LookupAccountName code.
-rw-r--r-- | winsup/cygwin/ChangeLog | 4 | ||||
-rw-r--r-- | winsup/cygwin/sec_auth.cc | 33 |
2 files changed, 24 insertions, 13 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 586412d..377337a 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -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> * autoload.cc (NetLocalGroupEnum): Remove. diff --git a/winsup/cygwin/sec_auth.cc b/winsup/cygwin/sec_auth.cc index f39b663..23bda8a 100644 --- a/winsup/cygwin/sec_auth.cc +++ b/winsup/cygwin/sec_auth.cc @@ -297,27 +297,34 @@ get_user_local_groups (PWCHAR logonserver, PWCHAR domain, DWORD glen = MAX_SID_LEN; WCHAR dom[MAX_DOMAIN_NAME_LEN + 1]; DWORD domlen = sizeof (dom); - bool builtin = false; use = SidTypeInvalid; wcscpy (dg_ptr, buf[i].lgrpi0_name); - if (!LookupAccountNameW (NULL, domlocal_grp, gsid, &glen, - dom, &domlen, &use)) + if (LookupAccountNameW (NULL, domlocal_grp, gsid, &glen, + dom, &domlen, &use)) { - if (GetLastError () != ERROR_NONE_MAPPED) - debug_printf ("LookupAccountName(%W), %E", domlocal_grp); + if (!legal_sid_type (use)) + debug_printf ("Rejecting local %W. use: %d", dg_ptr, use); + else + grp_list += gsid; + } + else if (GetLastError () == ERROR_NONE_MAPPED) + { + /* Check if it's a builtin group. */ wcscpy (bg_ptr, dg_ptr); - if (!LookupAccountNameW (NULL, builtin_grp, gsid, &glen, - dom, &domlen, &use)) + 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); - builtin = true; } - if (!legal_sid_type (use)) - debug_printf ("Rejecting local %W. use: %d", dg_ptr, use); - else if (builtin) - grp_list *= gsid; else - grp_list += gsid; + debug_printf ("LookupAccountName(%W), %E", domlocal_grp); } NetApiBufferFree (buf); return true; |