SRCS =
HDRS =
+# Why aren't these flags showing up in Windows builds?
+##DOS##CPPFLAGS=$(CPPFLAGS) -D_X86_=1 -DWIN32 -D_WIN32 -W3 -D_WINNT
+
DISTFILES = $(SRCS) $(HDRS) COPYING COPYING.LIB ChangeLog Makefile.in
all-unix:: krb5-config
@echo Making autoconf.h in include
cd include
$(MAKE) -$(MFLAGS) autoconf.h
+
+ @echo Making in ccapi
+ cd ..\ccapi
+ cd
+ $(MAKE) -$(MFLAGS)
+
@echo Making in util
cd ..\util
$(MAKE) -$(MFLAGS)
WINMAKEFILES=Makefile \
appl\gss-sample\Makefile \
appl\gssftp\ftp\Makefile \
+ ccapi\Makefile \
+ ccapi\lib\win\Makefile \
+ ccapi\server\win\Makefile \
+ ccapi\test\Makefile \
clients\Makefile clients\kdestroy\Makefile \
clients\kinit\Makefile clients\klist\Makefile \
clients\kpasswd\Makefile clients\kvno\Makefile \
##DOS## $(WCONFIG) config < $@.in > $@
##DOS##appl\gssftp\ftp\Makefile: appl\gssftp\ftp\Makefile.in $(MKFDEP)
##DOS## $(WCONFIG) config < $@.in > $@
+##DOS##ccapi\Makefile: ccapi\Makefile.in $(MKFDEP)
+##DOS## $(WCONFIG) config < $@.in > $@
+##DOS##ccapi\lib\win\Makefile: ccapi\lib\win\Makefile.in $(MKFDEP)
+##DOS## $(WCONFIG) config < $@.in > $@
+##DOS##ccapi\server\win\Makefile: ccapi\server\win\Makefile.in $(MKFDEP)
+##DOS## $(WCONFIG) config < $@.in > $@
+##DOS##ccapi\test\Makefile: ccapi\test\Makefile.in $(MKFDEP)
+##DOS## $(WCONFIG) config < $@.in > $@
##DOS##clients\Makefile: clients\Makefile.in $(MKFDEP)
##DOS## $(WCONFIG) config < $@.in > $@
##DOS##clients\kdestroy\Makefile: clients\kdestroy\Makefile.in $(MKFDEP)
@echo Making clean in clients
cd ..\clients
$(MAKE) -$(MFLAGS) clean
- @echo Making in appl\gss-sample
+ @echo Making clean in appl\gss-sample
cd ..\appl\gss-sample
$(MAKE) -$(MFLAGS) clean
- @echo Making in appl\gssftp\ftp
+ @echo Making clean in appl\gssftp\ftp
cd ..\..\appl\gssftp\ftp
$(MAKE) -$(MFLAGS) clean
cd ..\..\..
#
ZIP=zip
FILES= ./* \
- clients/* clients/kdestroy/* clients/kinit/* clients/klist/* \
+ clients/* clients/kdestroy/* clients/kinit/* clients/klist/* \
clients/kpasswd/* clients/kcpytkt/* clients/kdeltkt/* \
config/* include/* include/kerberosIV/* \
include/krb5/* include/krb5/stock/* include/sys/* krb524/* lib/* \
lib/krb5/os/* lib/krb5/posix/* lib/krb5/rcache/* \
util/* util/et/* util/profile/*
-WINFILES= util/windows/* windows/* windows/lib/* windows/cns/* \
+WINFILES= \
+ ccapi/common/* ccapi/common/win/* ccapi/common/win/OldCC/* \
+ ccapi/lib/* ccapi/lib/win/* ccapi/lib/win/OldCC/* \
+ ccapi/server/* ccapi/server/win/* \
+ ccapi\test\* \
+ util/windows/* windows/* windows/lib/* windows/cns/* \
windows/wintel/* windows/gss/* windows/gina/* windows/ms2mit/* \
windows/kfwlogon/*
$(CP) appl\gss-sample\$(OUTPRE)gss-client.exe "$(KRB_INSTALL_DIR)\bin\."
$(CP) windows\ms2mit\$(OUTPRE)ms2mit.exe "$(KRB_INSTALL_DIR)\bin\."
$(CP) appl\gssftp\ftp\$(OUTPRE)ftp.exe "$(KRB_INSTALL_DIR)\bin\."
+ $(CP) ccapi\lib\win\$(OUTPRE)ccapi.dll "$(KRB_INSTALL_DIR)\bin\."
+ $(CP) ccapi\server\win\$(OUTPRE)ccapiserver.exe "$(KRB_INSTALL_DIR)\bin\."
$(CP) clients\kvno\$(OUTPRE)kvno.exe "$(KRB_INSTALL_DIR)\bin\."
$(CP) clients\klist\$(OUTPRE)klist.exe "$(KRB_INSTALL_DIR)\bin\."
$(CP) clients\kinit\$(OUTPRE)kinit.exe "$(KRB_INSTALL_DIR)\bin\."
mydir=ccapi
BUILDTOP=$(REL)..
-LOCAL_SUBDIRS= common lib server
+LOCAL_SUBDIRS= lib server test
-all-unix::
+all-windows::
+ @echo Making in ccapi\lib\win
+ @echo buildtop: $(BUILDTOP)
+ cd lib\win
+ cd
+ $(MAKE) -$(MFLAGS)
+ @echo Making in ccapi\server\win
+ cd ..\..\server\win
+ cd
+ $(MAKE) -$(MFLAGS)
+ @echo Making in ccapi\test
+ cd ..\..\test
+ cd
+ $(MAKE) -$(MFLAGS)
+
+clean-windows::
+ @echo Making clean in ccapi\lib\win
+ cd lib\win
+ cd
+ $(MAKE) -$(MFLAGS) clean
+ @echo Making clean in ccapi\server\win
+ cd ..\..\server\win
+ cd
+ $(MAKE) -$(MFLAGS) clean
+ @echo Making clean in ccapi\test
+ cd ..\..\test
+ cd
+ $(MAKE) -$(MFLAGS) clean
# +++ Dependency line eater +++
*/
#include <windows.h>
+#include <stdlib.h>
+#include <malloc.h>
#include "cci_debugging.h"
#include "util.h"
#include <windows.h>
#include <stdio.h> // for _snprintf
-
-#include "util.h"
-#include "secure.hxx"
+#include <malloc.h>
+#include <stdlib.h>
extern "C" {
#include "cci_debugging.h"
#include "ccutils.h"
}
+#include "util.h"
+#include "secure.hxx"
void* malloc_alloc_p(size_t size) {
*/
#include "string.h"
+#include <stdlib.h>
+#include <malloc.h>
#include "tls.h"
void tspdata_setStream (struct tspdata* p, cci_stream_t s) {p->_stream = s;}
-BOOL tspdata_getConnected (struct tspdata* p) {return p->_CCAPI_Connected;}
+BOOL tspdata_getConnected (const struct tspdata* p) {return p->_CCAPI_Connected;}
-HANDLE tspdata_getReplyEvent(struct tspdata* p) {return p->_replyEvent;}
+HANDLE tspdata_getReplyEvent(const struct tspdata* p) {return p->_replyEvent;}
-time_t tspdata_getSST (const struct tspdata* p) {return p->_sst;}
+time_t tspdata_getSST (const struct tspdata* p) {return p->_sst;}
-cci_stream_t tspdata_getStream (const struct tspdata* p) {return p->_stream;}
+cci_stream_t tspdata_getStream (const struct tspdata* p) {return p->_stream;}
+
+char* tspdata_getUUID (const struct tspdata* p) {return p->_uuid;}
+
+RPC_ASYNC_STATE* tspdata_getRpcAState (const struct tspdata* p) {return p->_rpcState;}
+
+BOOL WINAPI PutTspData(DWORD dwTlsIndex, 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;
+ }
+
+BOOL WINAPI GetTspData(DWORD dwTlsIndex, struct tspdata** pdw) {
+ struct tspdata* pData; // The stored memory pointer
+
+ pData = (struct tspdata*)TlsGetValue(dwTlsIndex);
+ if (pData == NULL) return FALSE;
+ (*pdw) = pData;
+ return TRUE;
+ }
-char* tspdata_getUUID (const struct tspdata* p) {return p->_uuid;}
-RPC_ASYNC_STATE* tspdata_getRpcAState (const struct tspdata* p) {return p->_rpcState;}
#include "windows.h"
#include "time.h"
+#include "rpc.h"
#include "cci_stream.h"
#define UUID_SIZE 128
-/* The client code can be run in any client thread. The thread-specific data
- is defined here.
+/* The client code can be run in any client thread.
+ The thread-specific data is defined here.
*/
struct tspdata {
cci_stream_t tspdata_getStream (const struct tspdata* p);
char* tspdata_getUUID (const struct tspdata* p);
+BOOL WINAPI PutTspData(DWORD tlsIndex, struct tspdata* dw);
+BOOL WINAPI GetTspData(DWORD tlsIndex, struct tspdata** pdw);
#endif _tls_h
#include <string.h>
#include <time.h>
#include "windows.h"
+#include <stdlib.h>
+#include <malloc.h>
+
#include "win-utils.h"
#include "cci_debugging.h"
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);
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
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;
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);
// 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);
// 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) {
if (!err) {
*out_reply_stream = tspdata_getStream(ptspdata);
}
-
- cci_debug_printf(" payload:<%s>", cci_stream_data(*out_reply_stream));
return cci_check_error (err);
}
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 */
* 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:
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
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
/* 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);
}
#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
/* MIDL allocate and free */\r
/*********************************************************************/\r
\r
-void __RPC_FAR * __RPC_USER midl_user_allocate(size_t len) {\r
+extern "C" void __RPC_FAR * __RPC_USER midl_user_allocate(size_t len) {\r
return(malloc(len));\r
}\r
\r
-void __RPC_USER midl_user_free(void __RPC_FAR * ptr) {\r
+extern "C" void __RPC_USER midl_user_free(void __RPC_FAR * ptr) {\r
free(ptr);\r
}\r
*/
#include "assert.h"
+#include <stdlib.h>
+#include <malloc.h>
#include "ccs_win_pipe.h"
#include "cci_debugging.h"
-thisconfigdir=../..
-myfulldir=ccapi/test
-mydir=ccapi/test
+thisconfigdir=..$(S)..
+myfulldir=ccapi$(S)test
+mydir=ccapi$(S)test
+BUILDTOP=..$(S)..
+
+!if defined(KRB5_KFW_COMPILE)
+KFWINC= /I$(BUILDTOP)\..\..\krbcc\include
+!endif
+
+# Because all the sources are in .,
+# the only includes we need are to directories outside of ccapi.
+LOCALINCLUDES = /I$(BUILDTOP) /I$(BUILDTOP)$(S)include /I$(BUILDTOP)$(S)include$(S)krb5 $(KFWINC) \
+ -I$(BUILDTOP)$(S)util$(S)et /I.
# run with "make all" to create CCAPI tests in "/tmp/ccapi_test"
# run resulting tests with "sh test_ccapi.sh"
-LIBS = -lkrb5
+##DOS##CPPFLAGS = $(CPPFLAGS) /EHsc -D_CRTAPI1=_cdecl -D_CRTAPI2=_cdecl -DWINVER=0x0501 \
+##DOS## -D_WIN32_WINNT=0x0501 -D_CRT_SECURE_NO_WARNINGS
-SRCDIR = src
-DSTROOT = /tmp
-OBJDIR = $(DSTROOT)/ccapi_intermediates
-DSTDIR = $(DSTROOT)/ccapi_test
-TESTDIR = $(DSTDIR)/tests
-
-SCRIPT_NAME = test_ccapi.sh
+##DOS##WINH = cci_debugging.h \
+##DOS## ccs_reply.h \
+##DOS## ccs_request.h \
+##DOS## ccs_request_c.c \
+##DOS## cci_stream.h \
+##DOS## cci_types.h \
+##DOS## win-utils.h
-OBJECTS = test_ccapi_ccache.o test_ccapi_check.o test_ccapi_constants.o test_ccapi_context.o test_ccapi_globals.o test_ccapi_iterators.o test_ccapi_log.o test_ccapi_util.o
-_OBJECTS = $(OBJECTS:.o=)
+SRCDIR = .
+DSTROOT = $(SRCDIR)
+OBJDIR = $(DSTROOT)$(S)ccapi_intermediates
+DSTDIR = $(DSTROOT)$(S)ccapi_test
+TESTDIR = $(DSTDIR)$(S)tests
-TEST_OBJECTS = test_constants.o test_cc_initialize.o test_cc_context_get_version.o test_cc_context_release.o test_cc_context_get_change_time.o test_cc_context_get_default_ccache_name.o test_cc_context_open_ccache.o test_cc_context_open_default_ccache.o test_cc_context_create_ccache.o test_cc_context_create_default_ccache.o test_cc_context_create_new_ccache.o test_cc_context_new_ccache_iterator.o test_cc_context_compare.o test_cc_ccache_release.o test_cc_ccache_destroy.o test_cc_ccache_set_default.o test_cc_ccache_get_credentials_version.o test_cc_ccache_get_name.o test_cc_ccache_get_principal.o test_cc_ccache_set_principal.o test_cc_ccache_store_credentials.o test_cc_ccache_remove_credentials.o test_cc_ccache_new_credentials_iterator.o test_cc_ccache_get_change_time.o test_cc_ccache_get_last_default_time.o test_cc_ccache_move.o test_cc_ccache_compare.o test_cc_ccache_get_kdc_time_offset.o test_cc_ccache_set_kdc_time_offset.o test_cc_ccache_clear_kdc_time_offset.o test_cc_ccache_iterator_next.o test_cc_credentials_iterator_next.o
-TEST_NAMES = $(TEST_OBJECTS:.o=)
+SCRIPT_NAME = test_ccapi.sh
-all: setup-test-dir simple_lock_test build-base build-tests link-tests copy-script success-message
+OBJECTS = $(OUTPRE)test_ccapi_ccache.$(OBJEXT) \
+ $(OUTPRE)test_ccapi_check.$(OBJEXT) \
+ $(OUTPRE)test_ccapi_constants.$(OBJEXT) \
+ $(OUTPRE)test_ccapi_context.$(OBJEXT) \
+ $(OUTPRE)test_ccapi_globals.$(OBJEXT) \
+ $(OUTPRE)test_ccapi_iterators.$(OBJEXT) \
+ $(OUTPRE)test_ccapi_log.$(OBJEXT) \
+ $(OUTPRE)test_ccapi_util.$(OBJEXT)
+
+PINGOBJS = $(OUTPRE)ccs_request_c.$(OBJEXT) \
+ $(OUTPRE)pingtest.$(OBJEXT) \
+ $(OBJECTS)
+
+TEST_NAMES = test_constants \
+ test_cc_initialize \
+ test_cc_context_get_version
+
+MORE_TESTS = test_cc_context_release \
+ test_cc_context_get_change_time \
+ test_cc_context_get_default_ccache_name \
+ test_cc_context_open_ccache \
+ test_cc_context_open_default_ccache \
+ test_cc_context_create_ccache \
+ test_cc_context_create_default_ccache \
+ test_cc_context_create_new_ccache \
+ test_cc_context_new_ccache_iterator \
+ test_cc_context_compare \
+ test_cc_ccache_release \
+ test_cc_ccache_destroy \
+ test_cc_ccache_set_default \
+ test_cc_ccache_get_credentials_version \
+ test_cc_ccache_get_name \
+ test_cc_ccache_get_principal \
+ test_cc_ccache_set_principal \
+ test_cc_ccache_store_credentials \
+ test_cc_ccache_remove_credentials \
+ test_cc_ccache_new_credentials_iterator \
+ test_cc_ccache_get_change_time \
+ test_cc_ccache_get_last_default_time \
+ test_cc_ccache_move \
+ test_cc_ccache_compare \
+ test_cc_ccache_get_kdc_time_offset \
+ test_cc_ccache_set_kdc_time_offset \
+ test_cc_ccache_clear_kdc_time_offset \
+ test_cc_ccache_iterator_next \
+ test_cc_credentials_iterator_next
+
+##### Linker
+LINK = link
+LIBS = -lkrb5
+##DOS##LIBS = advapi32.lib rpcrt4.lib user32.lib ws2_32.lib ccapi.lib
+LFLAGS = /nologo $(LOPTS)
+
+all-mac:: setup-test-dir pingtest stop_here simple_lock_test build-base build-tests link-tests copy-script success-message
+all-windows:: setup-windows build-base $(OUTPRE)pingtest.exe build-tests copy-script stop_here success-message
# compile base files used by all tests
-build-base: $(OBJECTS)
+build-base: $(PINGOBJS)
+##++ These two rules build each element of the list:
# compile each test
-build-tests: $(TEST_OBJECTS)
-
+build-tests: $(TEST_NAMES)
+ @echo build-tests complete.
+
+$(TEST_NAMES):
+ @echo DBG: $@
+ $(CC) $(ALL_CFLAGS) -Fe$(TESTDIR)$(S)$@.exe -Fd$(OBJDIR)$(S)$@.obj $@.c $(OBJECTS) $(LIBS)
+# Clean .obj from .:
+ $(RM) $@.$(OBJEXT)
+##-- These two rules build each element of the list.
+
# Make a build directory
setup-test-dir:
@echo "Removing old destination directory... $(DSTDIR)"
mkdir -p "$(TESTDIR)"
if [ -d "$(OBJDIR)" ]; then chmod -R u+w "$(OBJDIR)" && rm -rf "$(OBJDIR)"; fi
mkdir -p "$(OBJDIR)"
+
+## The same trick as used in TEST_NAMES to run an action on each element ofthe list WINH:
+setup-windows: $(WINH)
+ if NOT exist $(TESTDIR) mkdir $(TESTDIR)
+ if NOT exist $(OBJDIR) mkdir $(OBJDIR)
+ set LINK = link
+
+# This rule assumes that nmake in ..\lib\win has already run.
+# That is how ..\Makefile.in is set up.
+$(WINH):
+ copy ..\lib\win\srctmp\$@ .
+
+# This rule assumes that nmake in ..\lib\win\ has already run.
+$(OUTPRE)pingtest.exe: $(OBJECTS)
+# There doesn't appear to be any way to examine a variable and return a value
+# indicating whether a string is present in it. We use a perl script to
+# check the LIB variable. If the path to ccapi.lib isn't present, the script
+# deletes a.tmp and the following nmake actions correct LIB.
+ echo %%PATH%% > a.tmp
+ perl setlib.pl
+ if not exist a.tmp (
+ @echo Adding ..\lib\win\srctmp to LIB
+ set LIB=%%LIB%%;..\lib\win\srctmp
+ )
+ $(LINK) $(linkdebug) /map:$(@B)1.map -out:$(*B)1.exe $(conflags) $(PINGOBJS) $(LIBS)
+ $(LINK) $(LFLAGS) /map:$(@B)2.map /out:$(*B)2.exe $(conflags) $(PINGOBJS) $(LIBS) $(conlibsdll)
link-tests: $(TEST_NAMES)
-$(TEST_NAMES): $(TEST_OBJECTS)
- $(CC) -o $(TESTDIR)/$@ $(OBJDIR)/$@.o $(OBJECTS) $(LIBS)
-
simple_lock_test:
$(CC) -o $(TESTDIR)/simple_lock_test simple_lock_test.c $(LIBS)
.PHONY: clean
-clean:
+clean::
-rm -rf "$(OBJDIR)"
--- /dev/null
+\r
+Microsoft Visual Studio Solution File, Format Version 9.00\r
+# Visual Studio 2005\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Pingtest", "Pingtest.vcproj", "{04017001-3222-43C4-A03C-8423B5349276}"\r
+EndProject\r
+Global\r
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
+ Debug|Win32 = Debug|Win32\r
+ Release|Win32 = Release|Win32\r
+ EndGlobalSection\r
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
+ {04017001-3222-43C4-A03C-8423B5349276}.Debug|Win32.ActiveCfg = Debug|Win32\r
+ {04017001-3222-43C4-A03C-8423B5349276}.Debug|Win32.Build.0 = Debug|Win32\r
+ {04017001-3222-43C4-A03C-8423B5349276}.Release|Win32.ActiveCfg = Release|Win32\r
+ {04017001-3222-43C4-A03C-8423B5349276}.Release|Win32.Build.0 = Release|Win32\r
+ EndGlobalSection\r
+ GlobalSection(SolutionProperties) = preSolution\r
+ HideSolutionNode = FALSE\r
+ EndGlobalSection\r
+EndGlobal\r
#include <stdio.h>
#include <stdarg.h>
+#include <stdlib.h>
+#include <malloc.h>
#include "cci_debugging.h"
#include "CredentialsCache.h"
cc_int32 in_msg,
cci_stream_t* out_reply_stream);
+static DWORD dwTlsIndex;
+
+DWORD GetTlsIndex() {return dwTlsIndex;}
+
RPC_STATUS send_test(char* endpoint) {
unsigned char* pszNetworkAddress = NULL;
unsigned char* pszOptions = NULL;
unsigned char* pszStringBinding = NULL;
- unsigned char* pszUuid = NULL;
+ unsigned char* pszUuid = NULL;
RPC_STATUS status;
status = RpcStringBindingCompose(pszUuid,
char* message = "Hello, RPC!";
+ if ((dwTlsIndex = TlsAlloc()) == TLS_OUT_OF_INDEXES) return FALSE;
+
// send_test("krbcc.229026.0.ep");
#if 0
--- /dev/null
+#!perl -w\r
+\r
+$b = "lib\\win\\srctmp";\r
+$a = $ENV{LIB};\r
+if (! ($a =~ /$b/) ) {\r
+ print "$b Not in LIB!\n";\r
+ system("del a.tmp");\r
+ }\r
+else {print "$b in LIB.\n";}\r
+exit(0);
\ No newline at end of file
--- /dev/null
+# test_ccapi.bat\r
+\r
+@echo "\nBeginning test of CCAPI...\n"\r
+@echo "\nThese tests are based on the CCAPI v3 revision 8 draft documentation.\n"\r
+\r
+#run_test simple_lock_test\r
+\r
+teststest_constants.exe\r
+tests\test_cc_initialize.exe\r
+tests\test_cc_context_get_version.exe\r
+exit 0\r
+\r
+tests\test_cc_context_release.exe\r
+tests\test_cc_context_get_change_time.exe\r
+tests\test_cc_context_get_default_ccache_name.exe\r
+tests\test_cc_context_open_ccache.exe\r
+tests\test_cc_context_open_default_ccache.exe\r
+tests\test_cc_context_create_ccache.exe\r
+tests\test_cc_context_create_default_ccache.exe\r
+tests\test_cc_context_create_new_ccache.exe\r
+tests\test_cc_context_new_ccache_iterator.exe\r
+tests\test_cc_context_compare.exe\r
+tests\test_cc_ccache_release.exe\r
+tests\test_cc_ccache_destroy.exe\r
+tests\test_cc_ccache_set_default.exe\r
+tests\test_cc_ccache_get_credentials_version.exe\r
+tests\test_cc_ccache_get_name.exe\r
+tests\test_cc_ccache_get_principal.exe\r
+tests\test_cc_ccache_set_principal.exe\r
+tests\test_cc_ccache_store_credentials.exe\r
+tests\test_cc_ccache_remove_credentials.exe\r
+tests\test_cc_ccache_new_credentials_iterator.exe\r
+tests\test_cc_ccache_get_change_time.exe\r
+tests\test_cc_ccache_get_last_default_time.exe\r
+tests\test_cc_ccache_move.exe\r
+tests\test_cc_ccache_compare.exe\r
+tests\test_cc_ccache_get_kdc_time_offset.exe\r
+tests\test_cc_ccache_set_kdc_time_offset.exe\r
+tests\test_cc_ccache_clear_kdc_time_offset.exe\r
+tests\test_cc_ccache_iterator_next.exe\r
+tests\test_cc_credentials_iterator_next.exe\r
+\r
+@echo "Finished testing CCAPI."\r
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
+
+#include "k5-platform.h"
#include "test_ccapi_util.h"
!else
CCLINKOPTION=
SCLIB=
-DEBUGOPT=/ZI
+DEBUGOPT=/Zi
!endif
#if the compiler is vstudio 8, generate manifest
##++ Assemble configuration from config file and command line:
my $bOutputCleaned = 0;
-
-#while ($v = each %$OPT) {print "$v: $OPT->{$v}\n";}
-
# Scan the configuration for switch definitions:
while (($sw, $val) = each %$odr) {
next if (! exists $val->{def}); ## ?? Should always exist.
# Set/clear environment variables:
if ($val->{env}) {
if ($val->{def}) {$ENV{$sw} = (exists $val->{value}) ? $val->{value} : 1; }
- else {delete $ENV{$sw}; }
+ else {
+ delete $ENV{$sw};
+ undef $sw;
+ }
}
# If the switch is in the command line, override the stored value:
$val->{def} = 1;
}
else {
- $val->{def} = $OPT->{$sw}; ## If no<switch>, value will be zero.
+ $val->{def} = $OPT->{$sw}; ## If -NO<switch>, value will be zero.
}
}
# If the switch can be negated, test that, too:
if ( ! ($val->{def} =~ /A/)) {
local $nosw = "no".$sw;
- if (exists $OPT->{$nosw}) {
- $val->{def} = 0;
+ if (exists $OPT->{$sw}) { ## -NO<environment variable> ?
+ if ($val->{env}) {
+ if (!$val->{def}) {
+ print "Deleting environment variable $sw\n";
+ delete $ENV{$sw};
+ undef $sw;
+ }
+ }
}
}
$l->no_die_handler; ## Needed so XML::Simple won't throw exceptions.
}
+ print "Command line options:\n";
+ while ($v = each %$OPT) {print "$v: $OPT->{$v}\n";}
+
print "Executing $cmdline\n";
local $argvsize = @ARGV;
local $nmakeargs = "";
$SIG{'INT'} = \&handler;
$SIG{'QUIT'} = \&handler;
-exit(main());
\ No newline at end of file
+exit(main());