commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r805490 - in /commons/sandbox/runtime/trunk/src/main/native/os/win32: file.c shm.c syslog.c wusec.c
Date Tue, 18 Aug 2009 16:47:38 GMT
Author: mturk
Date: Tue Aug 18 16:47:37 2009
New Revision: 805490

URL: http://svn.apache.org/viewvc?rev=805490&view=rev
Log:
Use hex instead named SDD

Modified:
    commons/sandbox/runtime/trunk/src/main/native/os/win32/file.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/shm.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/syslog.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/wusec.c

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/file.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/file.c?rev=805490&r1=805489&r2=805490&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/file.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/file.c Tue Aug 18 16:47:37 2009
@@ -137,7 +137,10 @@
     if (fh != INVALID_HANDLE_VALUE) {
         BY_HANDLE_FILE_INFORMATION fi;
         if (GetFileInformationByHandle(fh, &fi)) {
-            rv = (((acr_uint64_t)fi.nFileIndexHigh + (acr_uint64_t)fi.dwVolumeSerialNumber)
<< 30) + fi.nFileIndexLow;
+            ULARGE_INTEGER u;
+            u.LowPart  = fi.nFileIndexLow;
+            u.HighPart = fi.nFileIndexHigh;
+            rv = u.QuadPart + ((acr_uint64_t)fi.dwVolumeSerialNumber) << 30);
             ex = 0;
         }
         else

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/shm.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/shm.c?rev=805490&r1=805489&r2=805490&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/shm.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/shm.c Tue Aug 18 16:47:37 2009
@@ -102,6 +102,7 @@
     wchar_t     keybuf[128];
     DWORD       sizelo, sizehi;
     LPDWORD     lpdwhi = NULL;
