Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2019-02-22 02:13:57 +0300
committerCorinna Vinschen <corinna@vinschen.de>2019-02-22 02:13:57 +0300
commit14e22688535e3695a7f73a0c82f3535ce164ee67 (patch)
tree68056e1feb4451d5c2d1eaee98f277ad90ea4776
parent65c569f9fd7f0c6e7de395dd4e811a677650b7af (diff)
Cygwin: fetch local groups from local machine
...even for domain accounts, otherwise local group membership is ignored. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
-rw-r--r--winsup/cygwin/sec_auth.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/winsup/cygwin/sec_auth.cc b/winsup/cygwin/sec_auth.cc
index beff3278e..4bbcb0e28 100644
--- a/winsup/cygwin/sec_auth.cc
+++ b/winsup/cygwin/sec_auth.cc
@@ -400,11 +400,18 @@ get_user_local_groups (PWCHAR logonserver, PWCHAR domain,
DWORD cnt, tot;
NET_API_STATUS ret;
- ret = NetUserGetLocalGroups (logonserver, user, 0, LG_INCLUDE_INDIRECT,
+ /* We want to know the membership in local groups on the current machine.
+ Thus, don't ask the logonserver, ask the local machine. In contrast
+ to most other NetUser functions, NetUserGetLocalGroups accepts the
+ username in DOMAIN\user form. */
+ WCHAR username[MAX_DOMAIN_NAME_LEN + UNLEN + 2];
+ wcpcpy (wcpcpy (wcpcpy (username, domain), L"\\"), user);
+ ret = NetUserGetLocalGroups (NULL, username, 0, LG_INCLUDE_INDIRECT,
(LPBYTE *) &buf, MAX_PREFERRED_LENGTH,
&cnt, &tot);
if (ret)
{
+ debug_printf ("username: %W", username);
__seterrno_from_win_error (ret);
return false;
}