OSDN Git Service

2010-02-26 Pierre Humblet <Pierre.Humblet@ieee.org>
authorphumblet <phumblet>
Fri, 26 Feb 2010 23:51:59 +0000 (23:51 +0000)
committerphumblet <phumblet>
Fri, 26 Feb 2010 23:51:59 +0000 (23:51 +0000)
        * security.cc (check_access): Use user.imp_token if appropriate.
        Set errno and return if DuplicateTokenEx fails .

winsup/cygwin/ChangeLog
winsup/cygwin/security.cc

index 21984ca..64d60fe 100644 (file)
@@ -1,3 +1,8 @@
+2010-02-26  Pierre Humblet <Pierre.Humblet@ieee.org>
+
+       * security.cc (check_access): Use user.imp_token if appropriate.
+        Set errno and return if DuplicateTokenEx fails .
+
 2010-02-26  Corinna Vinschen  <corinna@vinschen.de>
 
        Remove all traces of __CYGWIN_USE_BIG_TYPES__.
index a8a2512..b09a719 100644 (file)
@@ -751,16 +751,17 @@ check_access (security_descriptor &sd, GENERIC_MAPPING &mapping,
                ? cygheap->user.imp_token ()
                : hProcImpToken);
 
-  if (!tok && !DuplicateTokenEx (hProcToken, MAXIMUM_ALLOWED, NULL,
-                                SecurityImpersonation, TokenImpersonation,
-                                &hProcImpToken))
-#ifdef DEBUGGING
-       system_printf ("DuplicateTokenEx failed, %E");
-#else
-       syscall_printf ("DuplicateTokenEx failed, %E");
-#endif
-  else
-    tok = hProcImpToken;
+  if (!tok)
+    {
+      if (!DuplicateTokenEx (hProcToken, MAXIMUM_ALLOWED, NULL,
+                           SecurityImpersonation, TokenImpersonation,
+                           &hProcImpToken))
+         {
+            __seterrno ();
+            return ret;
+         } 
+      tok = hProcImpToken;
+    } 
 
   if (!AccessCheck (sd, tok, desired, &mapping, pset, &plen, &granted, &status))
     __seterrno ();