summaryrefslogtreecommitdiffstats
path: root/src/ccapi/lib
diff options
context:
space:
mode:
authorKevin Koch <kpkoch@mit.edu>2008-02-19 15:22:13 +0000
committerKevin Koch <kpkoch@mit.edu>2008-02-19 15:22:13 +0000
commit1ad7c24419422ce0d62c80699eb4cd30b1c3d51b (patch)
treea8d853bff3d5101093ed37a2a9cf8f3fbc8628fb /src/ccapi/lib
parentc90fb4c40ec4fb78e4d1b2a40c9c5af36225603c (diff)
downloadkrb5-1ad7c24419422ce0d62c80699eb4cd30b1c3d51b.tar.gz
krb5-1ad7c24419422ce0d62c80699eb4cd30b1c3d51b.tar.xz
krb5-1ad7c24419422ce0d62c80699eb4cd30b1c3d51b.zip
Changes to integrate the CCAPI build into the build structure, build the test suite and fixes to random problems discovered along the way
Since no platform other than windows builds CCAPI using the build system, some conditionalizing may be necessary when other platforms use the makefiles. src/Makefile.in: Add CPPFLAGS that seemed to be missing; run wconfig for ccapi/(lib, server, test). config/win-pre.in: DEBUGOPT /ZI doesn't seem to provide enough debugging information under VS2005; /Zi does. windows/build/bkw.pl: Fix -no<switch> so that -nonodebug will work. Otherwise, can't do debug build. Move Get/PutTspData out of dllmain; add tlsindex argument. Comment out some debug messages. TargetVersion: 1.7 Component: krb5-libs Ticket: 5594 Tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20229 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/ccapi/lib')
-rw-r--r--src/ccapi/lib/win/OldCC/client.cxx4
-rw-r--r--src/ccapi/lib/win/ccapi_os_ipc.cxx23
-rw-r--r--src/ccapi/lib/win/ccs_reply_proc.c3
-rw-r--r--src/ccapi/lib/win/dllmain.cxx77
-rw-r--r--src/ccapi/lib/win/dllmain.h7
5 files changed, 23 insertions, 91 deletions
diff --git a/src/ccapi/lib/win/OldCC/client.cxx b/src/ccapi/lib/win/OldCC/client.cxx
index 4928d4c53..ed8712339 100644
--- a/src/ccapi/lib/win/OldCC/client.cxx
+++ b/src/ccapi/lib/win/OldCC/client.cxx
@@ -124,10 +124,10 @@ DWORD find_server(Init::InitInfo& info, LPSTR endpoint) {
psa = isNT() ? &sa : 0;
-// cci_debug_printf("%s Looking for server; ccs_request_IfHandle:0x%X", __FUNCTION__, ccs_request_IfHandle);
+ cci_debug_printf("%s Looking for server; ccs_request_IfHandle:0x%X", __FUNCTION__, ccs_request_IfHandle);
status = cci_check_error(RpcMgmtIsServerListening(ccs_request_IfHandle));
if (status == RPC_S_NOT_LISTENING) {
-// cci_debug_printf(" Server *NOT* found!");
+ cci_debug_printf(" Server *NOT* found!");
si.cb = sizeof(si);
status = alloc_module_dir_name(CCAPI_DLL, &szDir);
diff --git a/src/ccapi/lib/win/ccapi_os_ipc.cxx b/src/ccapi/lib/win/ccapi_os_ipc.cxx
index 770e75b6a..7fc57b392 100644
--- a/src/ccapi/lib/win/ccapi_os_ipc.cxx
+++ b/src/ccapi/lib/win/ccapi_os_ipc.cxx
@@ -27,21 +27,22 @@
extern "C" {
#include "k5-thread.h"
#include "ccapi_os_ipc.h"
-#include "tls.h"
-#include "dllmain.h"
+#include "cci_debugging.h"
#include "ccs_reply.h"
#include "ccs_request.h"
-#include "win-utils.h"
#include "ccutils.h"
+#include "tls.h"
#include "util.h"
+#include "win-utils.h"
}
+#include "autolock.hxx"
#include "CredentialsCache.h"
#include "secure.hxx"
#include "opts.hxx"
#include "client.h"
-#include "autolock.hxx"
-#include "cci_debugging.h"
+
+extern "C" DWORD GetTlsIndex();
#define SECONDS_TO_WAIT 10
#define CLIENT_REQUEST_RPC_HANDLE ccs_request_IfHandle
@@ -81,7 +82,7 @@ extern "C" cc_int32 cci_os_ipc_thread_init (void) {
UUID __RPC_FAR uuid;
unsigned char __RPC_FAR* uuidString = NULL;
- if (!GetTspData(&ptspdata)) return ccErrNoMem;
+ if (!GetTspData(GetTlsIndex(), &ptspdata)) return ccErrNoMem;
opts.cMinCalls = 1;
opts.cMaxCalls = 20;
@@ -150,7 +151,7 @@ extern "C" cc_int32 cci_os_ipc_msg( cc_int32 in_launch_server,
if (!in_request_stream) { err = cci_check_error (ccErrBadParam); }
if (!out_reply_stream ) { err = cci_check_error (ccErrBadParam); }
- if (!GetTspData(&ptspdata)) {return ccErrBadParam;}
+ if (!GetTspData(GetTlsIndex(), &ptspdata)) {return ccErrBadParam;}
bCCAPI_Connected = tspdata_getConnected (ptspdata);
replyEvent = tspdata_getReplyEvent (ptspdata);
sst = tspdata_getSST (ptspdata);
@@ -187,7 +188,7 @@ extern "C" cc_int32 cci_os_ipc_msg( cc_int32 in_launch_server,
// New code using new RPC procedures for sending the data and receiving a reply:
if (!err) {
RpcTryExcept {
- if (!GetTspData(&ptspdata)) {return ccErrBadParam;}
+ if (!GetTspData(GetTlsIndex(), &ptspdata)) {return ccErrBadParam;}
uuid = tspdata_getUUID(ptspdata);
lenUUID = 1 + strlen(uuid); /* 1+ includes terminating \0. */
cci_debug_printf("%s calling remote ccs_rpc_request tsp*:0x%X", __FUNCTION__, ptspdata);
@@ -216,9 +217,9 @@ extern "C" cc_int32 cci_os_ipc_msg( cc_int32 in_launch_server,
// Wait for reply handler to set event:
if (!err) {
- cci_debug_printf(" Waiting for request reply.");
+// cci_debug_printf(" Waiting for request reply.");
err = cci_check_error(WaitForSingleObject(replyEvent, INFINITE));//(SECONDS_TO_WAIT)*1000));
- cci_debug_printf(" Request reply received!");
+// cci_debug_printf(" Request reply received!");
}
if (!err) {
@@ -237,8 +238,6 @@ extern "C" cc_int32 cci_os_ipc_msg( cc_int32 in_launch_server,
if (!err) {
*out_reply_stream = tspdata_getStream(ptspdata);
}
-
- cci_debug_printf(" payload:<%s>", cci_stream_data(*out_reply_stream));
return cci_check_error (err);
}
diff --git a/src/ccapi/lib/win/ccs_reply_proc.c b/src/ccapi/lib/win/ccs_reply_proc.c
index f9eef87ff..8d17bfc05 100644
--- a/src/ccapi/lib/win/ccs_reply_proc.c
+++ b/src/ccapi/lib/win/ccs_reply_proc.c
@@ -51,8 +51,7 @@ void ccs_rpc_request_reply(
long status = 0;
cci_debug_printf("%s! msg#:%d SST:%ld uuid:%s", __FUNCTION__, rpcmsg, srvStartTime, uuid);
- cci_debug_printf(" payload:<%s>", chIn);
- cci_debug_printf(" uuid from handle:<%s>", tspdata_getUUID(tsp));
+// cci_debug_printf(" uuid from handle:<%s>", tspdata_getUUID(tsp));
if (!status) {
status = cci_stream_new (&stream); /* Create a stream for the request data */
diff --git a/src/ccapi/lib/win/dllmain.cxx b/src/ccapi/lib/win/dllmain.cxx
index dafbab28c..e37a9ad6b 100644
--- a/src/ccapi/lib/win/dllmain.cxx
+++ b/src/ccapi/lib/win/dllmain.cxx
@@ -24,19 +24,20 @@
* or implied warranty.
*/
+extern "C" {
#include <windows.h>
#include <LMCons.h>
-extern "C" {
#include "dllmain.h"
#include "tls.h"
#include "cci_debugging.h"
#include "ccapi_context.h"
#include "client.h"
-//void cci_thread_init__auxinit();
+void cci_thread_init__auxinit();
}
+
#define CCAPI_V2_MUTEX_NAME TEXT("MIT_CCAPI_V4_MUTEX")
// Process-specific data:
@@ -52,6 +53,8 @@ DWORD firstThreadID = 0;
static Init init;
static Client client;
+DWORD GetTlsIndex() {return dwTlsIndex;}
+
// DllMain() is the entry-point function for this DLL.
BOOL WINAPI DllMain(HINSTANCE hinstDLL, // DLL module handle
DWORD fdwReason, // reason called
@@ -196,72 +199,6 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, // DLL module handle
extern "C" { // we need to export the C interface
#endif
-__declspec(dllexport)
-BOOL WINAPI PutTspData(struct tspdata* dw) {
- LPVOID lpvData;
- struct tspdata** pData; // The stored memory pointer
-
- // Retrieve a data pointer for the current thread:
- lpvData = TlsGetValue(dwTlsIndex);
-
- // If NULL, allocate memory for the TLS slot for this thread:
- if (lpvData == NULL) {
- lpvData = (LPVOID) LocalAlloc(LPTR, sizeof(struct tspdata));
- if (lpvData == NULL) return FALSE;
- if (!TlsSetValue(dwTlsIndex, lpvData)) return FALSE;
- }
-
- pData = (struct tspdata**) lpvData; // Cast to my data type.
- // In this example, it is only a pointer to a DWORD
- // but it can be a structure pointer to contain more complicated data.
-
- (*pData) = dw;
- return TRUE;
- }
-
-__declspec(dllexport)
-BOOL WINAPI GetTspData(struct tspdata** pdw) {
- struct tspdata* pData; // The stored memory pointer
-
- pData = (struct tspdata*)TlsGetValue(dwTlsIndex);
- if (pData == NULL) return FALSE;
- (*pdw) = pData;
- return TRUE;
- }
-
-#if 0 // replaced by clientEndpoint / serverEndpoint.
-__declspec(dllexport)
-char* WINAPI getEndpoint(enum EndpointType ep) {
- // The server endpoint is of the form CCS_<LSID>
- // The client endpoint is of the form CCAPI_<uuid>
- // Each client thread can have its own connection.
- //
- // NB: Caller must free the data the returned char* points to.
- struct tspdata* pData;
- char* s;
- char* uuid;
- unsigned int len;
-
- switch (ep) {
- case EPT_SERVER:
- s = (char*)malloc(32); // Length of CCS_<DWORD>
- sprintf(s, "%s_%ld", ep_prefices[EPT_SERVER], sessionToken);
- break;
- case EPT_CLIENT:
- GetTspData(&pData);
- uuid = tspdata_getUUID(pData);
- len = 4 + strlen(ep_prefices[ep]) + strlen(_user) + strlen(uuid);
- s = (char*)malloc(len);
- sprintf(s, "%s_%s_%s", ep_prefices[EPT_CLIENT], _user, uuid);
- break;
- default:;
- }
- cci_debug_printf("%s(%d) returning %s", __FUNCTION__, ep, s);
-
- return s;
- }
-#endif
-
#ifdef __cplusplus
}
#endif
@@ -270,10 +207,10 @@ char* WINAPI getEndpoint(enum EndpointType ep) {
/* MIDL allocate and free */
/*********************************************************************/
-void __RPC_FAR * __RPC_USER midl_user_allocate(size_t len) {
+extern "C" void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t len) {
return(malloc(len));
}
-void __RPC_USER midl_user_free(void __RPC_FAR * ptr) {
+extern "C" void __RPC_USER MIDL_user_free(void __RPC_FAR * ptr) {
free(ptr);
}
diff --git a/src/ccapi/lib/win/dllmain.h b/src/ccapi/lib/win/dllmain.h
index 8c585721c..abf6afd4a 100644
--- a/src/ccapi/lib/win/dllmain.h
+++ b/src/ccapi/lib/win/dllmain.h
@@ -29,15 +29,12 @@
#include "windows.h"
-enum EndpointType {EPT_SERVER=0, EPT_CLIENT};
-
#ifdef __cplusplus // If used by C++ code,
extern "C" { // we need to export the C interface
#endif
-__declspec(dllexport) BOOL WINAPI PutTspData(struct tspdata* p);
-__declspec(dllexport) BOOL WINAPI GetTspData(struct tspdata** p);
-//__declspec(dllexport) char* WINAPI getEndpoint(enum EndpointType);
+DWORD GetTlsIndex();
+
#ifdef __cplusplus
}
#endif