commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r812100 - in /commons/sandbox/runtime/trunk/src/main/native: include/arch/windows/acr_arch_private.h os/win32/wusec.c
Date Mon, 07 Sep 2009 12:05:22 GMT
Author: mturk
Date: Mon Sep  7 12:05:21 2009
New Revision: 812100

URL: http://svn.apache.org/viewvc?rev=812100&view=rev
Log:
Add set dacl wrapper

Modified:
    commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch_private.h
    commons/sandbox/runtime/trunk/src/main/native/os/win32/wusec.c

Modified: commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch_private.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch_private.h?rev=812100&r1=812099&r2=812100&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch_private.h
(original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch_private.h
Mon Sep  7 12:05:21 2009
@@ -125,6 +125,7 @@
 PSID         ACR_DuplicateSid(JNIEnv *_E, PSID sSID);
 int          ACR_InitSecurityDescriptorTable(JNIEnv *);
 LPVOID       ACR_GetSecurityDescriptor(JNIEnv *, DWORD, DWORD);
+DWORD        ACR_SetSecurityInfoD(HANDLE, SE_OBJECT_TYPE, PSID, PSID, LPVOID);
 
 /**
  * Heap allocation from main.c

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=812100&r1=812099&r2=812100&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 Mon Sep  7 12:05:21 2009
@@ -371,3 +371,39 @@
     return pSD;
 }
 
+DWORD ACR_SetSecurityInfoD(HANDLE handle, SE_OBJECT_TYPE type,
+                           PSID uid, PSID gid, LPVOID psd)
+{
+    ACL dacl;
+    ACL *acl = NULL;
+    SECURITY_INFORMATION sinf = 0;
+    if (uid) {
+        sinf |= OWNER_SECURITY_INFORMATION;
+    }
+    if (gid)
+        sinf |= GROUP_SECURITY_INFORMATION;
+    if (psd) {
+        BOOL hasdacl;
+        BOOL defdacl;
+        if (!GetSecurityDescriptorDacl(psd, &hasdacl, &dacl, &defdacl)) {
+            return GetLastError();
+        }
+        if (!hasdacl) {
+            /* No DACL present in the security descriptor.
+             */
+#if defined(DEBUG)
+            /* ###: This will go away.
+             * Just a temporal debug dump.
+             */
+            fprintf(stderr, "No DACL present in the SD\n");
+            fflush(stderr);
+#endif
+            pds = NULL;
+        }
+        else {
+            sinf |= DACL_SECURITY_INFORMATION;
+            acl = &dacl;
+        }
+    }
+    return SetSecurityInformation(handle, type, sinf, uid, gid, acl, NULL);
+}



Mime
View raw message