From: Alexandra Ellwood Date: Wed, 20 Aug 2008 18:46:46 +0000 (+0000) Subject: Notify clients on ccache deletion X-Git-Tag: krb5-1.7-alpha1~471 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7ac8c2023422a829a3fdfa81b576a2910c232458;p=krb5.git Notify clients on ccache deletion Clients watching a ccache or the cache collection should get a notification when the ccache is destroyed. ticket: new git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20678 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/ccapi/server/ccs_cache_collection.c b/src/ccapi/server/ccs_cache_collection.c index 02d4d8f7d..a1531bdb3 100644 --- a/src/ccapi/server/ccs_cache_collection.c +++ b/src/ccapi/server/ccs_cache_collection.c @@ -320,15 +320,28 @@ cc_int32 ccs_cache_collection_destroy_ccache (ccs_cache_collection_t io_cache_c cci_identifier_t in_identifier) { cc_int32 err = ccNoError; + ccs_ccache_t ccache = NULL; if (!io_cache_collection) { err = cci_check_error (ccErrBadParam); } if (!in_identifier ) { err = cci_check_error (ccErrBadParam); } + if (!err) { + err = ccs_cache_collection_find_ccache (io_cache_collection, + in_identifier, + &ccache); + } + + if (!err) { + /* Notify before deletion because after deletion the ccache + * will no longer exist (and won't know about its clients) */ + err = ccs_ccache_changed (ccache, io_cache_collection); + } + if (!err) { err = ccs_ccache_list_remove (io_cache_collection->ccaches, in_identifier); } - + return cci_check_error (err); } diff --git a/src/ccapi/server/ccs_ccache.c b/src/ccapi/server/ccs_ccache.c index c2e36bf0b..4ebf2a006 100644 --- a/src/ccapi/server/ccs_ccache.c +++ b/src/ccapi/server/ccs_ccache.c @@ -45,9 +45,6 @@ struct ccs_ccache_d { struct ccs_ccache_d ccs_ccache_initializer = { NULL, NULL, 0, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, NULL, NULL }; -static cc_int32 ccs_ccache_changed (ccs_ccache_t io_ccache, - ccs_cache_collection_t io_cache_collection); - /* ------------------------------------------------------------------------ */ cc_int32 ccs_ccache_new (ccs_ccache_t *out_ccache, @@ -313,8 +310,8 @@ cc_int32 ccs_ccache_compare_name (ccs_ccache_t in_ccache, /* ------------------------------------------------------------------------ */ -static cc_int32 ccs_ccache_changed (ccs_ccache_t io_ccache, - ccs_cache_collection_t io_cache_collection) +cc_int32 ccs_ccache_changed (ccs_ccache_t io_ccache, + ccs_cache_collection_t io_cache_collection) { cc_int32 err = ccNoError; cci_stream_t reply_data = NULL; @@ -361,7 +358,7 @@ static cc_int32 ccs_ccache_changed (ccs_ccache_t io_ccache, } } } - + cci_stream_release (reply_data); return cci_check_error (err); diff --git a/src/ccapi/server/ccs_ccache.h b/src/ccapi/server/ccs_ccache.h index ba32752ab..3e9f6ae85 100644 --- a/src/ccapi/server/ccs_ccache.h +++ b/src/ccapi/server/ccs_ccache.h @@ -46,6 +46,9 @@ cc_int32 ccs_ccache_swap_contents (ccs_ccache_t io_source_ccache, cc_int32 ccs_ccache_release (ccs_ccache_t io_ccache); +cc_int32 ccs_ccache_changed (ccs_ccache_t io_ccache, + ccs_cache_collection_t io_cache_collection); + cc_int32 ccs_ccache_compare_identifier (ccs_ccache_t in_ccache, cci_identifier_t in_identifier, cc_uint32 *out_equal);