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>2002-12-14 19:57:25 +0300
committerCorinna Vinschen <corinna@vinschen.de>2002-12-14 19:57:25 +0300
commit6e8a0232dfd37bc5dd20ee3cc47f4b4d92b987d2 (patch)
treefaeddb300ee2b15f6c37df2b91bb662a82e13524
parentd97f0f72db0833e9638d0121ffa5417eedcbd292 (diff)
* security.cc (get_user_local_groups): Use LookupAccountSid to find the
local equivalent of BUILTIN.
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/security.cc15
2 files changed, 14 insertions, 6 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 4a19c5a6a..aafc26d57 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,8 @@
+2002-12-14 Pierre Humblet <pierre.humblet@ieee.org>
+
+ * security.cc (get_user_local_groups): Use LookupAccountSid to find the
+ local equivalent of BUILTIN.
+
2002-12-14 Christopher Faylor <cgf@redhat.com>
* pipe.cc (make_pipe): Set fork fixup flag for read pipe.
diff --git a/winsup/cygwin/security.cc b/winsup/cygwin/security.cc
index 784d75527..1416ad566 100644
--- a/winsup/cygwin/security.cc
+++ b/winsup/cygwin/security.cc
@@ -389,16 +389,19 @@ get_user_local_groups (cygsidlist &grp_list, PSID pusersid)
return FALSE;
}
- char bgroup[sizeof ("BUILTIN\\") + GNLEN] = "BUILTIN\\";
+ char bgroup[INTERNET_MAX_HOST_NAME_LENGTH + GNLEN + 2];
char lgroup[INTERNET_MAX_HOST_NAME_LENGTH + GNLEN + 2];
- const DWORD blen = sizeof ("BUILTIN\\") - 1;
- DWORD llen = INTERNET_MAX_HOST_NAME_LENGTH + 1;
- if (!GetComputerNameA (lgroup, &llen))
+ DWORD blen, llen;
+ SID_NAME_USE use;
+
+ blen = llen = INTERNET_MAX_HOST_NAME_LENGTH + 1;
+ if (!LookupAccountSid (NULL, well_known_admins_sid, lgroup, &llen, bgroup, &blen, &use)
+ || !GetComputerNameA (lgroup, &(llen = INTERNET_MAX_HOST_NAME_LENGTH + 1)))
{
__seterrno ();
return FALSE;
}
- lgroup[llen++] = '\\';
+ bgroup[blen++] = lgroup[llen++] = '\\';
for (DWORD i = 0; i < cnt; ++i)
if (is_group_member (buf[i].lgrpi0_name, pusersid, grp_list))
@@ -407,8 +410,8 @@ get_user_local_groups (cygsidlist &grp_list, PSID pusersid)
DWORD glen = sizeof (gsid);
char domain[INTERNET_MAX_HOST_NAME_LENGTH + 1];
DWORD dlen = sizeof (domain);
- SID_NAME_USE use = SidTypeInvalid;
+ use = SidTypeInvalid;
sys_wcstombs (bgroup + blen, buf[i].lgrpi0_name, GNLEN + 1);
if (!LookupAccountName (NULL, bgroup, gsid, &glen, domain, &dlen, &use))
{