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/09/16 17:35:23 UTC
svn commit: r815841 - in /commons/sandbox/runtime/trunk/src/main/native:
include/arch/windows/acr_arch.h os/win32/signals.c
Author: mturk
Date: Wed Sep 16 15:35:19 2009
New Revision: 815841
URL: http://svn.apache.org/viewvc?rev=815841&view=rev
Log:
Check for the client side pipe id if supported by the OS
Modified:
commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h
commons/sandbox/runtime/trunk/src/main/native/os/win32/signals.c
Modified: commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h?rev=815841&r1=815840&r2=815841&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h Wed Sep 16 15:35:19 2009
@@ -750,6 +750,18 @@
(lpSymlinkFileName, lpTargetFileName, dwFlags));
#define CreateSymbolicLinkW acr_winapi_CreateSymbolicLinkW
+
+#ifdef GetNamedPipeClientProcessId
+#undef GetNamedPipeClientProcessId
+#endif
+ACR_DECLARE_LATE_DLL_FUNC(SYSDLL_KERNEL32, BOOL, FALSE,
+ WINAPI, GetNamedPipeClientProcessId, 0, (
+ IN HANDLE Pipe,
+ OUT PULONG ClientProcessId),
+ (Pipe, ClientProcessId));
+#define GetNamedPipeClientProcessId acr_winapi_GetNamedPipeClientProcessId
+
+
ACR_DECLARE_LATE_DLL_VOID(SYSDLL_JVM, JNICALL,
JVM_DumpAllStacks,
8, (
Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/signals.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/signals.c?rev=815841&r1=815840&r2=815841&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/signals.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/signals.c Wed Sep 16 15:35:19 2009
@@ -308,6 +308,26 @@
#endif
goto cleanup;
}
+ /* On Vista+ we can check the client side process id
+ * and be sure it matches id that was send as part of the
+ * message.
+ */
+ if (ACR_HAVE_LATE_DLL_FUNC(GetNamedPipeClientProcessId)) {
+ ULONG cpid = 0;
+ if (GetNamedPipeClientProcessId(pd->pipe, &cpid)) {
+ if (cpid != pd->msg.sender) {
+ /* Client pretends to be someone else
+ */
+ goto cleanup;
+ }
+ }
+ else {
+ /* Cannot determine the client side process id
+ */
+ goto cleanup;
+ }
+ }
+
/* Sync with signal handler */
EnterCriticalSection(&signal_lock);
sigaddset(¤t_signal_queue, pd->msg.signal);
@@ -678,7 +698,7 @@
return "Unknown signal (number)";
}
-ACR_DECLARE(int) ACR_RaiseSignal(const wchar_t *salt, int signum, int to)
+ACR_DECLARE(int) ACR_RaiseSignal(const wchar_t *key, int signum, int to)
{
DWORD read = 0;
acr_sig_msg_t msg;
@@ -700,7 +720,7 @@
return 0;
}
pipe_name_from_pid(name, to, ACR_NUMSIG);
- make_security_cookie(&msg, salt, signum, to);
+ make_security_cookie(&msg, key, signum, to);
/* Send the message to the target process pipe.
*/
if (CallNamedPipeW(name,