Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
platform
active.directory
adsi
adsi.iis-admin
base
com_ole
complus_mts
component_svcs
database
directx
gdi
graphics_mm
internet.client
internet.server
internet.server.isapi-dev
localization
mapi
messaging
msi
mslayerforunicode
multimedia
networking
networking.ipv6
sdk_install
security
shell
telephony.tapi_2
telephony.tapi_3
telephony.tsp
telephony.wte
tools
ui
ui_shell
win_base_svcs
win16
  
 
date: Fri, 5 Sep 2008 08:28:00 -0700,    group: microsoft.public.platformsdk.security        back       


CheckTokenMembership returns true for Administrators group   
I have code that checks a group membership of a token obtained from 
LogonUserEx():

   res = ImpersonateLoggedOnUser((HANDLE)userToken);
   if (!res) {
      return false;
   }
   
   HANDLE hThreadToken = NULL;   
   res = OpenThreadToken(GetCurrentThread(),
                         TOKEN_DUPLICATE|TOKEN_QUERY,
                         TRUE,
                         &hThreadToken);
   if (res) {
      // Check token membership (it is critical that the ThreadToken is used 
here)
      res = ADSConfig::_pfnCheckTokenMembership->Run(hThreadToken,
                                                     groupSID,
                                                     &isMemberLocal);
      if (!res) {
         return false;
      }
   }
   RevertToSelf();
   
   return isMemberLocal;


This code is, in some cases, returning TRUE when I check whether the user is 
a member of BUILTIN\Administrators.  Is this the right approach, or should I 
be using GetTokenInformation and walking through the TokenGroup SIDs instead?
date: Fri, 5 Sep 2008 08:28:00 -0700   author:   clarkd4

RE: CheckTokenMembership returns true for Administrators group   
Nevermind.  The system was configured with NT AUTHORITY\INTERACTIVE as a 
member of the Administrators group... so the code was working correctly.
date: Fri, 5 Sep 2008 10:05:02 -0700   author:   clarkd4

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us