+    SECURITY_ATTRIBUTES sa;
 
     if (reqsize > ACR_SIZE_T_MAX) {
         /* Guard against insane sizes */
@@ -143,6 +144,9 @@
     }
     /* Name-based shared memory */
     else {
+        sa.nLength = sizeof(SECURITY_ATTRIBUTES);
+        sa.lpSecurityDescriptor = NULL;
+        sa.bInheritHandle = FALSE;
         /* Do file backed, which is not an inherited handle
          * While we could open APR_EXCL, it doesn't seem that Unix
          * ever did.  Ignore that error here, but fail later when
@@ -151,7 +155,7 @@
         hfile = CreateFileW(filename,
                             GENERIC_READ | GENERIC_WRITE,
                             FILE_SHARE_READ | FILE_SHARE_WRITE,
-                            NULL,
+                            &sa,
                             CREATE_ALWAYS,
                             FILE_ATTRIBUTE_NORMAL,
                             NULL);
@@ -188,7 +192,7 @@
     if (!hmap) {
         goto finally;
     }
-    base = MapViewOfFile(hmap, FILE_MAP_READ | FILE_MAP_WRITE,
+    base = MapViewOfFile(hmap, FILE_MAP_ALL_ACCESS,
                          0, 0, nbytes);
     if (!base) {
         rc = ACR_GET_OS_ERROR();

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/syslog.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/syslog.c?rev=805490&r1=805489&r2=805490&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/syslog.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/syslog.c Tue Aug 18 16:47:37 2009
@@ -101,7 +101,7 @@
     else {
         fprintf(es, "%S%S\n", et, messages[0]);
         if (messages[1])
-            fprintf(es, "         %S\n", messages[1]);
+            fprintf(es, "           %S\n", messages[1]);
         fflush(es);
     }
 }

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/wusec.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/wusec.c?rev=805490&r1=805489&r2=805490&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/wusec.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/wusec.c Tue Aug 18 16:47:37 2009
@@ -303,82 +303,37 @@
     PSECURITY_DESCRIPTOR pSD = NULL;
 
     wcscpy(sdd, "D:(D;OICI;GA;;;BG)(D;OICI;GA;;;AN)");
-    wcscpy(saa, L"(A;OICI;GA");
-    if ((dwAdminAccessMask & FILE_ALL_ACCESS) == FILE_ALL_ACCESS)
-        wcscat(saa, L"FA");
+    swprintf(saa, L"(A;OICI;0x%08x", dwAdminAccessMask);
 
     /* Builtin Adminstrators */
     wcscat(sdd, saa);
     wcscat(sdd, L";;;BA)");
-
+    /* Creator Owner */
+    wcscat(sdd, saa);
+    wcscat(sdd, L";;;CO)");
     /* Local Service */
     wcscat(sdd, saa);
     wcscat(sdd, L";;;LS)");
-
     /* Local System */
     wcscat(sdd, saa);
     wcscat(sdd, L";;;SY)");
-
     /* Logon Service */
     wcscat(sdd, saa);
     wcscat(sdd, L";;;SU)");
 
     if (dwUsersAccessMask) {
+        swprintf(saa, L"(A;OICI;0x%08x", dwUsersAccessMask);
         /* Authenticated users */
-        wcscat(sdd, L"(A;OICI;");
-        if ((dwUsersAccessMask & GENERIC_ALL))
-            wcscat(sdd, L"GA");
-        else {
-            if ((dwUsersAccessMask & GENERIC_READ))
-                wcscat(sdd, L"GR");
-            if ((dwUsersAccessMask & GENERIC_WRITE))
-                wcscat(sdd, L"GW");
-            if ((dwUsersAccessMask & GENERIC_EXECUTE))
-                wcscat(sdd, L"GX");
-        }
-        if ((dwUsersAccessMask & FILE_ALL_ACCESS) == FILE_ALL_ACCESS)
-            wcscat(sdd, L"FA");
-        else {
-            if ((dwUsersAccessMask & FILE_GENERIC_READ) == FILE_GENERIC_READ)
-                wcscat(sdd, L"FR");
-            if ((dwUsersAccessMask & FILE_GENERIC_WRITE) == FILE_GENERIC_WRITE)
-                wcscat(sdd, L"FW");
-            if ((dwUsersAccessMask & FILE_GENERIC_EXECUTE) == FILE_GENERIC_EXECUTE)
-                wcscat(sdd, L"FX");
-        }        
+        wcscat(sdd, saa);
         wcscat(sdd, L";;;AU)");
     }
     if (dwGroupAccessMask) {
-        /* Creator Owner */
-        wcscat(sdd, L"(A;OICI;GA");
-        if ((dwGroupAccessMask & (FILE_ALL_ACCESS | FILE_GENERIC_READ)))
-            wcscat(sdd, L"FA");
-        wcscat(sdd, L";;;CO)");
-
+        swprintf(saa, L"(A;OICI;0x%08x", dwGroupAccessMask);
         /* Creator Group */
-        wcscat(sdd, L"(A;OICI;");
-        if ((dwGroupAccessMask & GENERIC_ALL))
-            wcscat(sdd, L"GA");
-        else {
-            if ((dwGroupAccessMask & GENERIC_READ))
-                wcscat(sdd, L"GR");
-            if ((dwGroupAccessMask & GENERIC_WRITE))
-                wcscat(sdd, L"GW");
-            if ((dwGroupAccessMask & GENERIC_EXECUTE))
-                wcscat(sdd, L"GX");
-        }
-        if ((dwGroupAccessMask & FILE_ALL_ACCESS) == FILE_ALL_ACCESS)
-            wcscat(sdd, L"FA");
-        else {
-            if ((dwGroupAccessMask & FILE_GENERIC_READ) == FILE_GENERIC_READ)
-                wcscat(sdd, L"FR");
-            if ((dwGroupAccessMask & FILE_GENERIC_WRITE) == FILE_GENERIC_WRITE)
-                wcscat(sdd, L"FW");
-            if ((dwGroupAccessMask & FILE_GENERIC_EXECUTE) == FILE_GENERIC_EXECUTE)
-                wcscat(sdd, L"FX");
-        }        
+        wcscat(sdd, saa);
         wcscat(sdd, L";;;CG)");
     }
+    fprintf(stdout, "SD %S\n", sdd);
     if (!ConvertStringSecurityDescriptorToSecurityDescriptorW(sdd,
                                                 SDDL_REVISION_1, &pSD, NULL)) {
         pSD = NULL;
@@ -386,7 +341,9 @@
             ACR_ThrowException(_E, THROW_FMARK, ACR_EX_ENOMEM,
                                ACR_GET_OS_ERROR());
         }
+        fprintf(stdout, "Failed!\n");
     }
+    fflush(stdout);
     return pSD;
 }
 



Mime
View raw message