[Libreoffice-commits] core.git: sal/osl

Chris Sherlock chris.sherlock79 at gmail.com
Sat Jan 13 10:10:47 UTC 2018


 sal/osl/w32/security.cxx |   41 ++++++++---------------------------------
 1 file changed, 8 insertions(+), 33 deletions(-)

New commits:
commit 9acf3da78a5146c5af557967eabd0c47bf54d466
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date:   Mon Jan 1 00:49:25 2018 +1100

    sal: remove no longer needed CheckTokenMembership_Stub
    
    CheckTokenMembership_Stub was added in commit ce20f0702 because there
    was a problem with patching/replacing UWINAPI on Windows ME. To
    resolve this, CheckTokenMembership was not exported to stay compatible
    which is no longer an issue.
    
    Change-Id: I654a5f5ececa918f844eca541942b9d552fcfa7f
    Reviewed-on: https://gerrit.libreoffice.org/47217
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/sal/osl/w32/security.cxx b/sal/osl/w32/security.cxx
index 0c086cd5c7bf..986afc83412e 100644
--- a/sal/osl/w32/security.cxx
+++ b/sal/osl/w32/security.cxx
@@ -192,31 +192,6 @@ oslSecurityError SAL_CALL osl_loginUserOnFileServer(rtl_uString *strUserName,
     return ret;
 }
 
-static BOOL WINAPI CheckTokenMembership_Stub( HANDLE TokenHandle, PSID SidToCheck, PBOOL IsMember )
-{
-    typedef BOOL (WINAPI *CheckTokenMembership_PROC)( HANDLE, PSID, PBOOL );
-
-    static HMODULE  hModule = nullptr;
-    static CheckTokenMembership_PROC    pCheckTokenMembership = nullptr;
-
-    if ( !hModule )
-    {
-        /* SAL is always linked against ADVAPI32 so we can rely on that it is already mapped */
-        hModule = GetModuleHandleW( L"ADVAPI32.DLL" );
-
-        pCheckTokenMembership = reinterpret_cast<CheckTokenMembership_PROC>(GetProcAddress( hModule, "CheckTokenMembership" ));
-    }
-
-    if ( pCheckTokenMembership )
-        return pCheckTokenMembership( TokenHandle, SidToCheck, IsMember );
-    else
-    {
-        SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
-        return FALSE;
-    }
-
-}
-
 sal_Bool SAL_CALL osl_isAdministrator(oslSecurity Security)
 {
     if (Security != nullptr)
@@ -245,21 +220,21 @@ sal_Bool SAL_CALL osl_isAdministrator(oslSecurity Security)
 
         if (AllocateAndInitializeSid(&siaNtAuthority,
                                      2,
-                                      SECURITY_BUILTIN_DOMAIN_RID,
-                                      DOMAIN_ALIAS_RID_ADMINS,
-                                      0, 0, 0, 0, 0, 0,
-                                      &psidAdministrators))
+                                     SECURITY_BUILTIN_DOMAIN_RID,
+                                     DOMAIN_ALIAS_RID_ADMINS,
+                                     0, 0, 0, 0, 0, 0,
+                                     &psidAdministrators))
         {
-            BOOL    fSuccess = FALSE;
+            BOOL fSuccess = FALSE;
 
-            if ( CheckTokenMembership_Stub( hImpersonationToken, psidAdministrators, &fSuccess ) && fSuccess )
+            if (CheckTokenMembership(hImpersonationToken, psidAdministrators, &fSuccess) && fSuccess)
                 bSuccess = true;
 
             FreeSid(psidAdministrators);
         }
 
-        if ( hImpersonationToken )
-            CloseHandle( hImpersonationToken );
+        if (hImpersonationToken)
+            CloseHandle(hImpersonationToken);
 
         return bSuccess;
     }


More information about the Libreoffice-commits mailing list