krb5: krb5_cc_ops backward compatibility and extensibility
The krb5_cc_ops structure is an extensible structure to which new
functionality has been added over the years.
Version zero was the original. It included all functions up to
and including get_default_name().
Version one added set_default().
Version two added lastchange().
Version three added set_kdc_offset() and get_kdc_offset().
Version four broke compatibility by modifying the signatures
of get_name() and resolve(). This was in change
7bf4d76e75
("krb5: Improve cccol sub
naming; add gss_store_cred_into2()").
Version five restores the original signatures of get_name()
and resolve() and introduces get_name_2() and resolve_2() that
provide the additional cccol functionality.
This change
* introduces version five
* documents which functions are part of each version
* replaces KRB5_CC_OPS_VERSION with KRB5_CC_OPS_VERSION_0,
KRB5_CC_OPS_VERSION_1, KRB5_CC_OPS_VERSION_2, KRB5_CC_OPS_VERSION_3,
and KRB5_CC_OPS_VERSION_5. KRB5_CC_OPS_VERSION_4 is skipped
because of the aforementioned breakage.
* compatibility logic is added to permit ccache plugins to implement
any of version one, two, three, five or a future version.
* all in-tree krb5_cc_ops implementations are updated to version 5.
Change-Id: Iadfce01d10834bc6151939e4d9d196f03001626e
This commit is contained in:

committed by
Nico Williams

parent
33bb2479b9
commit
d84512b8d2
@@ -566,11 +566,11 @@ bind_principal(krb5_context context,
|
||||
*/
|
||||
|
||||
static krb5_error_code KRB5_CALLCONV
|
||||
scc_get_name(krb5_context context,
|
||||
krb5_ccache id,
|
||||
const char **name,
|
||||
const char **file,
|
||||
const char **sub)
|
||||
scc_get_name_2(krb5_context context,
|
||||
krb5_ccache id,
|
||||
const char **name,
|
||||
const char **file,
|
||||
const char **sub)
|
||||
{
|
||||
if (name)
|
||||
*name = SCACHE(id)->name;
|
||||
@@ -582,10 +582,10 @@ scc_get_name(krb5_context context,
|
||||
}
|
||||
|
||||
static krb5_error_code KRB5_CALLCONV
|
||||
scc_resolve(krb5_context context,
|
||||
krb5_ccache *id,
|
||||
const char *res,
|
||||
const char *sub)
|
||||
scc_resolve_2(krb5_context context,
|
||||
krb5_ccache *id,
|
||||
const char *res,
|
||||
const char *sub)
|
||||
{
|
||||
krb5_error_code ret;
|
||||
krb5_scache *s;
|
||||
@@ -1351,7 +1351,7 @@ again:
|
||||
|
||||
ret = _krb5_cc_allocate(context, &krb5_scc_ops, id);
|
||||
if (ret == 0)
|
||||
ret = scc_resolve(context, id, ctx->file, name);
|
||||
ret = scc_resolve_2(context, id, ctx->file, name);
|
||||
if (ret) {
|
||||
free(*id);
|
||||
*id = NULL;
|
||||
@@ -1485,10 +1485,10 @@ scc_set_default(krb5_context context, krb5_ccache id)
|
||||
*/
|
||||
|
||||
KRB5_LIB_VARIABLE const krb5_cc_ops krb5_scc_ops = {
|
||||
KRB5_CC_OPS_VERSION,
|
||||
KRB5_CC_OPS_VERSION_5,
|
||||
"SCC",
|
||||
scc_get_name,
|
||||
scc_resolve,
|
||||
NULL,
|
||||
NULL,
|
||||
scc_gen_new,
|
||||
scc_initialize,
|
||||
scc_destroy,
|
||||
@@ -1510,7 +1510,9 @@ KRB5_LIB_VARIABLE const krb5_cc_ops krb5_scc_ops = {
|
||||
scc_set_default,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
NULL,
|
||||
scc_get_name_2,
|
||||
scc_resolve_2
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user