You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/08/08 12:35:02 UTC

svn commit: r802337 - in /commons/sandbox/runtime/trunk/src/main/native/os/win32: main.c wutil.c

Author: mturk
Date: Sat Aug  8 10:35:02 2009
New Revision: 802337

URL: http://svn.apache.org/viewvc?rev=802337&view=rev
Log:
Enable few more privileges

Modified:
    commons/sandbox/runtime/trunk/src/main/native/os/win32/main.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/wutil.c

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/main.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/main.c?rev=802337&r1=802336&r2=802337&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/main.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/main.c Sat Aug  8 10:35:02 2009
@@ -219,6 +219,15 @@
     acr_log_domain = strdup(domain);
 }
 
+static const wchar_t *sePrivileges[] = {
+    L"SeBackupPrivilege",
+    L"SeCreateGlobalPrivilege",
+    L"SeCreateSymbolicLinkPrivilege",
+    L"SeCreateTokenPrivilege",
+    L"SeDebugPrivilege",
+    L"SeTakeOwnershipPrivilege",
+    NULL
+};
 /* Called by the JVM when ACR is loaded */
 JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved)
 {
@@ -226,6 +235,7 @@
     DWORD   rc;
     JNIEnv *env;
     void   *epp;
+    const wchar_t *pp;
 
     UNREFERENCED(reserved);
     if ((*vm)->GetEnv(vm, &epp, JNI_VERSION_1_4)) {
@@ -249,11 +259,12 @@
     if ((dll_tls_index = TlsAlloc()) == TLS_OUT_OF_INDEXES) {
         return JNI_ERR;
     }
-    if ((rc = ACR_EnablePrivilege(L"SeDebugPrivilege")) != ERROR_SUCCESS) {
-        /* Log that we couldn't set privilege */
-        acr_init_log_source(LOG_MSG_DOMAIN);
-        do_syslog(ACR_LOG_ERROR,
-                  L"Failed setting SeDebugPrivilege", rc);
+    for (pp = sePrivileges[0]; pp; pp++) {
+        if ((rc = ACR_EnablePrivilege(pp)) != ERROR_SUCCESS) {
+            /* Log that we couldn't set privilege */
+            acr_init_log_source(LOG_MSG_DOMAIN);
+            do_syslog(ACR_LOG_ERROR, pp, rc);
+        }
     }
 
     env = epp;

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/wutil.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/wutil.c?rev=802337&r1=802336&r2=802337&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/wutil.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/wutil.c Sat Aug  8 10:35:02 2009
@@ -28,15 +28,15 @@
  * XXX: Make sure it is synced with ACR_DT_ types
  */
 static const wchar_t *dtnames[] = {
-    L"a0_",     /* ACR_DT_UNKNOWN   */
-    L"a1_",     /* ACR_DT_FILE      */
-    L"a2_",     /* ACR_DT_USER      */
-    L"a3_",     /* ACR_DT_GROUP     */
-    L"a4_",     /* ACR_DT_MUTEX     */
-    L"a5_",     /* ACR_DT_SHM       */
-    L"a6_",     /* ACR_DT_PIPE      */
-    L"a7_",     /* ACR_DT_SOCKET    */
-    L"a8_",     /* ACR_DT_DSO       */
+    L"a0x",     /* ACR_DT_UNKNOWN   */
+    L"a1x",     /* ACR_DT_FILE      */
+    L"a2x",     /* ACR_DT_USER      */
+    L"a3x",     /* ACR_DT_GROUP     */
+    L"a4x",     /* ACR_DT_MUTEX     */
+    L"a5x",     /* ACR_DT_SHM       */
+    L"a6x",     /* ACR_DT_PIPE      */
+    L"a7x",     /* ACR_DT_SOCKET    */
+    L"a8x",     /* ACR_DT_DSO       */
     NULL
 };