summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/grp.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2011-04-29 07:34:05 +0000
committerCorinna Vinschen <corinna@vinschen.de>2011-04-29 07:34:05 +0000
commit12eac211c9d8cfe8304b0232cd472bc005d71745 (patch)
tree3e68a921140bc36e4f15d20194f2a96db1b5fc6a /winsup/cygwin/grp.cc
parent541820d0eefe3859162cce48946c9649752b9b3b (diff)
downloadcygnal-12eac211c9d8cfe8304b0232cd472bc005d71745.tar.gz
cygnal-12eac211c9d8cfe8304b0232cd472bc005d71745.tar.bz2
cygnal-12eac211c9d8cfe8304b0232cd472bc005d71745.zip
* advapi32.cc (GetTokenInformation): Remove.
(SetTokenInformation): Remove. * grp.cc: Replace above functions throughout with their ntdll.dll equivalent. * sec_auth.cc: Ditto. * syscalls.cc: Ditto. * uinfo.cc: Ditto.
Diffstat (limited to 'winsup/cygwin/grp.cc')
-rw-r--r--winsup/cygwin/grp.cc18
1 files changed, 11 insertions, 7 deletions
diff --git a/winsup/cygwin/grp.cc b/winsup/cygwin/grp.cc
index 970e62627..76dd5ec50 100644
--- a/winsup/cygwin/grp.cc
+++ b/winsup/cygwin/grp.cc
@@ -1,7 +1,7 @@
/* grp.cc
Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008, 2009 Red Hat, Inc.
+ 2007, 2008, 2009, 2011 Red Hat, Inc.
Original stubs by Jason Molenda of Cygnus Support, crash@cygnus.com
First implementation by Gunther Ebert, gunther.ebert@ixos-leipzig.de
@@ -21,6 +21,7 @@ details. */
#include "fhandler.h"
#include "dtable.h"
#include "cygheap.h"
+#include "ntdll.h"
#include "pwdgrp.h"
static __group32 *group_buf;
@@ -314,8 +315,9 @@ internal_getgrent (int pos)
int
internal_getgroups (int gidsetsize, __gid32_t *grouplist, cygpsid * srchsid)
{
+ NTSTATUS status;
HANDLE hToken = NULL;
- DWORD size;
+ ULONG size;
int cnt = 0;
struct __group32 *gr;
@@ -344,13 +346,15 @@ internal_getgroups (int gidsetsize, __gid32_t *grouplist, cygpsid * srchsid)
hToken = cygheap->user.primary_token ();
else
hToken = hProcToken;
-
- if (GetTokenInformation (hToken, TokenGroups, NULL, 0, &size)
- || GetLastError () == ERROR_INSUFFICIENT_BUFFER)
+
+ status = NtQueryInformationToken (hToken, TokenGroups, NULL, 0, &size);
+ if (NT_SUCCESS (status) || status == STATUS_BUFFER_TOO_SMALL)
{
PTOKEN_GROUPS groups = (PTOKEN_GROUPS) alloca (size);
- if (GetTokenInformation (hToken, TokenGroups, groups, size, &size))
+ status = NtQueryInformationToken (hToken, TokenGroups, groups,
+ size, &size);
+ if (NT_SUCCESS (status))
{
cygsid sid;
@@ -379,7 +383,7 @@ internal_getgroups (int gidsetsize, __gid32_t *grouplist, cygpsid * srchsid)
}
}
else
- debug_printf ("%d = GetTokenInformation(NULL) %E", size);
+ debug_printf ("%lu = NtQueryInformationToken(NULL) %p", size, status);
return cnt;
error: