diff options
| author | Sam Hartman <hartmans@mit.edu> | 2011-09-28 20:55:53 +0000 |
|---|---|---|
| committer | Sam Hartman <hartmans@mit.edu> | 2011-09-28 20:55:53 +0000 |
| commit | 22196688fbdc5c3e196339df665dfc95bae8d5a7 (patch) | |
| tree | 00c93badb8a36190f5864192bb6febe9cac6d7ce /src/ccapi/lib/win | |
| parent | 28a8abe349da047486cbef33cb7c44e48dd4b9b7 (diff) | |
| download | krb5-22196688fbdc5c3e196339df665dfc95bae8d5a7.tar.gz krb5-22196688fbdc5c3e196339df665dfc95bae8d5a7.tar.xz krb5-22196688fbdc5c3e196339df665dfc95bae8d5a7.zip | |
Fix ccapi rpc methods to always pass 8 byte handles instead of sizeof(void*).
ccapi server always stores all 8 bytes, whether compiled as 32 bit or 64 bit.
If 32 bit, client zero-pads handle when sending and truncates when receiving.
Signed-off-by: Kevin Wasserman <kevin.wasserman@painless-security.com>
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25265 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/ccapi/lib/win')
| -rw-r--r-- | src/ccapi/lib/win/ccapi_os_ipc.cxx | 9 | ||||
| -rw-r--r-- | src/ccapi/lib/win/ccs_reply_proc.c | 4 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/ccapi/lib/win/ccapi_os_ipc.cxx b/src/ccapi/lib/win/ccapi_os_ipc.cxx index 062558cb1f..7359eb0bad 100644 --- a/src/ccapi/lib/win/ccapi_os_ipc.cxx +++ b/src/ccapi/lib/win/ccapi_os_ipc.cxx @@ -148,6 +148,7 @@ extern "C" cc_int32 cci_os_ipc_msg( cc_int32 in_launch_server, PROCESS_INFORMATION pi = { 0 }; HANDLE replyEvent = 0; BOOL bCCAPI_Connected= FALSE; + unsigned char tspdata_handle[8] = { 0 }; if (!in_request_stream) { err = cci_check_error (ccErrBadParam); } if (!out_reply_stream ) { err = cci_check_error (ccErrBadParam); } @@ -196,9 +197,11 @@ extern "C" cc_int32 cci_os_ipc_msg( cc_int32 in_launch_server, cci_debug_printf("%s calling remote ccs_rpc_request tsp*:0x%X", __FUNCTION__, ptspdata); cci_debug_printf(" rpcmsg:%d; UUID[%d]:<%s> SST:%ld", in_msg, lenUUID, uuid, sst); #endif + /* copy ptr into handle; ptr may be 4 or 8 bytes, depending on platform; handle is always 8 */ + memcpy(tspdata_handle, &ptspdata, sizeof(ptspdata)); ccs_rpc_request( /* make call with user message: */ in_msg, /* Message type */ - (unsigned char*)&ptspdata, /* Our tspdata* will be sent back to the reply proc. */ + tspdata_handle, /* Our tspdata* will be sent back to the reply proc. */ (unsigned char*)uuid, krb5int_ipc_stream_size(in_request_stream), (unsigned char*)krb5int_ipc_stream_data(in_request_stream), /* Data buffer */ @@ -263,6 +266,7 @@ cc_int32 ccapi_connect(const struct tspdata* tsp) { HANDLE replyEvent = 0; RPC_STATUS status = FALSE; char* uuid = NULL; + unsigned char tspdata_handle[8] = {0}; /* Start listening to our uuid before establishing the connection, * so that when the server tries to call ccapi_listen, we will be ready. @@ -338,10 +342,11 @@ cc_int32 ccapi_connect(const struct tspdata* tsp) { // New code using new RPC procedures for sending the data and receiving a reply: if (!status) { + memcpy(tspdata_handle, &tsp, sizeof(tsp)); RpcTryExcept { ccs_rpc_connect( /* make call with user message: */ CCMSG_CONNECT, /* Message type */ - (unsigned char*)&tsp, /* Our tspdata* will be sent back to the reply proc. */ + tspdata_handle, /* Our tspdata* will be sent back to the reply proc. */ (unsigned char*)uuid, (long*)(&status) ); /* Return code */ } diff --git a/src/ccapi/lib/win/ccs_reply_proc.c b/src/ccapi/lib/win/ccs_reply_proc.c index b0fe037769..bf8c7f4f41 100644 --- a/src/ccapi/lib/win/ccs_reply_proc.c +++ b/src/ccapi/lib/win/ccs_reply_proc.c @@ -44,13 +44,13 @@ void ccs_rpc_request_reply( long* ret_status ) { /* Return code */ HANDLE hEvent = openThreadEvent(uuid, REPLY_SUFFIX); - DWORD* p = (DWORD*)(tspHandle); - struct tspdata* tsp = (struct tspdata*)*p; + struct tspdata* tsp; k5_ipc_stream stream; long status = 0; #if 0 cci_debug_printf("%s! msg#:%d SST:%ld uuid:%s", __FUNCTION__, rpcmsg, srvStartTime, uuid); #endif + memcpy(&tsp, tspHandle, sizeof(tsp)); if (!status) { status = krb5int_ipc_stream_new (&stream); /* Create a stream for the request data */ } |
