Free context when done, implement krb5_cc_ops->default_name.

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22099 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2007-12-03 17:14:34 +00:00
parent aee37005ae
commit bdb625ddf0

View File

@@ -557,6 +557,10 @@ acc_destroy(krb5_context context,
error = (*a->ccache->func->destroy)(a->ccache);
a->ccache = NULL;
}
if (a->context) {
error = (a->context->func->release)(a->context);
a->context = NULL;
}
return translate_cc_error(context, error);
}
@@ -892,6 +896,40 @@ acc_move(krb5_context context, krb5_ccache from, krb5_ccache to)
return translate_cc_error(context, error);
}
static krb5_error_code
acc_default_name(krb5_context context, char **str)
{
krb5_error_code ret;
cc_context_t cc;
cc_string_t name;
int32_t error;
ret = init_ccapi(context);
if (ret)
return ret;
error = (*init_func)(&cc, ccapi_version_3, NULL, NULL);
if (error)
return translate_cc_error(context, error);
error = (*cc->func->get_default_ccache_name)(cc, &name);
if (error) {
(*cc->func->release)(cc);
return translate_cc_error(context, error);
}
asprintf(str, "API:%s", name->data);
(*name->func->release)(name);
(*cc->func->release)(cc);
if (*str == NULL) {
krb5_set_error_string(context, "out of memory");
return ENOMEM;
}
return 0;
}
/**
* Variable containing the API based credential cache implemention.
*
@@ -918,5 +956,6 @@ const krb5_cc_ops krb5_acc_ops = {
acc_get_cache_first,
acc_get_cache_next,
acc_end_cache_get,
acc_move
acc_move,
acc_default_name
};