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>2009-03-18 16:58:35 +0300
committerCorinna Vinschen <corinna@vinschen.de>2009-03-18 16:58:35 +0300
commit9e112520ffbef2c9032caf86f6d9b6b622f57dff (patch)
treefdcb5b60bc7953801692ed96ce3def115d2b0d2c /winsup/cygwin/sec_auth.cc
parentda413e0a390ad73f427e07c4db594d2e90cee9b4 (diff)
* sec_auth.cc (lsaauth): Remove local definitions of struct
_TOKEN_LINKED_TOKEN and TokenLinkedToken in favor of definitions from winnt.h. (lsaprivkeyauth): As in lsaauth, fetch linked token if available and return that in favor of default token.
Diffstat (limited to 'winsup/cygwin/sec_auth.cc')
-rw-r--r--winsup/cygwin/sec_auth.cc33
1 files changed, 21 insertions, 12 deletions
diff --git a/winsup/cygwin/sec_auth.cc b/winsup/cygwin/sec_auth.cc
index 23bda8a03..5f3183ec5 100644
--- a/winsup/cygwin/sec_auth.cc
+++ b/winsup/cygwin/sec_auth.cc
@@ -1108,12 +1108,6 @@ lsaauth (cygsid &usersid, user_groups &new_groups, struct passwd *pw)
if (wincap.has_mandatory_integrity_control ())
{
- typedef struct _TOKEN_LINKED_TOKEN
- {
- HANDLE LinkedToken;
- } TOKEN_LINKED_TOKEN, *PTOKEN_LINKED_TOKEN;
-# define TokenLinkedToken ((TOKEN_INFORMATION_CLASS) 19)
-
TOKEN_LINKED_TOKEN linked;
if (GetTokenInformation (user_token, TokenLinkedToken,
@@ -1200,13 +1194,28 @@ lsaprivkeyauth (struct passwd *pw)
__seterrno ();
token = NULL;
}
- else if (!SetHandleInformation (token,
- HANDLE_FLAG_INHERIT,
- HANDLE_FLAG_INHERIT))
+ else
{
- __seterrno ();
- CloseHandle (token);
- token = NULL;
+ if (wincap.has_mandatory_integrity_control ())
+ {
+ TOKEN_LINKED_TOKEN linked;
+ DWORD size;
+
+ if (GetTokenInformation (token, TokenLinkedToken,
+ (PVOID) &linked, sizeof linked, &size))
+ {
+ debug_printf ("Linked Token: %p", linked.LinkedToken);
+ if (linked.LinkedToken)
+ token = linked.LinkedToken;
+ }
+ }
+ if (!SetHandleInformation (token, HANDLE_FLAG_INHERIT,
+ HANDLE_FLAG_INHERIT))
+ {
+ __seterrno ();
+ CloseHandle (token);
+ token = NULL;
+ }
}
out: