From: Greg Hudson Date: Wed, 2 Feb 2022 21:01:48 +0000 (-0500) Subject: Remove unused CCAPI libkrb5 code X-Git-Tag: krb5-1.21-beta1~73 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=151004b6364e232e8195d19b189f9a682589a094;p=thirdparty%2Fkrb5.git Remove unused CCAPI libkrb5 code Remove the pre-CCAPIv3 code in the ccache type, and remove the unused stdccCredsMatch() function from stdcc_util.c. --- diff --git a/src/lib/krb5/ccache/Makefile.in b/src/lib/krb5/ccache/Makefile.in index 73468547e7..eaff6d2d98 100644 --- a/src/lib/krb5/ccache/Makefile.in +++ b/src/lib/krb5/ccache/Makefile.in @@ -2,11 +2,9 @@ mydir=lib$(S)krb5$(S)ccache BUILDTOP=$(REL)..$(S)..$(S).. SUBDIRS = # ccapi WINSUBDIRS = ccapi -##WIN32##DEFINES = -DUSE_CCAPI -DUSE_CCAPI_V3 +##WIN32##DEFINES = -DUSE_CCAPI -LOCALINCLUDES = -I$(srcdir)$(S)ccapi -I$(srcdir) -I. $(WIN_INCLUDES) - -##DOS##WIN_INCLUDES = -I$(top_srcdir)\windows\lib +LOCALINCLUDES = -I$(srcdir)$(S)ccapi -I$(srcdir) -I. ##DOS##BUILDTOP = ..\..\.. ##DOS##PREFIXDIR=ccache diff --git a/src/lib/krb5/ccache/cc-int.h b/src/lib/krb5/ccache/cc-int.h index 70f28273eb..6039a1f5bb 100644 --- a/src/lib/krb5/ccache/cc-int.h +++ b/src/lib/krb5/ccache/cc-int.h @@ -110,13 +110,11 @@ extern k5_cc_mutex krb5int_mcc_mutex; extern k5_cc_mutex krb5int_krcc_mutex; extern k5_cc_mutex krb5int_cc_file_mutex; -#ifdef USE_CCAPI_V3 extern krb5_error_code KRB5_CALLCONV krb5_stdccv3_context_lock (krb5_context context); extern krb5_error_code KRB5_CALLCONV krb5_stdccv3_context_unlock (krb5_context context); -#endif krb5_error_code k5_cc_lock(krb5_context context, krb5_ccache ccache); diff --git a/src/lib/krb5/ccache/ccapi/Makefile.in b/src/lib/krb5/ccache/ccapi/Makefile.in index 7365737860..c842b498ee 100644 --- a/src/lib/krb5/ccache/ccapi/Makefile.in +++ b/src/lib/krb5/ccache/ccapi/Makefile.in @@ -1,7 +1,7 @@ mydir=lib$(S)krb5$(S)ccache$(S)ccapi BUILDTOP=$(REL)..$(S)..$(S)..$(S).. LOCALINCLUDES = $(WIN_INCLUDES) -DEFINES= -DUSE_CCAPI -DUSE_CCAPI_V3 +DEFINES= -DUSE_CCAPI ##DOS##WIN_INCLUDES = -I$(top_srcdir)\windows\lib diff --git a/src/lib/krb5/ccache/ccapi/stdcc.c b/src/lib/krb5/ccache/ccapi/stdcc.c index 0dc5259fd0..bb13eb5741 100644 --- a/src/lib/krb5/ccache/ccapi/stdcc.c +++ b/src/lib/krb5/ccache/ccapi/stdcc.c @@ -57,12 +57,8 @@ #define SHOW_DEBUG(buf) #endif -#ifdef USE_CCAPI_V3 cc_context_t gCntrlBlock = NULL; cc_int32 gCCVersion = 0; -#else -apiCB *gCntrlBlock = NULL; -#endif /* * declare our global object wanna-be @@ -72,7 +68,6 @@ apiCB *gCntrlBlock = NULL; krb5_cc_ops krb5_cc_stdcc_ops = { 0, "API", -#ifdef USE_CCAPI_V3 krb5_stdccv3_get_name, krb5_stdccv3_resolve, krb5_stdccv3_generate_new, @@ -96,28 +91,6 @@ krb5_cc_ops krb5_cc_stdcc_ops = { krb5_stdccv3_lock, krb5_stdccv3_unlock, krb5_stdccv3_switch_to, -#else - krb5_stdcc_get_name, - krb5_stdcc_resolve, - krb5_stdcc_generate_new, - krb5_stdcc_initialize, - krb5_stdcc_destroy, - krb5_stdcc_close, - krb5_stdcc_store, - krb5_stdcc_retrieve, - krb5_stdcc_get_principal, - krb5_stdcc_start_seq_get, - krb5_stdcc_next_cred, - krb5_stdcc_end_seq_get, - krb5_stdcc_remove, - krb5_stdcc_set_flags, - krb5_stdcc_get_flags, - NULL, - NULL, - NULL, - NULL, - NULL, -#endif }; #if defined(_WIN32) @@ -153,7 +126,6 @@ struct err_xlate static const struct err_xlate err_xlate_table[] = { -#ifdef USE_CCAPI_V3 { ccIteratorEnd, KRB5_CC_END }, { ccErrBadParam, KRB5_FCC_INTERNAL }, { ccErrNoMem, KRB5_CC_NOMEM }, @@ -182,25 +154,6 @@ static const struct err_xlate err_xlate_table[] = { ccErrTimeOffsetNotSet, KRB5_FCC_INTERNAL }, { ccErrBadInternalMessage, KRB5_FCC_INTERNAL }, { ccErrNotImplemented, KRB5_FCC_INTERNAL }, -#else - { CC_BADNAME, KRB5_CC_BADNAME }, - { CC_NOTFOUND, KRB5_CC_NOTFOUND }, - { CC_END, KRB5_CC_END }, - { CC_IO, KRB5_CC_IO }, - { CC_WRITE, KRB5_CC_WRITE }, - { CC_NOMEM, KRB5_CC_NOMEM }, - { CC_FORMAT, KRB5_CC_FORMAT }, - { CC_WRITE, KRB5_CC_WRITE }, - { CC_LOCKED, KRB5_FCC_INTERNAL /* XXX */ }, - { CC_BAD_API_VERSION, KRB5_FCC_INTERNAL /* XXX */ }, - { CC_NO_EXIST, KRB5_FCC_NOFILE }, - { CC_NOT_SUPP, KRB5_FCC_INTERNAL /* XXX */ }, - { CC_BAD_PARM, KRB5_FCC_INTERNAL /* XXX */ }, - { CC_ERR_CACHE_ATTACH, KRB5_FCC_INTERNAL /* XXX */ }, - { CC_ERR_CACHE_RELEASE, KRB5_FCC_INTERNAL /* XXX */ }, - { CC_ERR_CACHE_FULL, KRB5_FCC_INTERNAL /* XXX */ }, - { CC_ERR_CRED_VERSION, KRB5_FCC_INTERNAL /* XXX */ }, -#endif { 0, 0 } }; @@ -209,13 +162,8 @@ static krb5_error_code cc_err_xlate(int err) { const struct err_xlate *p; -#ifdef USE_CCAPI_V3 if (err == ccNoError) return 0; -#else - if (err == CC_NOERROR) - return 0; -#endif for (p = err_xlate_table; p->cc_err; p++) { if (err == p->cc_err) @@ -226,8 +174,6 @@ static krb5_error_code cc_err_xlate(int err) } -#ifdef USE_CCAPI_V3 - static krb5_error_code stdccv3_get_timeoffset (krb5_context in_context, cc_ccache_t in_ccache) { @@ -1072,574 +1018,4 @@ krb5_error_code KRB5_CALLCONV krb5_stdccv3_switch_to return cc_err_xlate(err); } -#else /* !USE_CCAPI_V3 */ - -static krb5_error_code stdcc_setup(krb5_context context, - stdccCacheDataPtr ccapi_data) -{ - int err; - - /* make sure the API has been initialized */ - if (gCntrlBlock == NULL) { -#ifdef CC_API_VER2 - err = cc_initialize(&gCntrlBlock, CC_API_VER_2, NULL, NULL); -#else - err = cc_initialize(&gCntrlBlock, CC_API_VER_1, NULL, NULL); -#endif - if (err != CC_NOERROR) - return cc_err_xlate(err); - } - - /* - * No ccapi_data structure, so we don't need to make sure the - * ccache exists. - */ - if (!ccapi_data) - return 0; - - /* - * The ccache already exists - */ - if (ccapi_data->NamedCache) - return 0; - - err = cc_open(gCntrlBlock, ccapi_data->cache_name, - CC_CRED_V5, 0L, &ccapi_data->NamedCache); - if (err == CC_NOTFOUND) - err = CC_NO_EXIST; - if (err == CC_NOERROR) - return 0; - - ccapi_data->NamedCache = NULL; - return cc_err_xlate(err); -} - -void krb5_stdcc_shutdown() -{ - if (gCntrlBlock) - cc_shutdown(&gCntrlBlock); - gCntrlBlock = NULL; -} - -/* - * -- generate_new -------------------------------- - * - * create a new cache with a unique name, corresponds to creating a - * named cache iniitialize the API here if we have to. - */ -krb5_error_code KRB5_CALLCONV krb5_stdcc_generate_new -(krb5_context context, krb5_ccache *id ) -{ - krb5_ccache newCache = NULL; - krb5_error_code retval; - stdccCacheDataPtr ccapi_data = NULL; - char *name = NULL; - cc_time_t change_time; - int err; - - if ((retval = stdcc_setup(context, NULL))) - return retval; - - retval = KRB5_CC_NOMEM; - if (!(newCache = (krb5_ccache) malloc(sizeof(struct _krb5_ccache)))) - goto errout; - if (!(ccapi_data = (stdccCacheDataPtr)malloc(sizeof(stdccCacheData)))) - goto errout; - if (!(name = malloc(256))) - goto errout; - - /* create a unique name */ - cc_get_change_time(gCntrlBlock, &change_time); - snprintf(name, 256, "gen_new_cache%d", change_time); - - /* create the new cache */ - err = cc_create(gCntrlBlock, name, name, CC_CRED_V5, 0L, - &ccapi_data->NamedCache); - if (err != CC_NOERROR) { - retval = cc_err_xlate(err); - goto errout; - } - - /* setup some fields */ - newCache->ops = &krb5_cc_stdcc_ops; - newCache->data = ccapi_data; - ccapi_data->cache_name = name; - - /* return a pointer to the new cache */ - *id = newCache; - - return 0; - -errout: - if (newCache) - free(newCache); - if (ccapi_data) - free(ccapi_data); - if (name) - free(name); - return retval; -} - -/* - * resolve - * - * create a new cache with the name stored in residual - */ -krb5_error_code KRB5_CALLCONV krb5_stdcc_resolve -(krb5_context context, krb5_ccache *id , const char *residual ) -{ - krb5_ccache newCache = NULL; - stdccCacheDataPtr ccapi_data = NULL; - int err; - krb5_error_code retval; - char *cName = NULL; - - if ((retval = stdcc_setup(context, NULL))) - return retval; - - retval = KRB5_CC_NOMEM; - if (!(newCache = (krb5_ccache) malloc(sizeof(struct _krb5_ccache)))) - goto errout; - - if (!(ccapi_data = (stdccCacheDataPtr)malloc(sizeof(stdccCacheData)))) - goto errout; - - if (!(cName = strdup(residual))) - goto errout; - - newCache->ops = &krb5_cc_stdcc_ops; - newCache->data = ccapi_data; - ccapi_data->cache_name = cName; - - err = cc_open(gCntrlBlock, cName, CC_CRED_V5, 0L, - &ccapi_data->NamedCache); - if (err != CC_NOERROR) { - ccapi_data->NamedCache = NULL; - if (err != CC_NO_EXIST) { - retval = cc_err_xlate(err); - goto errout; - } - } - - /* return new cache structure */ - *id = newCache; - - return 0; - -errout: - if (newCache) - free(newCache); - if (ccapi_data) - free(ccapi_data); - if (cName) - free(cName); - return retval; -} - -/* - * initialize - * - * initialize the cache, check to see if one already exists for this - * principal if not set our principal to this principal. This - * searching enables ticket sharing - */ -krb5_error_code KRB5_CALLCONV krb5_stdcc_initialize -(krb5_context context, krb5_ccache id, krb5_principal princ) -{ - stdccCacheDataPtr ccapi_data = NULL; - int err; - char *cName = NULL; - krb5_error_code retval; - - if ((retval = stdcc_setup(context, NULL))) - return retval; - - /* test id for null */ - if (id == NULL) return KRB5_CC_NOMEM; - - if ((retval = krb5_unparse_name(context, princ, &cName))) - return retval; - - ccapi_data = id->data; - - - if (ccapi_data->NamedCache) - cc_close(gCntrlBlock, &ccapi_data->NamedCache); - - err = cc_create(gCntrlBlock, ccapi_data->cache_name, cName, - CC_CRED_V5, 0L, &ccapi_data->NamedCache); - if (err != CC_NOERROR) { - krb5_free_unparsed_name(context, cName); - return cc_err_xlate(err); - } - - krb5_free_unparsed_name(context, cName); - cache_changed(); - - return cc_err_xlate(err); -} - -/* - * store - * - * store some credentials in our cache - */ -krb5_error_code KRB5_CALLCONV krb5_stdcc_store -(krb5_context context, krb5_ccache id, krb5_creds *creds ) -{ - krb5_error_code retval; - stdccCacheDataPtr ccapi_data = id->data; - cred_union *cu = NULL; - int err; - - if ((retval = stdcc_setup(context, ccapi_data))) - return retval; - - /* copy the fields from the almost identical structures */ - dupK5toCC(context, creds, &cu); - - /* - * finally store the credential - * store will copy (that is duplicate) everything - */ - err = cc_store(gCntrlBlock, - ((stdccCacheDataPtr)(id->data))->NamedCache, *cu); - if (err != CC_NOERROR) - return cc_err_xlate(err); - - /* free the cred union using our local version of cc_free_creds() - since we allocated it locally */ - err = krb5int_free_cc_cred_union(&cu); - - cache_changed(); - return err; -} - -/* - * start_seq_get - * - * begin an iterator call to get all of the credentials in the cache - */ -krb5_error_code KRB5_CALLCONV krb5_stdcc_start_seq_get -(krb5_context context, krb5_ccache id , krb5_cc_cursor *cursor ) -{ - stdccCacheDataPtr ccapi_data = id->data; - krb5_error_code retval; - int err; - ccache_cit *iterator; - - if ((retval = stdcc_setup(context, ccapi_data))) - return retval; - -#ifdef CC_API_VER2 - err = cc_seq_fetch_creds_begin(gCntrlBlock, ccapi_data->NamedCache, - &iterator); - if (err != CC_NOERROR) - return cc_err_xlate(err); - *cursor = iterator; -#else - /* all we have to do is initialize the cursor */ - *cursor = NULL; -#endif - return 0; -} - -/* - * next cred - * - * - get the next credential in the cache as part of an iterator call - * - this maps to call to cc_seq_fetch_creds - */ -krb5_error_code KRB5_CALLCONV krb5_stdcc_next_cred -(krb5_context context, krb5_ccache id, krb5_cc_cursor *cursor, - krb5_creds *creds) -{ - krb5_error_code retval; - stdccCacheDataPtr ccapi_data = id->data; - int err; - cred_union *credU = NULL; - ccache_cit *iterator; - - if ((retval = stdcc_setup(context, ccapi_data))) - return retval; - -#ifdef CC_API_VER2 - iterator = *cursor; - if (iterator == 0) - return KRB5_CC_END; - err = cc_seq_fetch_creds_next(gCntrlBlock, &credU, iterator); - - if (err == CC_END) { - cc_seq_fetch_creds_end(gCntrlBlock, &iterator); - *cursor = 0; - } -#else - err = cc_seq_fetch_creds(gCntrlBlock, ccapi_data->NamedCache, - &credU, (ccache_cit **)cursor); -#endif - - if (err != CC_NOERROR) - return cc_err_xlate(err); - - /* copy data (with translation) */ - dupCCtoK5(context, credU->cred.pV5Cred, creds); - - /* free our version of the cred - okay to use cc_free_creds() here - because we got it from the CCache library */ - cc_free_creds(gCntrlBlock, &credU); - - return 0; -} - - -/* - * retrieve - * - * - try to find a matching credential in the cache - */ -krb5_error_code KRB5_CALLCONV -krb5_stdcc_retrieve(context, id, whichfields, mcreds, creds) - krb5_context context; - krb5_ccache id; - krb5_flags whichfields; - krb5_creds *mcreds; - krb5_creds *creds; -{ - return k5_cc_retrieve_cred_default(context, id, whichfields, mcreds, - creds); -} - -/* - * end seq - * - * just free up the storage associated with the cursor (if we could) - */ -krb5_error_code KRB5_CALLCONV krb5_stdcc_end_seq_get -(krb5_context context, krb5_ccache id, krb5_cc_cursor *cursor) -{ - krb5_error_code retval; - stdccCacheDataPtr ccapi_data = NULL; - int err; -#ifndef CC_API_VER2 - cred_union *credU = NULL; -#endif - - ccapi_data = id->data; - - if ((retval = stdcc_setup(context, ccapi_data))) - return retval; - - if (*cursor == NULL) - return 0; - -#ifdef CC_API_VER2 - err = cc_seq_fetch_creds_end(gCntrlBlock, (ccache_cit **)cursor); - if (err != CC_NOERROR) - return cc_err_xlate(err); -#else - /* - * Finish calling cc_seq_fetch_creds to clear out the cursor - */ - while (*cursor) { - err = cc_seq_fetch_creds(gCntrlBlock, ccapi_data->NamedCache, - &credU, (ccache_cit **)cursor); - if (err) - break; - - /* okay to call cc_free_creds() here because we got credU from CCache lib */ - cc_free_creds(gCntrlBlock, &credU); - } -#endif - - return(0); -} - -/* - * close - * - * - free our pointers to the NC - */ -krb5_error_code KRB5_CALLCONV -krb5_stdcc_close(krb5_context context, krb5_ccache id) -{ - krb5_error_code retval; - stdccCacheDataPtr ccapi_data = id->data; - - if ((retval = stdcc_setup(context, NULL))) - return retval; - - /* free it */ - - if (ccapi_data) { - if (ccapi_data->cache_name) - free(ccapi_data->cache_name); - if (ccapi_data->NamedCache) - cc_close(gCntrlBlock, &ccapi_data->NamedCache); - free(ccapi_data); - id->data = NULL; - } - free(id); - - return 0; -} - -/* - * destroy - * - * - free our storage and the cache - */ -krb5_error_code KRB5_CALLCONV -krb5_stdcc_destroy (krb5_context context, krb5_ccache id) -{ - int err; - krb5_error_code retval; - stdccCacheDataPtr ccapi_data = id->data; - - if ((retval = stdcc_setup(context, ccapi_data))) { - return retval; - } - - /* free memory associated with the krb5_ccache */ - if (ccapi_data) { - if (ccapi_data->cache_name) - free(ccapi_data->cache_name); - if (ccapi_data->NamedCache) { - /* destroy the named cache */ - err = cc_destroy(gCntrlBlock, &ccapi_data->NamedCache); - retval = cc_err_xlate(err); - cache_changed(); - } - free(ccapi_data); - id->data = NULL; - } - free(id); - - /* If the cache does not exist when we tried to destroy it, - that's fine. That means someone else destroyed it since - we resolved it. */ - if (retval == KRB5_FCC_NOFILE) - return 0; - return retval; -} - -/* - * getname - * - * - return the name of the named cache - */ -const char * KRB5_CALLCONV krb5_stdcc_get_name -(krb5_context context, krb5_ccache id ) -{ - stdccCacheDataPtr ccapi_data = id->data; - - if (!ccapi_data) - return 0; - - return (ccapi_data->cache_name); -} - - -/* get_principal - * - * - return the principal associated with the named cache - */ -krb5_error_code KRB5_CALLCONV krb5_stdcc_get_principal -(krb5_context context, krb5_ccache id , krb5_principal *princ) -{ - int err; - char *name = NULL; - stdccCacheDataPtr ccapi_data = id->data; - krb5_error_code retval; - - if ((retval = stdcc_setup(context, ccapi_data))) - return retval; - - /* another wrapper */ - err = cc_get_principal(gCntrlBlock, ccapi_data->NamedCache, - &name); - - if (err != CC_NOERROR) - return cc_err_xlate(err); - - /* turn it into a krb principal */ - err = krb5_parse_name(context, name, princ); - - cc_free_principal(gCntrlBlock, &name); - - return err; -} - -/* - * set_flags - * - * - currently a NOP since we don't store any flags in the NC - */ -krb5_error_code KRB5_CALLCONV krb5_stdcc_set_flags -(krb5_context context, krb5_ccache id , krb5_flags flags) -{ - stdccCacheDataPtr ccapi_data = id->data; - krb5_error_code retval; - - if ((retval = stdcc_setup(context, ccapi_data))) - return retval; - - return 0; -} - -/* - * get_flags - * - * - currently a NOP since we don't store any flags in the NC - */ -krb5_error_code KRB5_CALLCONV krb5_stdcc_get_flags -(krb5_context context, krb5_ccache id , krb5_flags *flags) -{ - stdccCacheDataPtr ccapi_data = id->data; - krb5_error_code retval; - - if ((retval = stdcc_setup(context, ccapi_data))) - return retval; - - return 0; -} - -/* - * remove - * - * - remove the specified credentials from the NC - */ -krb5_error_code KRB5_CALLCONV krb5_stdcc_remove -(krb5_context context, krb5_ccache id, - krb5_flags flags, krb5_creds *creds) -{ - cred_union *cu = NULL; - int err; - stdccCacheDataPtr ccapi_data = id->data; - krb5_error_code retval; - - if ((retval = stdcc_setup(context, ccapi_data))) { - if (retval == KRB5_FCC_NOFILE) - return 0; - return retval; - } - - /* convert to a cred union */ - dupK5toCC(context, creds, &cu); - - /* remove it */ - err = cc_remove_cred(gCntrlBlock, ccapi_data->NamedCache, *cu); - if (err != CC_NOERROR) - return cc_err_xlate(err); - - /* free the cred union using our local version of cc_free_creds() - since we allocated it locally */ - err = krb5int_free_cc_cred_union(&cu); - cache_changed(); - if (err != CC_NOERROR) - return cc_err_xlate(err); - - return 0; -} -#endif /* !USE_CCAPI_V3 */ - #endif /* defined(_WIN32) || defined(USE_CCAPI) */ diff --git a/src/lib/krb5/ccache/ccapi/stdcc.h b/src/lib/krb5/ccache/ccapi/stdcc.h index acb8a26496..ef50445b76 100644 --- a/src/lib/krb5/ccache/ccapi/stdcc.h +++ b/src/lib/krb5/ccache/ccapi/stdcc.h @@ -7,15 +7,7 @@ #include "k5-int.h" /* loads krb5.h */ #include "../cc-int.h" -#ifdef USE_CCAPI_V3 #include -#else -#if defined(_WIN32) -#include "cacheapi.h" -#else -#include -#endif -#endif #define kStringLiteralLen 255 @@ -27,11 +19,7 @@ extern krb5_cc_ops krb5_cc_stdcc_ops; */ typedef struct _stdccCacheData { char *cache_name; -#ifdef USE_CCAPI_V3 cc_ccache_t NamedCache; -#else - ccache_p *NamedCache; -#endif } stdccCacheData, *stdccCacheDataPtr; @@ -39,8 +27,6 @@ typedef struct _stdccCacheData { void krb5_stdcc_shutdown(void); -#ifdef USE_CCAPI_V3 - krb5_error_code KRB5_CALLCONV krb5_stdccv3_close (krb5_context, krb5_ccache id ); @@ -116,60 +102,6 @@ krb5_error_code KRB5_CALLCONV krb5_stdccv3_context_unlock krb5_error_code KRB5_CALLCONV krb5_stdccv3_switch_to (krb5_context context, krb5_ccache id); -#else - -krb5_error_code KRB5_CALLCONV krb5_stdcc_close -(krb5_context, krb5_ccache id ); - -krb5_error_code KRB5_CALLCONV krb5_stdcc_destroy -(krb5_context, krb5_ccache id ); - -krb5_error_code KRB5_CALLCONV krb5_stdcc_end_seq_get -(krb5_context, krb5_ccache id , krb5_cc_cursor *cursor ); - -krb5_error_code KRB5_CALLCONV krb5_stdcc_generate_new -(krb5_context, krb5_ccache *id ); - -const char * KRB5_CALLCONV krb5_stdcc_get_name -(krb5_context, krb5_ccache id ); - -krb5_error_code KRB5_CALLCONV krb5_stdcc_get_principal -(krb5_context, krb5_ccache id , krb5_principal *princ ); - -krb5_error_code KRB5_CALLCONV krb5_stdcc_initialize -(krb5_context, krb5_ccache id , krb5_principal princ ); - -krb5_error_code KRB5_CALLCONV krb5_stdcc_next_cred -(krb5_context, - krb5_ccache id , - krb5_cc_cursor *cursor , - krb5_creds *creds ); - -krb5_error_code KRB5_CALLCONV krb5_stdcc_resolve -(krb5_context, krb5_ccache *id , const char *residual ); - -krb5_error_code KRB5_CALLCONV krb5_stdcc_retrieve -(krb5_context, - krb5_ccache id , - krb5_flags whichfields , - krb5_creds *mcreds , - krb5_creds *creds ); - -krb5_error_code KRB5_CALLCONV krb5_stdcc_start_seq_get -(krb5_context, krb5_ccache id , krb5_cc_cursor *cursor ); - -krb5_error_code KRB5_CALLCONV krb5_stdcc_store -(krb5_context, krb5_ccache id , krb5_creds *creds ); - -krb5_error_code KRB5_CALLCONV krb5_stdcc_set_flags -(krb5_context, krb5_ccache id , krb5_flags flags ); - -krb5_error_code KRB5_CALLCONV krb5_stdcc_get_flags -(krb5_context, krb5_ccache id , krb5_flags *flags ); - -krb5_error_code KRB5_CALLCONV krb5_stdcc_remove -(krb5_context, krb5_ccache id , krb5_flags flags, krb5_creds *creds); -#endif #endif /* defined(_WIN32) || defined(USE_CCAPI) */ diff --git a/src/lib/krb5/ccache/ccapi/stdcc_util.c b/src/lib/krb5/ccache/ccapi/stdcc_util.c index b7d728e03c..91f2bd5a7c 100644 --- a/src/lib/krb5/ccache/ccapi/stdcc_util.c +++ b/src/lib/krb5/ccache/ccapi/stdcc_util.c @@ -24,9 +24,6 @@ #define fieldSize 255 -#ifdef USE_CCAPI_V3 - - static void free_cc_array (cc_data **io_cc_array) { @@ -528,538 +525,4 @@ cred_union_release (cc_credentials_union *in_cred_union) return 0; } -#else /* !USE_CCAPI_V3 */ -/* - * CopyCCDataArrayToK5 - * - copy and translate the null terminated arrays of data records - * used in k5 tickets - */ -int copyCCDataArrayToK5(cc_creds *ccCreds, krb5_creds *v5Creds, char whichArray) { - - if (whichArray == kAddressArray) { - if (ccCreds->addresses == NULL) { - v5Creds->addresses = NULL; - } else { - - krb5_address **addrPtr, *addr; - cc_data **dataPtr, *data; - unsigned int numRecords = 0; - - /* Allocate the array of pointers: */ - for (dataPtr = ccCreds->addresses; *dataPtr != NULL; numRecords++, dataPtr++) {} - - v5Creds->addresses = (krb5_address **) malloc (sizeof(krb5_address *) * (numRecords + 1)); - if (v5Creds->addresses == NULL) - return ENOMEM; - - /* Fill in the array, allocating the address structures: */ - for (dataPtr = ccCreds->addresses, addrPtr = v5Creds->addresses; *dataPtr != NULL; addrPtr++, dataPtr++) { - - *addrPtr = (krb5_address *) malloc (sizeof(krb5_address)); - if (*addrPtr == NULL) - return ENOMEM; - data = *dataPtr; - addr = *addrPtr; - - addr->addrtype = data->type; - addr->magic = KV5M_ADDRESS; - addr->length = data->length; - addr->contents = (krb5_octet *) malloc (sizeof(krb5_octet) * addr->length); - if (addr->contents == NULL) - return ENOMEM; - memmove(addr->contents, data->data, addr->length); /* copy contents */ - } - - /* Write terminator: */ - *addrPtr = NULL; - } - } - - if (whichArray == kAuthDataArray) { - if (ccCreds->authdata == NULL) { - v5Creds->authdata = NULL; - } else { - krb5_authdata **authPtr, *auth; - cc_data **dataPtr, *data; - unsigned int numRecords = 0; - - /* Allocate the array of pointers: */ - for (dataPtr = ccCreds->authdata; *dataPtr != NULL; numRecords++, dataPtr++) {} - - v5Creds->authdata = (krb5_authdata **) malloc (sizeof(krb5_authdata *) * (numRecords + 1)); - if (v5Creds->authdata == NULL) - return ENOMEM; - - /* Fill in the array, allocating the address structures: */ - for (dataPtr = ccCreds->authdata, authPtr = v5Creds->authdata; *dataPtr != NULL; authPtr++, dataPtr++) { - - *authPtr = (krb5_authdata *) malloc (sizeof(krb5_authdata)); - if (*authPtr == NULL) - return ENOMEM; - data = *dataPtr; - auth = *authPtr; - - auth->ad_type = data->type; - auth->magic = KV5M_AUTHDATA; - auth->length = data->length; - auth->contents = (krb5_octet *) malloc (sizeof(krb5_octet) * auth->length); - if (auth->contents == NULL) - return ENOMEM; - memmove(auth->contents, data->data, auth->length); /* copy contents */ - } - - /* Write terminator: */ - *authPtr = NULL; - } - } - - return 0; -} - -/* - * copyK5DataArrayToCC - * - analogous to above, but in the other direction - */ -int copyK5DataArrayToCC(krb5_creds *v5Creds, cc_creds *ccCreds, char whichArray) -{ - if (whichArray == kAddressArray) { - if (v5Creds->addresses == NULL) { - ccCreds->addresses = NULL; - } else { - - krb5_address **addrPtr, *addr; - cc_data **dataPtr, *data; - unsigned int numRecords = 0; - - /* Allocate the array of pointers: */ - for (addrPtr = v5Creds->addresses; *addrPtr != NULL; numRecords++, addrPtr++) {} - - ccCreds->addresses = (cc_data **) malloc (sizeof(cc_data *) * (numRecords + 1)); - if (ccCreds->addresses == NULL) - return ENOMEM; - - /* Fill in the array, allocating the address structures: */ - for (dataPtr = ccCreds->addresses, addrPtr = v5Creds->addresses; *addrPtr != NULL; addrPtr++, dataPtr++) { - - *dataPtr = (cc_data *) malloc (sizeof(cc_data)); - if (*dataPtr == NULL) - return ENOMEM; - data = *dataPtr; - addr = *addrPtr; - - data->type = addr->addrtype; - data->length = addr->length; - data->data = malloc (sizeof(char) * data->length); - if (data->data == NULL) - return ENOMEM; - memmove(data->data, addr->contents, data->length); /* copy contents */ - } - - /* Write terminator: */ - *dataPtr = NULL; - } - } - - if (whichArray == kAuthDataArray) { - if (v5Creds->authdata == NULL) { - ccCreds->authdata = NULL; - } else { - krb5_authdata **authPtr, *auth; - cc_data **dataPtr, *data; - unsigned int numRecords = 0; - - /* Allocate the array of pointers: */ - for (authPtr = v5Creds->authdata; *authPtr != NULL; numRecords++, authPtr++) {} - - ccCreds->authdata = (cc_data **) malloc (sizeof(cc_data *) * (numRecords + 1)); - if (ccCreds->authdata == NULL) - return ENOMEM; - - /* Fill in the array, allocating the address structures: */ - for (dataPtr = ccCreds->authdata, authPtr = v5Creds->authdata; *authPtr != NULL; authPtr++, dataPtr++) { - - *dataPtr = (cc_data *) malloc (sizeof(cc_data)); - if (*dataPtr == NULL) - return ENOMEM; - data = *dataPtr; - auth = *authPtr; - - data->type = auth->ad_type; - data->length = auth->length; - data->data = malloc (sizeof(char) * data->length); - if (data->data == NULL) - return ENOMEM; - memmove(data->data, auth->contents, data->length); /* copy contents */ - } - - /* Write terminator: */ - *dataPtr = NULL; - } - } - - return 0; -} - -/* - * dupcctok5 - * - allocate an empty k5 style ticket and copy info from the cc_creds ticket - */ - -void dupCCtoK5(krb5_context context, cc_creds *src, krb5_creds *dest) -{ - krb5_int32 offset_seconds = 0, offset_microseconds = 0; - int err; - - /* - * allocate and copy - * copy all of those damn fields back - */ - err = krb5_parse_name(context, src->client, &(dest->client)); - err = krb5_parse_name(context, src->server, &(dest->server)); - if (err) return; /* parsename fails w/o krb5.ini for example */ - - /* copy keyblock */ - dest->keyblock.enctype = src->keyblock.type; - dest->keyblock.length = src->keyblock.length; - dest->keyblock.contents = (krb5_octet *)malloc(dest->keyblock.length); - memcpy(dest->keyblock.contents, src->keyblock.data, dest->keyblock.length); - - /* copy times */ -#if TARGET_OS_MAC - err = krb5_get_time_offsets(context, &offset_seconds, &offset_microseconds); - if (err) return; -#endif - dest->times.authtime = ts_incr(src->authtime, offset_seconds); - dest->times.starttime = ts_incr(src->starttime, offset_seconds); - dest->times.endtime = ts_incr(src->endtime, offset_seconds); - dest->times.renew_till = ts_incr(src->renew_till, offset_seconds); - dest->is_skey = src->is_skey; - dest->ticket_flags = src->ticket_flags; - - /* more branching fields */ - err = copyCCDataArrayToK5(src, dest, kAddressArray); - if (err) return; - - dest->ticket.length = src->ticket.length; - dest->ticket.data = (char *)malloc(src->ticket.length); - memcpy(dest->ticket.data, src->ticket.data, src->ticket.length); - dest->second_ticket.length = src->second_ticket.length; - (dest->second_ticket).data = ( char *)malloc(src->second_ticket.length); - memcpy(dest->second_ticket.data, src->second_ticket.data, src->second_ticket.length); - - /* zero out magic number */ - dest->magic = 0; - - /* authdata */ - err = copyCCDataArrayToK5(src, dest, kAuthDataArray); - if (err) return; - - return; -} - -/* - * dupK5toCC - * - analogous to above but in the reverse direction - */ -void dupK5toCC(krb5_context context, krb5_creds *creds, cred_union **cu) -{ - cc_creds *c; - int err; - krb5_int32 offset_seconds = 0, offset_microseconds = 0; - - if (cu == NULL) return; - - /* allocate the cred_union */ - *cu = (cred_union *)malloc(sizeof(cred_union)); - if ((*cu) == NULL) - return; - - (*cu)->cred_type = CC_CRED_V5; - - /* allocate creds structure (and install) */ - c = (cc_creds *)malloc(sizeof(cc_creds)); - if (c == NULL) return; - (*cu)->cred.pV5Cred = c; - - /* convert krb5 principals to flat principals */ - err = krb5_unparse_name(context, creds->client, &(c->client)); - err = krb5_unparse_name(context, creds->server, &(c->server)); - if (err) return; - - /* copy more fields */ - c->keyblock.type = creds->keyblock.enctype; - c->keyblock.length = creds->keyblock.length; - - if (creds->keyblock.contents != NULL) { - c->keyblock.data = (unsigned char *)malloc(creds->keyblock.length); - memcpy(c->keyblock.data, creds->keyblock.contents, creds->keyblock.length); - } else { - c->keyblock.data = NULL; - } - -#if TARGET_OS_MAC - err = krb5_get_time_offsets(context, &offset_seconds, &offset_microseconds); - if (err) return; -#endif - c->authtime = ts_incr(creds->times.authtime, -offset_seconds); - c->starttime = ts_incr(creds->times.starttime, -offset_seconds); - c->endtime = ts_incr(creds->times.endtime, -offset_seconds); - c->renew_till = ts_incr(creds->times.renew_till, -offset_seconds); - c->is_skey = creds->is_skey; - c->ticket_flags = creds->ticket_flags; - - err = copyK5DataArrayToCC(creds, c, kAddressArray); - if (err) return; - - c->ticket.length = creds->ticket.length; - if (creds->ticket.data != NULL) { - c->ticket.data = (unsigned char *)malloc(creds->ticket.length); - memcpy(c->ticket.data, creds->ticket.data, creds->ticket.length); - } else { - c->ticket.data = NULL; - } - - c->second_ticket.length = creds->second_ticket.length; - if (creds->second_ticket.data != NULL) { - c->second_ticket.data = (unsigned char *)malloc(creds->second_ticket.length); - memcpy(c->second_ticket.data, creds->second_ticket.data, creds->second_ticket.length); - } else { - c->second_ticket.data = NULL; - } - - err = copyK5DataArrayToCC(creds, c, kAuthDataArray); - if (err) return; - - return; -} - -/* ----- free_cc_cred_union, etc -------------- */ -/* - Since the Kerberos5 library allocates a credentials cache structure - (in dupK5toCC() above) with its own memory allocation routines - which - may be different than how the CCache allocates memory - the Kerb5 library - must have its own version of cc_free_creds() to deallocate it. These - functions do that. The top-level function to substitute for cc_free_creds() - is krb5_free_cc_cred_union(). - - If the CCache library wants to use a cred_union structure created by - the Kerb5 library, it should make a deep copy of it to "translate" to its - own memory allocation space. -*/ -static void deep_free_cc_data (cc_data data) -{ - if (data.data != NULL) - free (data.data); -} - -static void deep_free_cc_data_array (cc_data** data) { - - unsigned int i; - - if (data == NULL) - return; - - for (i = 0; data [i] != NULL; i++) { - deep_free_cc_data (*(data [i])); - free (data [i]); - } - - free (data); -} - -static void deep_free_cc_v5_creds (cc_creds* creds) -{ - if (creds == NULL) - return; - - if (creds -> client != NULL) - free (creds -> client); - if (creds -> server != NULL) - free (creds -> server); - - deep_free_cc_data (creds -> keyblock); - deep_free_cc_data (creds -> ticket); - deep_free_cc_data (creds -> second_ticket); - - deep_free_cc_data_array (creds -> addresses); - deep_free_cc_data_array (creds -> authdata); - - free(creds); -} - -static void deep_free_cc_creds (cred_union creds) -{ - if (creds.cred_type == CC_CRED_V5) { - deep_free_cc_v5_creds (creds.cred.pV5Cred); - } -} - -/* top-level exported function */ -cc_int32 krb5int_free_cc_cred_union (cred_union** creds) -{ - if (creds == NULL) - return CC_BAD_PARM; - - if (*creds != NULL) { - deep_free_cc_creds (**creds); - free (*creds); - *creds = NULL; - } - - return CC_NOERROR; -} -#endif - -/* - * Utility functions... - */ -static krb5_boolean -times_match(t1, t2) - const krb5_ticket_times *t1; - const krb5_ticket_times *t2; -{ - if (t1->renew_till) { - if (ts_after(t1->renew_till, t2->renew_till)) - return FALSE; /* this one expires too late */ - } - if (t1->endtime) { - if (ts_after(t1->endtime, t2->endtime)) - return FALSE; /* this one expires too late */ - } - /* only care about expiration on a times_match */ - return TRUE; -} - -static krb5_boolean -times_match_exact (t1, t2) - const krb5_ticket_times *t1, *t2; -{ - return (t1->authtime == t2->authtime - && t1->starttime == t2->starttime - && t1->endtime == t2->endtime - && t1->renew_till == t2->renew_till); -} - -static krb5_boolean -standard_fields_match(context, mcreds, creds) - krb5_context context; - const krb5_creds *mcreds, *creds; -{ - if (mcreds->client != NULL && - !krb5_principal_compare(context, mcreds->client, creds->client)) - return FALSE; - if (mcreds->server != NULL && - !krb5_principal_compare(context, mcreds->server,creds->server)) - return FALSE; - return TRUE; -} - -/* only match the server name portion, not the server realm portion */ - -static krb5_boolean -srvname_match(context, mcreds, creds) - krb5_context context; - const krb5_creds *mcreds, *creds; -{ - if (mcreds->client != NULL && - !krb5_principal_compare(context, mcreds->client, creds->client)) - return FALSE; - if (mcreds->server != NULL && - !krb5_principal_compare_any_realm(context, mcreds->server, - creds->server)) - return FALSE; - return TRUE; -} - - -static krb5_boolean -authdata_match(mdata, data) - krb5_authdata *const *mdata, *const *data; -{ - const krb5_authdata *mdatap, *datap; - - if (mdata == data) - return TRUE; - - if (mdata == NULL) - return *data == NULL; - - if (data == NULL) - return *mdata == NULL; - - while ((mdatap = *mdata) - && (datap = *data) - && mdatap->ad_type == datap->ad_type - && mdatap->length == datap->length - && !memcmp ((char *) mdatap->contents, (char *) datap->contents, - datap->length)) { - mdata++; - data++; - } - - return !*mdata && !*data; -} - -static krb5_boolean -data_match(data1, data2) - const krb5_data *data1, *data2; -{ - if (!data1) { - if (!data2) - return TRUE; - else - return FALSE; - } - if (!data2) return FALSE; - - if (data1->length != data2->length) - return FALSE; - else - return memcmp(data1->data, data2->data, data1->length) ? FALSE : TRUE; -} - -#define MATCH_SET(bits) (whichfields & bits) -#define flags_match(a,b) (((a) & (b)) == (a)) - -/* stdccCredsMatch - * - check to see if the creds match based on the whichFields variable - * NOTE: if whichfields is zero we are now comparing 'standard fields.' - * This is the bug that was killing fetch for a - * week. The behaviour is what krb5 expects, however. - */ -int stdccCredsMatch(krb5_context context, krb5_creds *base, - krb5_creds *match, int whichfields) -{ - if (((MATCH_SET(KRB5_TC_MATCH_SRV_NAMEONLY) && - srvname_match(context, match, base)) || - standard_fields_match(context, match, base)) - && - (! MATCH_SET(KRB5_TC_MATCH_IS_SKEY) || - match->is_skey == base->is_skey) - && - (! MATCH_SET(KRB5_TC_MATCH_FLAGS_EXACT) || - match->ticket_flags == base->ticket_flags) - && - (! MATCH_SET(KRB5_TC_MATCH_FLAGS) || - flags_match(match->ticket_flags, base->ticket_flags)) - && - (! MATCH_SET(KRB5_TC_MATCH_TIMES_EXACT) || - times_match_exact(&match->times, &base->times)) - && - (! MATCH_SET(KRB5_TC_MATCH_TIMES) || - times_match(&match->times, &base->times)) - && - (! MATCH_SET(KRB5_TC_MATCH_AUTHDATA) || - authdata_match (match->authdata, base->authdata)) - && - (! MATCH_SET(KRB5_TC_MATCH_2ND_TKT) || - data_match (&match->second_ticket, &base->second_ticket)) - && - ((! MATCH_SET(KRB5_TC_MATCH_KTYPE))|| - (match->keyblock.enctype == base->keyblock.enctype)) - ) - return TRUE; - return FALSE; -} - #endif /* defined(_WIN32) || defined(USE_CCAPI) */ diff --git a/src/lib/krb5/ccache/ccapi/stdcc_util.h b/src/lib/krb5/ccache/ccapi/stdcc_util.h index 6836d548f5..34e438dfd8 100644 --- a/src/lib/krb5/ccache/ccapi/stdcc_util.h +++ b/src/lib/krb5/ccache/ccapi/stdcc_util.h @@ -8,20 +8,11 @@ #include "autoconf.h" -#if USE_CCAPI_V3 #include -#else -#if defined(_WIN32) -#include "cacheapi.h" -#else -#include -#endif -#endif #include "krb5.h" /* prototypes for private functions declared in stdcc_util.c */ -#ifdef USE_CCAPI_V3 krb5_error_code copy_cc_cred_union_to_krb5_creds (krb5_context in_context, const cc_credentials_union *in_cred_union, @@ -33,15 +24,6 @@ copy_krb5_creds_to_cc_cred_union (krb5_context in_context, krb5_error_code cred_union_release (cc_credentials_union *in_cred_union); -#else -int copyCCDataArrayToK5(cc_creds *cc, krb5_creds *kc, char whichArray); -int copyK5DataArrayToCC(krb5_creds *kc, cc_creds *cc, char whichArray); -void dupCCtoK5(krb5_context context, cc_creds *src, krb5_creds *dest); -void dupK5toCC(krb5_context context, krb5_creds *creds, cred_union **cu); -cc_int32 krb5int_free_cc_cred_union (cred_union** creds); -#endif -int stdccCredsMatch(krb5_context context, krb5_creds *base, krb5_creds *match, int whichfields); -int bitTst(int var, int mask); #define kAddressArray 4 #define kAuthDataArray 5 diff --git a/src/lib/krb5/ccache/ccapi/winccld.h b/src/lib/krb5/ccache/ccapi/winccld.h index df34e3346b..d617d4d207 100644 --- a/src/lib/krb5/ccache/ccapi/winccld.h +++ b/src/lib/krb5/ccache/ccapi/winccld.h @@ -7,62 +7,13 @@ #ifndef KRB5_WINCCLD_H_ #define KRB5_WINCCLD_H_ -#ifdef USE_CCAPI_V3 #include -#else - -#ifndef CC_API_VER2 -#define CC_API_VER2 -#endif - -#include "cacheapi.h" -#endif -#ifdef USE_CCAPI_V3 typedef CCACHE_API cc_int32 (*FP_cc_initialize) ( cc_context_t* outContext, cc_int32 inVersion, cc_int32* outSupportedVersion, char const** outVendor); -#else -typedef cc_int32 (*FP_cc_initialize)(apiCB**, const cc_int32, - cc_int32*, const char**); -typedef cc_int32 (*FP_cc_shutdown)(apiCB**); -typedef cc_int32 (*FP_cc_get_change_time)(apiCB*, cc_time_t*); -typedef cc_int32 (*FP_cc_create)(apiCB*, const char*, const char*, - const enum cc_cred_vers, const cc_int32, ccache_p**); -typedef cc_int32 (*FP_cc_open)(apiCB*, const char*, const enum cc_cred_vers, - const cc_int32, ccache_p**); -typedef cc_int32 (*FP_cc_close)(apiCB*, ccache_p**); -typedef cc_int32 (*FP_cc_destroy)(apiCB*, ccache_p**); -typedef cc_int32 (*FP_cc_seq_fetch_NCs)(apiCB*, ccache_p**, ccache_cit**); -typedef cc_int32 (*FP_cc_seq_fetch_NCs_begin)(apiCB*, ccache_cit**); -typedef cc_int32 (*FP_cc_seq_fetch_NCs_next)(apiCB*, ccache_p**, ccache_cit*); -typedef cc_int32 (*FP_cc_seq_fetch_NCs_end)(apiCB*, ccache_cit**); -typedef cc_int32 (*FP_cc_get_NC_info)(apiCB*, struct _infoNC***); -typedef cc_int32 (*FP_cc_free_NC_info)(apiCB*, struct _infoNC***); -typedef cc_int32 (*FP_cc_get_name)(apiCB*, const ccache_p*, char**); -typedef cc_int32 (*FP_cc_set_principal)(apiCB*, const ccache_p*, - const enum cc_cred_vers, const char*); -typedef cc_int32 (*FP_cc_get_principal)(apiCB*, ccache_p*, char**); -typedef cc_int32 (*FP_cc_get_cred_version)(apiCB*, const ccache_p*, - enum cc_cred_vers*); -typedef cc_int32 (*FP_cc_lock_request)(apiCB*, const ccache_p*, - const cc_int32); -typedef cc_int32 (*FP_cc_store)(apiCB*, const ccache_p*, const cred_union); -typedef cc_int32 (*FP_cc_remove_cred)(apiCB*, const ccache_p*, - const cred_union); -typedef cc_int32 (*FP_cc_seq_fetch_creds)(apiCB*, const ccache_p*, - cred_union**, ccache_cit**); -typedef cc_int32 (*FP_cc_seq_fetch_creds_begin)(apiCB*, const ccache_p*, - ccache_cit**); -typedef cc_int32 (*FP_cc_seq_fetch_creds_next)(apiCB*, cred_union**, - ccache_cit*); -typedef cc_int32 (*FP_cc_seq_fetch_creds_end)(apiCB*, ccache_cit**); -typedef cc_int32 (*FP_cc_free_principal)(apiCB*, char**); -typedef cc_int32 (*FP_cc_free_name)(apiCB*, char** name); -typedef cc_int32 (*FP_cc_free_creds)(apiCB*, cred_union** pCred); -#endif #ifdef KRB5_WINCCLD_C_ typedef struct _FUNC_INFO { @@ -78,58 +29,10 @@ typedef struct _FUNC_INFO { #endif DECL_FUNC_PTR(cc_initialize); -#ifndef USE_CCAPI_V3 -DECL_FUNC_PTR(cc_shutdown); -DECL_FUNC_PTR(cc_get_change_time); -DECL_FUNC_PTR(cc_create); -DECL_FUNC_PTR(cc_open); -DECL_FUNC_PTR(cc_close); -DECL_FUNC_PTR(cc_destroy); -DECL_FUNC_PTR(cc_get_name); -DECL_FUNC_PTR(cc_set_principal); -DECL_FUNC_PTR(cc_get_principal); -DECL_FUNC_PTR(cc_get_cred_version); -DECL_FUNC_PTR(cc_store); -DECL_FUNC_PTR(cc_remove_cred); -#ifdef CC_API_VER2 -DECL_FUNC_PTR(cc_seq_fetch_creds_begin); -DECL_FUNC_PTR(cc_seq_fetch_creds_next); -DECL_FUNC_PTR(cc_seq_fetch_creds_end); -#else -DECL_FUNC_PTR(cc_seq_fetch_creds); -#endif -DECL_FUNC_PTR(cc_free_principal); -DECL_FUNC_PTR(cc_free_name); -DECL_FUNC_PTR(cc_free_creds); -#endif #ifdef KRB5_WINCCLD_C_ FUNC_INFO krbcc_fi[] = { MAKE_FUNC_INFO(cc_initialize), -#ifndef USE_CCAPI_V3 - MAKE_FUNC_INFO(cc_shutdown), - MAKE_FUNC_INFO(cc_get_change_time), - MAKE_FUNC_INFO(cc_create), - MAKE_FUNC_INFO(cc_open), - MAKE_FUNC_INFO(cc_close), - MAKE_FUNC_INFO(cc_destroy), - MAKE_FUNC_INFO(cc_get_name), - MAKE_FUNC_INFO(cc_set_principal), - MAKE_FUNC_INFO(cc_get_principal), - MAKE_FUNC_INFO(cc_get_cred_version), - MAKE_FUNC_INFO(cc_store), - MAKE_FUNC_INFO(cc_remove_cred), -#ifdef CC_API_VER2 - MAKE_FUNC_INFO(cc_seq_fetch_creds_begin), - MAKE_FUNC_INFO(cc_seq_fetch_creds_next), - MAKE_FUNC_INFO(cc_seq_fetch_creds_end), -#else - MAKE_FUNC_INFO(cc_seq_fetch_creds), -#endif - MAKE_FUNC_INFO(cc_free_principal), - MAKE_FUNC_INFO(cc_free_name), - MAKE_FUNC_INFO(cc_free_creds), -#endif END_FUNC_INFO }; #undef MAKE_FUNC_INFO @@ -137,30 +40,6 @@ FUNC_INFO krbcc_fi[] = { #else #define cc_initialize pcc_initialize -#ifndef USE_CCAPI_V3 -#define cc_shutdown pcc_shutdown -#define cc_get_change_time pcc_get_change_time -#define cc_create pcc_create -#define cc_open pcc_open -#define cc_close pcc_close -#define cc_destroy pcc_destroy -#define cc_get_name pcc_get_name -#define cc_set_principal pcc_set_principal -#define cc_get_principal pcc_get_principal -#define cc_get_cred_version pcc_get_cred_version -#define cc_store pcc_store -#define cc_remove_cred pcc_remove_cred -#ifdef CC_API_VER2 -#define cc_seq_fetch_creds_begin pcc_seq_fetch_creds_begin -#define cc_seq_fetch_creds_next pcc_seq_fetch_creds_next -#define cc_seq_fetch_creds_end pcc_seq_fetch_creds_end -#else -#define cc_seq_fetch_creds pcc_seq_fetch_creds -#endif -#define cc_free_principal pcc_free_principal -#define cc_free_name pcc_free_name -#define cc_free_creds pcc_free_creds -#endif #endif #undef DECL_FUNC_PTR diff --git a/src/lib/krb5/ccache/ccbase.c b/src/lib/krb5/ccache/ccbase.c index 8d5bcef74d..43da47e5bd 100644 --- a/src/lib/krb5/ccache/ccbase.c +++ b/src/lib/krb5/ccache/ccbase.c @@ -51,7 +51,7 @@ static struct krb5_cc_typelist cc_lcc_entry = { &krb5_lcc_ops, NEXT }; #define NEXT &cc_lcc_entry #endif -#ifdef USE_CCAPI_V3 +#ifdef USE_CCAPI extern const krb5_cc_ops krb5_cc_stdcc_ops; static struct krb5_cc_typelist cc_stdcc_entry = { &krb5_cc_stdcc_ops, NEXT }; #undef NEXT @@ -562,7 +562,7 @@ k5_cccol_lock(krb5_context context) #ifdef USE_KEYRING_CCACHE k5_cc_mutex_lock(context, &krb5int_krcc_mutex); #endif -#ifdef USE_CCAPI_V3 +#ifdef USE_CCAPI ret = krb5_stdccv3_context_lock(context); if (ret) { k5_cc_mutex_unlock(context, &krb5int_mcc_mutex); @@ -587,7 +587,7 @@ k5_cccol_unlock(krb5_context context) k5_mutex_lock(&cc_typelist_lock); /* unlock each type in the opposite order */ -#ifdef USE_CCAPI_V3 +#ifdef USE_CCAPI krb5_stdccv3_context_unlock(context); #endif #ifdef USE_KEYRING_CCACHE @@ -621,7 +621,7 @@ k5_cccol_force_unlock() #ifdef USE_KEYRING_CCACHE k5_cc_mutex_force_unlock(&krb5int_krcc_mutex); #endif -#ifdef USE_CCAPI_V3 +#ifdef USE_CCAPI krb5_stdccv3_context_unlock(NULL); #endif k5_cc_mutex_force_unlock(&krb5int_mcc_mutex);