event_name = allocEventName(uuid, suffix);
if (!event_name) status = cci_check_error(ccErrNoMem);
}
+#if 0
cci_debug_printf("%s event_name:%s", __FUNCTION__, event_name);
-
+#endif
if (!status) {
hEvent = CreateEvent(psa, FALSE, FALSE, event_name);
if (!hEvent) status = cci_check_error(GetLastError());
event_name = allocEventName(uuid, suffix);
if (!event_name) status = cci_check_error(ccErrNoMem);
+#if 0
cci_debug_printf("%s event_name:%s", __FUNCTION__, event_name);
-
+#endif
if (!status) {
hEvent = OpenEvent(EVENT_MODIFY_STATE, FALSE, event_name);
if (!hEvent) status = cci_check_error(GetLastError());
--- /dev/null
+# makefile: Constructs the Kerberos for Windows CCAPI DLL.\r
+#\r
+OBJS = $(OUTPRE)ccapi_ccache.obj \\r
+ $(OUTPRE)ccapi_ccache_iterator.obj \\r
+ $(OUTPRE)ccapi_context.obj \\r
+ $(OUTPRE)ccapi_context_change_time.obj \\r
+ $(OUTPRE)ccapi_credentials.obj \\r
+ $(OUTPRE)ccapi_credentials_iterator.obj \\r
+ $(OUTPRE)ccapi_ipc.obj \\r
+ $(OUTPRE)ccapi_os_ipc.obj \\r
+ $(OUTPRE)ccapi_string.obj \\r
+ $(OUTPRE)cci_array_internal.obj \\r
+ $(OUTPRE)cci_cred_union.obj \\r
+ $(OUTPRE)cci_debugging.obj \\r
+ $(OUTPRE)cci_identifier.obj \\r
+ $(OUTPRE)cci_message.obj \\r
+ $(OUTPRE)cci_os_debugging.obj \\r
+ $(OUTPRE)cci_os_identifier.obj \\r
+ $(OUTPRE)cci_stream.obj \\r
+ $(OUTPRE)ccs_reply_proc.obj \\r
+ $(OUTPRE)ccs_reply_s.obj \\r
+ $(OUTPRE)ccs_request_c.obj \\r
+ $(OUTPRE)ccutils.obj \\r
+ $(OUTPRE)client.obj \\r
+ $(OUTPRE)dllmain.obj \\r
+ $(OUTPRE)init.obj \\r
+ $(OUTPRE)rpc.obj \\r
+ $(OUTPRE)secure.obj \\r
+ $(OUTPRE)tls.obj \\r
+ $(OUTPRE)util.obj \\r
+ $(OUTPRE)win-utils.obj\r
+\r
+##### Options\r
+# Set NODEBUG if building release instead of debug\r
+\r
+#BUILDTOP is krb5/src and is relative to krb5/src/ccapi/lib/win, for making Makefile.\r
+BUILDTOP=..\..\..\ \r
+CCAPI = $(BUILDTOP)\CCAPI\r
+CO = $(CCAPI)\common\r
+COWIN = $(CCAPI)\common\win\r
+CCUTIL = $(CCAPI)\common\win\OldCC \r
+LIBDIR = $(CCAPI)\lib\r
+LIBWIN = $(LIBDIR)\win\r
+POSIX = $(BUILDTOP)\lib\krb5\posix\r
+OLDCC = $(LIBWIN)\OldCC\r
+SRCTMP = $(LIBWIN)\srctmp\r
+\r
+!if defined(KRB5_KFW_COMPILE)\r
+KFWINC= /I$(BUILDTOP)\..\..\krbcc\include\r
+!endif\r
+\r
+# Because all the sources are pulled together into the temp directory SRCTMP,\r
+# the only includes we need are to directories outside of ccapi.\r
+LOCALINCLUDES = /I..\$(BUILDTOP) /I..\$(BUILDTOP)\include /I..\$(BUILDTOP)\include\krb5 $(KFWINC) \\r
+ -I..\$(BUILDTOP)\util\et \r
+MIDLINCLUDES = /I..\$(BUILDTOP)\include\r
+\r
+CPPFLAGS = $(CPPFLAGS) /EHsc -D_CRTAPI1=_cdecl -D_CRTAPI2=_cdecl -DWINVER=0x0501 \\r
+-D_WIN32_WINNT=0x0501 -D_CRT_SECURE_NO_WARNINGS $(cvarsdll)\r
+\r
+\r
+##### Linker\r
+LINK = link\r
+LIBS = kernel32.lib ws2_32.lib user32.lib advapi32.lib\r
+LFLAGS = /nologo $(LOPTS)\r
+\r
+all:: Makefile copysrc midl $(OUTPRE)ccapi.dll finish\r
+\r
+ccs_request.h ccs_request_c.c ccs_request_s.c : ccs_request.idl ccs_request.acf\r
+ midl $(MIDL_OPTIMIZATION) $(MIDLI) -oldnames -cpp_cmd $(CC) -cpp_opt "-E" \\r
+ ccs_request.idl\r
+\r
+ccs_reply.h ccs_reply_c.c ccs_reply_s.c : ccs_reply.idl ccs_reply.acf\r
+ midl $(MIDL_OPTIMIZATION) $(MIDLI) -oldnames -cpp_cmd $(CC) -cpp_opt "-E" \\r
+ ccs_reply.idl\r
+\r
+copysrc :\r
+ echo "Copying all sources needed to build ccapi.dll to $(SRCTMP)"\r
+ if NOT exist $(SRCTMP)\nul mkdir $(SRCTMP)\r
+ xcopy /D/Y $(CO)\*.* $(SRCTMP)\r
+ xcopy /D/Y $(COWIN)\*.* $(SRCTMP)\r
+ xcopy /D/Y $(CCUTIL)\*.* $(SRCTMP)\r
+ xcopy /D/Y $(LIBDIR)\*.* $(SRCTMP)\r
+ xcopy /D/Y $(LIBWIN)\*.* $(SRCTMP)\r
+ xcopy /D/Y $(OLDCC)\*.* $(SRCTMP)\r
+ cd $(SRCTMP)\r
+ if NOT exist $(OUTPRE)\nul mkdir $(OUTPRE)\r
+\r
+midl : ccs_request.h ccs_reply.h\r
+\r
+# Main program:\r
+$(OUTPRE)ccapi.dll: $(OBJS) ccapi.def\r
+ $(LINK) $(LFLAGS) -entry:_DllMainCRTStartup@12 -dll /map:$*.map /out:$@ /DEF:ccapi.def $(OBJS) \\r
+ /implib:ccapi.lib $(dllflags) $(LIBS) $(KFWLIB) $(SCLIB) rpcrt4.lib $(conlibsdll) $(conflags) \r
+\r
+finish:\r
+ echo "Finished in ccapi/lib/win."\r
+ cd ..\r
+\r
+install::\r
+ echo "Doing nothing for make install"\r
+\r
+clean:: \r
+ if exist $(OUTPRE)*.exe del $(OUTPRE)*.exe\r
+ if exist $(OUTPRE)*.obj del $(OUTPRE)*.obj\r
+ if exist $(OUTPRE)*.res del $(OUTPRE)*.res\r
+ if exist $(OUTPRE)*.map del $(OUTPRE)*.map\r
+ if exist $(OUTPRE)*.pdb del $(OUTPRE)*.pdb\r
+ if exist *.err del *.err\r
+ if exist $(SRCTMP) rm -rf $(SRCTMP)
\ No newline at end of file
if (!err) { // Save in thread local storage
tspdata_setUUID(ptspdata, uuidString);
}
+#if 0
cci_debug_printf("%s UUID:<%s>", __FUNCTION__, tspdata_getUUID(ptspdata));
-
+#endif
// Initialize old CCAPI if necessary:
if (!err) if (!Init:: Initialized()) err = Init:: Initialize( );
if (!err) if (!Client::Initialized()) err = Client::Initialize(0);
if (!GetTspData(GetTlsIndex(), &ptspdata)) {return ccErrBadParam;}
uuid = tspdata_getUUID(ptspdata);
lenUUID = 1 + strlen(uuid); /* 1+ includes terminating \0. */
+#if 0
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
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. */
// Wait for reply handler to set event:
if (!err) {
-// cci_debug_printf(" Waiting for request reply.");
err = cci_check_error(WaitForSingleObject(replyEvent, INFINITE));//(SECONDS_TO_WAIT)*1000));
-// cci_debug_printf(" Request reply received!");
}
if (!err) {
ReleaseMutex(hCCAPIv2Mutex);
if (!status) {
+#if 0
cci_debug_printf("%s Waiting for replyEvent.", __FUNCTION__);
+#endif
status = WaitForSingleObject(replyEvent, INFINITE);//(SECONDS_TO_WAIT)*1000);
status = cci_check_error(RpcMgmtIsServerListening(CLIENT_REQUEST_RPC_HANDLE));
cci_debug_printf(" Server %sFOUND!", (status) ? "NOT " : "");
cci_debug_printf(" unexpected error while looking for server... (%u)", status);
}
- cci_debug_printf("%s TODO: check connect reply result.", __FUNCTION__);
- cci_debug_printf("%s TODO: merge this connect code with that request code.", __FUNCTION__);
return status;
}
\ No newline at end of file
struct tspdata* tsp = (struct tspdata*)*p;
cci_stream_t stream;
long status = 0;
-
+#if 0
cci_debug_printf("%s! msg#:%d SST:%ld uuid:%s", __FUNCTION__, rpcmsg, srvStartTime, uuid);
-// cci_debug_printf(" uuid from handle:<%s>", tspdata_getUUID(tsp));
-
+#endif
if (!status) {
status = cci_stream_new (&stream); /* Create a stream for the request data */
}
HANDLE hEvent = openThreadEvent(uuid, REPLY_SUFFIX);
DWORD* p = (DWORD*)(tspHandle);
-
+#if 0
cci_debug_printf("%s! msg#:%d SST:%ld uuid:%s", __FUNCTION__, rpcmsg, srvStartTime, uuid);
-
+#endif
SetEvent(hEvent);
CloseHandle(hEvent);
}
--- /dev/null
+# makefile: Constructs the Kerberos for Windows CCAPI server.\r
+\r
+#BUILDTOP is krb5/src and is relative to krb5/src/ccapi/server/win, for making Makefile.\r
+BUILDTOP=..\..\..\ \r
+CCAPI = $(BUILDTOP)\CCAPI\r
+CO = $(CCAPI)\common\r
+COWIN = $(CCAPI)\common\win\r
+CCUTIL = $(CCAPI)\common\win\OldCC \r
+SRVDIR = $(CCAPI)\server\r
+SRVWIN = $(SRVDIR)\win\r
+POSIX = $(BUILDTOP)\lib\krb5\posix\r
+SRCTMP = $(SRVWIN)\srctmp\r
+\r
+!if defined(KRB5_KFW_COMPILE)\r
+KFWINC= /I$(BUILDTOP)\..\..\krbcc\include\r
+!endif\r
+\r
+OBJS = $(OUTPRE)cci_array_internal.$(OBJEXT) \\r
+ $(OUTPRE)cci_cred_union.$(OBJEXT) \\r
+ $(OUTPRE)cci_debugging.$(OBJEXT) \\r
+ $(OUTPRE)cci_identifier.$(OBJEXT) \\r
+ $(OUTPRE)cci_message.$(OBJEXT) \\r
+ $(OUTPRE)cci_os_debugging.$(OBJEXT) \\r
+ $(OUTPRE)cci_os_identifier.$(OBJEXT) \\r
+ $(OUTPRE)cci_stream.$(OBJEXT) \\r
+ $(OUTPRE)ccs_array.$(OBJEXT) \\r
+ $(OUTPRE)ccs_cache_collection.$(OBJEXT) \\r
+ $(OUTPRE)ccs_callback.$(OBJEXT) \\r
+ $(OUTPRE)ccs_ccache.$(OBJEXT) \\r
+ $(OUTPRE)ccs_ccache_iterator.$(OBJEXT) \\r
+ $(OUTPRE)ccs_client.$(OBJEXT) \\r
+ $(OUTPRE)ccs_credentials.$(OBJEXT) \\r
+ $(OUTPRE)ccs_credentials_iterator.$(OBJEXT) \\r
+ $(OUTPRE)ccs_list.$(OBJEXT) \\r
+ $(OUTPRE)ccs_list_internal.$(OBJEXT) \\r
+ $(OUTPRE)ccs_lock.$(OBJEXT) \\r
+ $(OUTPRE)ccs_lock_state.$(OBJEXT) \\r
+ $(OUTPRE)ccs_os_pipe.$(OBJEXT) \\r
+ $(OUTPRE)ccs_os_server.$(OBJEXT) \\r
+ $(OUTPRE)ccs_pipe.$(OBJEXT) \\r
+ $(OUTPRE)ccs_reply_c.$(OBJEXT) \\r
+ $(OUTPRE)ccs_request_proc.$(OBJEXT) \\r
+ $(OUTPRE)ccs_server.$(OBJEXT) \\r
+ $(OUTPRE)ccs_win_pipe.$(OBJEXT) \\r
+ $(OUTPRE)ccs_request_s.$(OBJEXT) \\r
+ $(OUTPRE)ccutils.$(OBJEXT) \\r
+ $(OUTPRE)init.$(OBJEXT) \\r
+ $(OUTPRE)opts.$(OBJEXT) \\r
+ $(OUTPRE)secure.$(OBJEXT) \\r
+ $(OUTPRE)tls.$(OBJEXT) \\r
+ $(OUTPRE)util.$(OBJEXT) \\r
+ $(OUTPRE)win-utils.$(OBJEXT) \\r
+ $(OUTPRE)WorkItem.$(OBJEXT) \\r
+ $(OUTPRE)WorkQueue.$(OBJEXT)\r
+\r
+##### Options\r
+\r
+# Because all the sources are pulled together into the temp directory SRCTMP,\r
+# the only includes we need are to directories outside of ccapi.\r
+LOCALINCLUDES = /I..\$(BUILDTOP) /I..\$(BUILDTOP)\include /I..\$(BUILDTOP)\include\krb5 $(KFWINC) \\r
+ -I..\$(BUILDTOP)\util\et /I.\r
+MIDLI = /I..\$(BUILDTOP)\include\r
+\r
+CPPFLAGS = $(CPPFLAGS) /EHsc -D_CRTAPI1=_cdecl -D_CRTAPI2=_cdecl -DWINVER=0x0501 \\r
+-D_WIN32_WINNT=0x0501 -D_CRT_SECURE_NO_WARNINGS\r
+\r
+##### Linker\r
+LINK = link\r
+LIBS = rpcrt4.lib advapi32.lib ws2_32.lib user32.lib\r
+LFLAGS = /nologo $(LOPTS)\r
+\r
+\r
+all:: Makefile copysrc midl $(OUTPRE)ccapiserver.exe finish\r
+\r
+ccs_request.h ccs_request_c.c ccs_request_s.c : ccs_request.idl ccs_request.acf\r
+ midl $(MIDL_OPTIMIZATION) $(MIDLI) -oldnames -cpp_cmd $(CC) -cpp_opt "-E" \\r
+ ccs_request.idl\r
+\r
+ccs_reply.h ccs_reply_c.c ccs_reply_s.c : ccs_reply.idl ccs_reply.acf\r
+ midl $(MIDL_OPTIMIZATION) $(MIDLI) -oldnames -cpp_cmd $(CC) -cpp_opt "-E" \\r
+ ccs_reply.idl\r
+\r
+copysrc :\r
+ echo "Copying all sources needed to build ccapiserver.exe to $(SRCTMP)"\r
+ if NOT exist $(SRCTMP)\nul mkdir $(SRCTMP)\r
+ xcopy /D/Y $(CO)\*.* $(SRCTMP)\r
+ xcopy /D/Y $(COWIN)\*.* $(SRCTMP)\r
+ xcopy /D/Y $(CCUTIL)\*.* $(SRCTMP)\r
+ xcopy /D/Y $(SRVDIR)\*.* $(SRCTMP)\r
+ xcopy /D/Y $(SRVWIN)\*.* $(SRCTMP)\r
+ cd $(SRCTMP)\r
+ if NOT exist $(OUTPRE)\nul mkdir $(OUTPRE)\r
+\r
+midl : ccs_request.h ccs_reply.h\r
+\r
+$(OUTPRE)ccapiserver.exe: $(OBJS)\r
+ $(LINK) $(LFLAGS) /map:$*.map /out:$@ $(OBJS) $(LIBS) $(conlibsdll) $(conflags) \r
+\r
+finish : \r
+ @echo "Finished building ccapiserver.exe"\r
+ cd\r
+\r
+clean:: \r
+ if exist $(OUTPRE)*.exe del $(OUTPRE)*.exe\r
+ if exist $(OUTPRE)*.obj del $(OUTPRE)*.obj\r
+ if exist $(OUTPRE)*.res del $(OUTPRE)*.res\r
+ if exist $(OUTPRE)*.map del $(OUTPRE)*.map\r
+ if exist $(OUTPRE)*.pdb del $(OUTPRE)*.pdb\r
+ if exist *.err del *.err\r
+ if exist $(SRCTMP) rm -rf $(SRCTMP)\r
\r
if (worklist_remove(&rpcmsg, &pipe, &buf, &serverStartTime)) {\r
uuid = ccs_win_pipe_getUuid(pipe);\r
+#if 0\r
cci_debug_printf("%s: processing WorkItem msg:%ld pipeUUID:<%s> pipeHandle:0x%X SST:%ld", \r
__FUNCTION__, rpcmsg, uuid, ccs_win_pipe_getHandle(pipe), serverStartTime);\r
-\r
+#endif\r
if (serverStartTime <= getMySST()) {\r
switch (rpcmsg) {\r
case CCMSG_CONNECT: {\r
cci_stream_t stream;
DWORD* p = (DWORD*)(tspHandle);
WIN_PIPE* pipe = NULL;
-
- cci_debug_printf("%s rpcmsg:%d; UUID:<%s> SST:<%s>",
- __FUNCTION__, rpcmsg, pszUUID, serverStartTime);
-
+#if 0
+ cci_debug_printf("%s rpcmsg:%d; UUID:<%s> SST:<%s>", __FUNCTION__, rpcmsg, pszUUID, serverStartTime);
+#endif
status = (rpcmsg != CCMSG_REQUEST) && (rpcmsg != CCMSG_PING);
if (!status) {
DWORD* p = (DWORD*)(tspHandle);
WIN_PIPE* pipe = ccs_win_pipe_new(pszUUID, *p);
-
+#if 0
cci_debug_printf("%s; rpcmsg:%d; UUID: <%s>", __FUNCTION__, rpcmsg, pszUUID);
-
+#endif
worklist_add( rpcmsg,
pipe,
NULL, /* No payload with connect request */
PDWORD pvalue = 0;
CC_UINT32 result = 0;
DWORD status = 0;
-
+#if 0
cci_debug_printf("%s ( %s )", __FUNCTION__, name);
-
+#endif
hMap = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, (LPSTR)name);
status = !hMap;
out_pipe->uuid = uuidCopy;
out_pipe->clientHandle = h;
}
-
+#if 0
cci_debug_printf("0x%X = %s(%s, 0x%X)", out_pipe, __FUNCTION__, uuid, h);
-
+#endif
return out_pipe;
}
$(OUTPRE)pingtest.$(OBJEXT) \
$(OBJECTS)
-TEST_NAMES = test_constants \
+TESTALLOBJS=$(OUTPRE)main.$(OBJEXT) \
+ $(OBJECTS)
+
+TEST_NAMES = test_cc_ccache_iterator_next \
+ test_constants \
test_cc_initialize \
- test_cc_context_get_version
+ test_cc_context_get_version \
+ test_cc_credentials_iterator_next
MORE_TESTS = test_cc_context_release \
test_cc_context_get_change_time \
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
+ test_cc_ccache_clear_kdc_time_offset
##### Linker
LINK = link
##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 success-message
+all-mac:: setup-test-dir pingtest simple_lock_test build-base build-tests link-tests copy-script success-message
+all-windows:: setup-windows build-base $(OUTPRE)pingtest.exe build-tests build-testall copy-script success-message
# compile base files used by all tests
build-base: $(PINGOBJS)
copy ..\lib\win\srctmp\$@ .
# This rule assumes that nmake in ..\lib\win\ has already run.
-$(OUTPRE)pingtest.exe: $(OBJECTS)
+$(OUTPRE)pingtest.exe: $(OBJECTS) $(PINGOBJS)
# 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
link-tests: $(TEST_NAMES)
+build-testall: $(TEST_NAMES) $(OBJECTS) $(TESTALLOBJS) testall.exe
+
+testall.exe:
+ $(LINK) $(linkdebug) /map:$(@B)1.map -out:$(*B)1.exe $(conflags) $(TESTALLOBJS) $(LIBS) $(conslibdll)
+
+
simple_lock_test:
$(CC) -o $(TESTDIR)/simple_lock_test simple_lock_test.c $(LIBS)
BEGIN_TEST("cc_initialize");
// try every api_version
- err = check_once_cc_initialize(&context, ccapi_version_2, NULL, NULL, 9, "cc_initialize with ccapi_version_2"); // err == CC_BAD_API_VERSION (9) would be imported by CredentialsCache2.h
+ err = check_once_cc_initialize(&context, ccapi_version_2, NULL, NULL, ccNoError, "cc_initialize with ccapi_version_2"); // err == CC_BAD_API_VERSION (9) would be imported by CredentialsCache2.h
err = check_once_cc_initialize(&context, ccapi_version_3, NULL, NULL, ccNoError, "cc_initialize with ccapi_version_3"); // !err
err = check_once_cc_initialize(&context, ccapi_version_4, NULL, NULL, ccNoError, "cc_initialize with ccapi_version_4"); // "
err = check_once_cc_initialize(&context, ccapi_version_5, NULL, NULL, ccNoError, "cc_initialize with ccapi_version_5"); // "
#include "test_ccapi_iterators.h"
#include "test_ccapi_check.h"
#include "test_ccapi_util.h"
+#include "cci_debugging.h"
// ---------------------------------------------------------------------------
}
for(i = 0; !err && (i < 1000); i++)
{
- err = cc_context_create_new_ccache(context, cc_credentials_v5, "foo@BAR.ORG", &ccache);
+ if (i%10 == 0) cci_debug_printf("%s loop: %d", __FUNCTION__, i);
+ err = cc_context_create_new_ccache(context, cc_credentials_v5, "foo@BAR.ORG", &ccache);
if (ccache) {
cc_ccache_release(ccache);
ccache = NULL;
err = cc_context_create_new_ccache(context, cc_credentials_v5, "foo@BAR.ORG", &ccache);
}
for(i = 0; !err && (i < 1000); i++) {
- new_v5_creds_union(&creds_union, "BAR.ORG");
+ if (i%10 == 0) cci_debug_printf("%s loop: %d", __FUNCTION__, i);
+ new_v5_creds_union(&creds_union, "BAR.ORG");
err = cc_ccache_store_credentials(ccache, &creds_union);
release_v5_creds_union(&creds_union);
}