From 4e824737afa8bb05db07d92a04855149c2fba5d8 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Fri, 19 May 2006 09:18:37 +0000 Subject: Updates of portable CCAPI sources. All code compiles git-svn-id: svn://anonsvn.mit.edu/krb5/branches/ccapi@18022 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/ccapi/unit-test/NTMakefile | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/lib/ccapi/unit-test/NTMakefile (limited to 'src/lib/ccapi/unit-test') diff --git a/src/lib/ccapi/unit-test/NTMakefile b/src/lib/ccapi/unit-test/NTMakefile new file mode 100644 index 000000000..eb2fd53e2 --- /dev/null +++ b/src/lib/ccapi/unit-test/NTMakefile @@ -0,0 +1,30 @@ +# Makefile for the CCAPI Generic Server + +!INCLUDE + +CFLAGS = -I../include + +CCAPI_LIB = ../lib/ccapi.lib +WINLIBS = user32.lib advapi32.lib +CCSOBJS = context.obj ccache.obj lists.obj rpc_auth.obj serv_ops.obj + +all: t_lists.exe t_msg.exe t_ccache.exe t_context.exe ccapi_server.exe + +t_lists.exe: t_lists.obj $(CCSOBJS) $(CCAPI_LIB) + link -out:$@ t_lists.obj $(CCSOBJS) $(CCAPI_LIB) $(WINLIBS) + +t_msg.exe: t_msg.obj $(CCSOBJS) $(CCAPI_LIB) + link -out:$@ t_msg.obj $(CCSOBJS) $(CCAPI_LIB) $(WINLIBS) + +t_ccache.exe: t_ccache.obj $(CCSOBJS) $(CCAPI_LIB) + link -out:$@ t_ccache.obj $(CCSOBJS) $(CCAPI_LIB) $(WINLIBS) + +t_context.exe: t_context.obj $(CCSOBJS) $(CCAPI_LIB) + link -out:$@ t_context.obj $(CCSOBJS) $(CCAPI_LIB) $(WINLIBS) + +ccapi_server.exe: main.obj $(CCSOBJS) $(CCAPI_LIB) + link -out:$@ main.obj $(CCSOBJS) $(CCAPI_LIB) $(WINLIBS) + +clean: + del *.obj *.exe + -- cgit From 3d6591dd63c23bcc0ae68e94a960c85fd53daad0 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Mon, 5 Jun 2006 04:30:35 +0000 Subject: more updates git-svn-id: svn://anonsvn.mit.edu/krb5/branches/ccapi@18082 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/ccapi/unit-test/NTMakefile | 56 ++++++++++++++++++++++++------------- src/lib/ccapi/unit-test/t_ccache.c | 24 ++++++++-------- src/lib/ccapi/unit-test/t_context.c | 34 +++++++++++----------- src/lib/ccapi/unit-test/t_server.c | 4 +-- 4 files changed, 68 insertions(+), 50 deletions(-) (limited to 'src/lib/ccapi/unit-test') diff --git a/src/lib/ccapi/unit-test/NTMakefile b/src/lib/ccapi/unit-test/NTMakefile index eb2fd53e2..9bb486b6d 100644 --- a/src/lib/ccapi/unit-test/NTMakefile +++ b/src/lib/ccapi/unit-test/NTMakefile @@ -1,30 +1,48 @@ -# Makefile for the CCAPI Generic Server +!include -!INCLUDE +CFLAGS = -I../include $(cdebug) $(cflags) $(cvarsmt) -CFLAGS = -I../include +WINLIBS = ws2_32.lib rpcrt4.lib $(guilibsdll) -CCAPI_LIB = ../lib/ccapi.lib -WINLIBS = user32.lib advapi32.lib -CCSOBJS = context.obj ccache.obj lists.obj rpc_auth.obj serv_ops.obj +T_CCACHE = t_ccache.exe -all: t_lists.exe t_msg.exe t_ccache.exe t_context.exe ccapi_server.exe +T_CONTEXT = t_context.exe -t_lists.exe: t_lists.obj $(CCSOBJS) $(CCAPI_LIB) - link -out:$@ t_lists.obj $(CCSOBJS) $(CCAPI_LIB) $(WINLIBS) +T_LISTS = t_lists.exe -t_msg.exe: t_msg.obj $(CCSOBJS) $(CCAPI_LIB) - link -out:$@ t_msg.obj $(CCSOBJS) $(CCAPI_LIB) $(WINLIBS) +T_MSG = t_msg.exe -t_ccache.exe: t_ccache.obj $(CCSOBJS) $(CCAPI_LIB) - link -out:$@ t_ccache.obj $(CCSOBJS) $(CCAPI_LIB) $(WINLIBS) +T_SERVER = t_server.exe -t_context.exe: t_context.obj $(CCSOBJS) $(CCAPI_LIB) - link -out:$@ t_context.obj $(CCSOBJS) $(CCAPI_LIB) $(WINLIBS) +all: $(T_CCACHE) $(T_CONTEXT) $(T_LISTS) $(T_MSG) $(T_SERVER) -ccapi_server.exe: main.obj $(CCSOBJS) $(CCAPI_LIB) - link -out:$@ main.obj $(CCSOBJS) $(CCAPI_LIB) $(WINLIBS) +ntccrpc_c.c ntccrpc_s.c ntccrpc.h: ntccrpc.idl ntccrpc.acf + midl ntccrpc.idl /acf ntccrpc.acf + +CC_CLIENT_LIB = ..\client\cc_client.lib + +CC_COMMON_LIB = ..\common\cc_common.lib + +CC_SERVER_LIB = ..\server\cc_server.lib + +CC_API_LIB = ..\windows\krbcc32.lib + +$(T_CCACHE): t_ccache.obj $(CC_SERVER_LIB) $(CC_COMMON_LIB) + $(link) /NOLOGO $(conlibsmt) $(ldebug) $(conlflags) /OUT:$@ $** $(WINLIBS) + +$(T_CONTEXT): t_context.obj $(CC_SERVER_LIB) $(CC_COMMON_LIB) + $(link) /NOLOGO $(conlibsmt) $(ldebug) $(conlflags) /OUT:$@ $** $(WINLIBS) + +$(T_LISTS): t_lists.obj $(CC_SERVER_LIB) $(CC_COMMON_LIB) + $(link) /NOLOGO $(conlibsmt) $(ldebug) $(conlflags) /OUT:$@ $** $(WINLIBS) + +$(T_MSG): t_msg.obj $(CC_SERVER_LIB) $(CC_COMMON_LIB) + $(link) /NOLOGO $(conlibsmt) $(ldebug) $(conlflags) /OUT:$@ $** $(WINLIBS) + +$(T_SERVER): t_server.obj $(CC_SERVER_LIB) $(CC_COMMON_LIB) + $(link) /NOLOGO $(conlibsmt) $(ldebug) $(conlflags) /OUT:$@ $** $(WINLIBS) + +clean: + del *.exe *.dll *.lib *.exp *.obj ntccrpc_c.c ntccrpc_s.c ntccrpc.h -clean: - del *.obj *.exe diff --git a/src/lib/ccapi/unit-test/t_ccache.c b/src/lib/ccapi/unit-test/t_ccache.c index 6ef33ea23..175764e79 100644 --- a/src/lib/ccapi/unit-test/t_ccache.c +++ b/src/lib/ccapi/unit-test/t_ccache.c @@ -59,8 +59,8 @@ int main() { int i; cc_int32 code; - code = cci_ccache_new("The first", p1, cc_credentials_v4_v5, &c1); - code = cci_ccache_new("The 2nd", p2, cc_credentials_v4_v5, &c2); + code = ccs_ccache_new("The first", p1, cc_credentials_v4_v5, &c1); + code = ccs_ccache_new("The 2nd", p2, cc_credentials_v4_v5, &c2); cred1 = (cc_server_credentials_t*)malloc(sizeof(cc_server_credentials_t)); memset(cred1,0,sizeof(cc_server_credentials_t)); @@ -83,30 +83,30 @@ int main() { strncpy(cred2->creds.credentials.credentials_v4->principal, p1, strlen(p1)); cred3->creds.credentials.credentials_v5->client = p1; - code = cci_ccache_store_creds(c1, &cred1->creds); + code = ccs_ccache_store_creds(c1, &cred1->creds); printf("(c1, cred1) -> %d\n",code); - code = cci_ccache_store_creds(c1, &cred2->creds); + code = ccs_ccache_store_creds(c1, &cred2->creds); printf("(c1, cred2) -> %d\n",code); - code = cci_ccache_store_creds(c2, &cred3->creds); + code = ccs_ccache_store_creds(c2, &cred3->creds); printf("(c2, cred3) -> %d\n",code); - code = cci_ccache_store_creds(c1, &cred3->creds); + code = ccs_ccache_store_creds(c1, &cred3->creds); printf("(c1, cred3) -> %d\n",code); i = 0; - code = cci_ccache_move(c1, c2); - code = cci_ccache_destroy(c1); - code = cci_ccache_new_iterator(c2, &iterator); - while (cci_credentials_iterate_has_next(iterator)) { + code = ccs_ccache_move(c1, c2); + code = ccs_ccache_destroy(c1); + code = ccs_ccache_new_iterator(c2, &iterator); + while (ccs_credentials_iterate_has_next(iterator)) { i++; - code = cci_credentials_iterate_next(iterator, &node); + code = ccs_credentials_iterate_next(iterator, &node); stored_cred = (cc_server_credentials_t *)node->data; printf("%d %d %s\n", stored_cred->is_default, stored_cred->creds.version, stored_cred->creds.credentials.credentials_v4->principal); if (i == 1) { - code = cci_ccache_rem_creds(c2,&cred2->creds); + code = ccs_ccache_rem_creds(c2,&cred2->creds); printf("(c2 rem cred2) -> %d\n",code); } } diff --git a/src/lib/ccapi/unit-test/t_context.c b/src/lib/ccapi/unit-test/t_context.c index 9e35d9abf..d76ff78d9 100644 --- a/src/lib/ccapi/unit-test/t_context.c +++ b/src/lib/ccapi/unit-test/t_context.c @@ -68,10 +68,10 @@ int main() { int i; cc_int32 code; - code = cci_context_new(5, auth_info, session_info, &ctx); - code = cci_context_create_default_ccache(ctx, cc_credentials_v4, "Spike", &ccache); - code = cci_context_get_default_ccache_name(ctx, &name); - code = cci_context_open_ccache(ctx, name, &ccache); + code = ccs_context_new(5, auth_info, session_info, &ctx); + code = ccs_context_create_default_ccache(ctx, cc_credentials_v4, "Spike", &ccache); + code = ccs_context_get_default_ccache_name(ctx, &name); + code = ccs_context_open_ccache(ctx, name, &ccache); for (i = 0; i < 5; i++) { creds = (cc_credentials_union*)malloc(sizeof(cc_credentials_union)); @@ -79,32 +79,32 @@ int main() { creds->credentials.credentials_v4 = (cc_credentials_v4_t*)malloc(sizeof(cc_credentials_v4_t)); strcpy(creds->credentials.credentials_v4->principal, "Spike"); - code = cci_ccache_store_creds(ccache, creds); + code = ccs_ccache_store_creds(ccache, creds); } - code = cci_context_create_ccache(ctx, "ccache 2", cc_credentials_v4, "Jeff", &ccache); - code = cci_context_open_ccache(ctx, "ccache 2", &ccache); + code = ccs_context_create_ccache(ctx, "ccache 2", cc_credentials_v4_v5, "Jeff", &ccache); + code = ccs_context_open_ccache(ctx, "ccache 2", &ccache); for (i = 0; i < 5; i++) { creds = (cc_credentials_union*)malloc(sizeof(cc_credentials_union)); - creds->version = cc_credentials_v4; - creds->credentials.credentials_v4 = (cc_credentials_v4_t*)malloc(sizeof(cc_credentials_v4_t)); - strcpy(creds->credentials.credentials_v4->principal, "Jeff"); + creds->version = cc_credentials_v5; + creds->credentials.credentials_v5 = (cc_credentials_v5_t*)malloc(sizeof(cc_credentials_v5_t)); + strcpy(creds->credentials.credentials_v5->principal, "Jeff"); - cci_ccache_store_creds(ccache, creds); + ccs_ccache_store_creds(ccache, creds); } - code = cci_context_ccache_iterator(ctx, &ccache_iterator); - while (cci_ccache_iterate_has_next(ccache_iterator)) { - code = cci_ccache_iterate_next(ccache_iterator, &ccache_node); + code = ccs_context_ccache_iterator(ctx, &ccache_iterator); + while (ccs_ccache_iterate_has_next(ccache_iterator)) { + code = ccs_ccache_iterate_next(ccache_iterator, &ccache_node); ccache = (cc_server_ccache_t *)ccache_node->data; printf("%x for %s %s default = %d v %d\n", ccache, ccache->principal_v4, ccache->principal_v5, ccache->is_default, ccache->versions); - code = cci_ccache_new_iterator(ccache, &creds_iterator); - while (cci_credentials_iterate_has_next(creds_iterator)) { - code = cci_credentials_iterate_next(creds_iterator, &creds_node); + code = ccs_ccache_new_iterator(ccache, &creds_iterator); + while (ccs_credentials_iterate_has_next(creds_iterator)) { + code = ccs_credentials_iterate_next(creds_iterator, &creds_node); server_creds = (cc_server_credentials_t *)creds_node->data; printf("\t%s %d\n", server_creds->creds.credentials.credentials_v4->principal, diff --git a/src/lib/ccapi/unit-test/t_server.c b/src/lib/ccapi/unit-test/t_server.c index d4d998466..d6093941e 100644 --- a/src/lib/ccapi/unit-test/t_server.c +++ b/src/lib/ccapi/unit-test/t_server.c @@ -143,7 +143,7 @@ main(void) cc_session_info_t * session_info; cc_int32 code; - if ( cci_serv_initialize() != ccNoError ) + if ( ccs_serv_initialize() != ccNoError ) return 1; while ( 1 ) { @@ -163,7 +163,7 @@ main(void) code = obtain_session_info(&session_info); /* process message */ - code = cci_serv_process_msg(msg, auth_info, session_info, &resp); + code = ccs_serv_process_msg(msg, auth_info, session_info, &resp); /* flatten response */ code = cci_msg_flatten(resp, NULL); -- cgit From f42fa33b985c230736ad5d9080055916de33be8c Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Mon, 5 Jun 2006 17:49:34 +0000 Subject: improved error handling git-svn-id: svn://anonsvn.mit.edu/krb5/branches/ccapi@18083 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/ccapi/unit-test/NTMakefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/lib/ccapi/unit-test') diff --git a/src/lib/ccapi/unit-test/NTMakefile b/src/lib/ccapi/unit-test/NTMakefile index 9bb486b6d..73f53f2e4 100644 --- a/src/lib/ccapi/unit-test/NTMakefile +++ b/src/lib/ccapi/unit-test/NTMakefile @@ -14,7 +14,9 @@ T_MSG = t_msg.exe T_SERVER = t_server.exe -all: $(T_CCACHE) $(T_CONTEXT) $(T_LISTS) $(T_MSG) $(T_SERVER) +T_CCAPI = t_ccapi.exe + +all: $(T_CCAPI) $(T_CCACHE) $(T_CONTEXT) $(T_LISTS) $(T_MSG) $(T_SERVER) ntccrpc_c.c ntccrpc_s.c ntccrpc.h: ntccrpc.idl ntccrpc.acf midl ntccrpc.idl /acf ntccrpc.acf @@ -42,6 +44,9 @@ $(T_MSG): t_msg.obj $(CC_SERVER_LIB) $(CC_COMMON_LIB) $(T_SERVER): t_server.obj $(CC_SERVER_LIB) $(CC_COMMON_LIB) $(link) /NOLOGO $(conlibsmt) $(ldebug) $(conlflags) /OUT:$@ $** $(WINLIBS) +$(T_CCAPI): t_ccapi.obj $(CC_API_LIB) + $(link) /NOLOGO $(conlibsmt) $(ldebug) $(conlflags) /OUT:$@ $** $(WINLIBS) + clean: del *.exe *.dll *.lib *.exp *.obj ntccrpc_c.c ntccrpc_s.c ntccrpc.h -- cgit