[Libreoffice-commits] .: sal/osl

Norbert Thiebaud nthiebaud at kemper.freedesktop.org
Fri Oct 7 22:07:37 PDT 2011


 sal/osl/w32/security.c |   34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)

New commits:
commit a2c45688c094d8fa88f9ac0c3534a03fbb9a3b2a
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Sat Oct 8 00:06:48 2011 -0500

    Revert "cppcheck reduce scope of var in sal/... security.c"
    
    This reverts commit 04028b90252888848c0fc911ea3ad3aa49d9a5b5.
    use c99 construct in c, which break Microsoft

diff --git a/sal/osl/w32/security.c b/sal/osl/w32/security.c
index ac53875..053d39f 100644
--- a/sal/osl/w32/security.c
+++ b/sal/osl/w32/security.c
@@ -469,6 +469,37 @@ sal_Bool SAL_CALL osl_getHomeDir(oslSecurity Security, rtl_uString **pustrDirect
         }
         else
         {
+#if 0
+            if (pSecImpl->m_hToken)
+            {
+                DWORD  nInfoBuffer = 512;
+                UCHAR* pInfoBuffer = malloc(nInfoBuffer);
+
+                while (!GetTokenInformation(pSecImpl->m_hToken, TokenUser,
+                                               pInfoBuffer, nInfoBuffer, &nInfoBuffer))
+                {
+                    if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
+                        pInfoBuffer = realloc(pInfoBuffer, nInfoBuffer);
+                    else
+                    {
+                        free(pInfoBuffer);
+                        pInfoBuffer = NULL;
+                        break;
+                    }
+                }
+
+                /* not implemented */
+                OSL_ASSERT(sal_False);
+
+                if (pInfoBuffer)
+                {
+                    /* if (EqualSid() ... */
+
+                }
+            }
+            else
+#endif
+
                 bSuccess = (sal_Bool)(GetSpecialFolder(&ustrSysDir, CSIDL_PERSONAL) &&
                                      (osl_File_E_None == osl_getFileURLFromSystemPath(ustrSysDir, pustrDirectory)));
         }
@@ -548,6 +579,7 @@ sal_Bool SAL_CALL osl_loadUserProfile(oslSecurity Security)
         LPFNLOADUSERPROFILE     fLoadUserProfile    = NULL;
         LPFNUNLOADUSERPROFILE   fUnloadUserProfile  = NULL;
         HANDLE                  hAccessToken        = ((oslSecurityImpl*)Security)->m_hToken;
+        DWORD                   nError              = 0;
 
         /* try to create user profile */
         if ( !hAccessToken )
@@ -589,7 +621,7 @@ sal_Bool SAL_CALL osl_loadUserProfile(oslSecurity Security)
                     bOk = TRUE;
                 }
                 else
-                    DWORD nError = GetLastError();
+                    nError = GetLastError();
 
                 rtl_uString_release(buffer);
             }


More information about the Libreoffice-commits mailing list