From 50e7f8e37b9d532343d9316677559664df88b466 Mon Sep 17 00:00:00 2001 From: Alexandra Ellwood Date: Wed, 22 Oct 2008 20:40:29 +0000 Subject: [PATCH] Remove ipc message sent on cc_context_release IPC message was causing problems when called from thread fini function (via krb5_stdcc_shutdown). ticket: new git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20908 dc483132-0cff-0310-8789-dd5450dbe970 --- src/ccapi/common/cci_types.h | 2 +- src/ccapi/lib/ccapi_context.c | 21 ++++++++++----------- src/ccapi/lib/ccapi_context.h | 4 ++++ src/ccapi/server/ccs_cache_collection.c | 24 ++---------------------- 4 files changed, 17 insertions(+), 34 deletions(-) diff --git a/src/ccapi/common/cci_types.h b/src/ccapi/common/cci_types.h index 20c64701a..43f7100ce 100644 --- a/src/ccapi/common/cci_types.h +++ b/src/ccapi/common/cci_types.h @@ -39,7 +39,7 @@ enum cci_msg_id_t { /* cc_context_t */ cci_context_first_msg_id, - cci_context_release_msg_id, + cci_context_unused_release_msg_id, /* Unused. Handle for old clients. */ cci_context_sync_msg_id, cci_context_get_change_time_msg_id, cci_context_wait_for_change_msg_id, diff --git a/src/ccapi/lib/ccapi_context.c b/src/ccapi/lib/ccapi_context.c index 0f1712ea4..7ba3db4d2 100644 --- a/src/ccapi/lib/ccapi_context.c +++ b/src/ccapi/lib/ccapi_context.c @@ -198,6 +198,16 @@ cc_int32 cc_initialize (cc_context_t *out_context, #endif /* ------------------------------------------------------------------------ */ +/* + * Currently does not need to talk to the server since the server must + * handle cleaning up resources from crashed clients anyway. + * + * NOTE: if server communication is ever added here, make sure that + * krb5_stdcc_shutdown calls an internal function which does not talk to the + * server. krb5_stdcc_shutdown is called from thread fini functions and may + * crash talking to the server depending on what order the OS calls the fini + * functions (ie: if the ipc layer fini function is called first). + */ cc_int32 ccapi_context_release (cc_context_t in_context) { @@ -206,17 +216,6 @@ cc_int32 ccapi_context_release (cc_context_t in_context) if (!in_context) { err = ccErrBadParam; } - if (!err) { - err = cci_context_sync (context, 0); - } - - if (!err) { - err = cci_ipc_send_no_launch (cci_context_release_msg_id, - context->identifier, - NULL, - NULL); - } - if (!err) { cci_identifier_release (context->identifier); free (context->functions); diff --git a/src/ccapi/lib/ccapi_context.h b/src/ccapi/lib/ccapi_context.h index 7462a056e..564f49db9 100644 --- a/src/ccapi/lib/ccapi_context.h +++ b/src/ccapi/lib/ccapi_context.h @@ -29,6 +29,10 @@ #include "cci_common.h" +/* Used for freeing ccapi context in thread fini calls + * Does not tell the server you are exiting. */ +cc_int32 cci_context_destroy (cc_context_t in_context); + cc_int32 ccapi_context_release (cc_context_t in_context); cc_int32 ccapi_context_get_change_time (cc_context_t in_context, diff --git a/src/ccapi/server/ccs_cache_collection.c b/src/ccapi/server/ccs_cache_collection.c index b09ae8d8e..3790a10aa 100644 --- a/src/ccapi/server/ccs_cache_collection.c +++ b/src/ccapi/server/ccs_cache_collection.c @@ -571,25 +571,6 @@ cc_int32 ccs_cache_collection_set_default_ccache (ccs_cache_collection_t io_cac /* ------------------------------------------------------------------------ */ -static cc_int32 ccs_cache_collection_context_release (ccs_cache_collection_t io_cache_collection, - k5_ipc_stream in_request_data, - k5_ipc_stream io_reply_data) -{ - cc_int32 err = ccNoError; - - if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); } - if (!in_request_data ) { err = cci_check_error (ccErrBadParam); } - if (!io_reply_data ) { err = cci_check_error (ccErrBadParam); } - - if (!err) { - /* Currently does nothing */ - } - - return cci_check_error (err); -} - -/* ------------------------------------------------------------------------ */ - static cc_int32 ccs_cache_collection_sync (ccs_cache_collection_t io_cache_collection, k5_ipc_stream in_request_data, k5_ipc_stream io_reply_data) @@ -1051,9 +1032,8 @@ static cc_int32 ccs_cache_collection_unlock (ccs_pipe_t in_client_pi } if (!err) { - if (in_request_name == cci_context_release_msg_id) { - err = ccs_cache_collection_context_release (io_cache_collection, - in_request_data, reply_data); + if (in_request_name == cci_context_unused_release_msg_id) { + /* Old release message. Do nothing. */ } else if (in_request_name == cci_context_sync_msg_id) { err = ccs_cache_collection_sync (io_cache_collection, -- 2.26.2