From 21abe2d75eef12ea15fd51b6773043c45658ed10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Mon, 7 Apr 2008 11:48:15 +0000 Subject: [PATCH] Implement set_default. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22838 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/krb5/acache.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/krb5/acache.c b/lib/krb5/acache.c index 1da0fa41d..38c10fb1d 100644 --- a/lib/krb5/acache.c +++ b/lib/krb5/acache.c @@ -943,7 +943,7 @@ acc_move(krb5_context context, krb5_ccache from, krb5_ccache to) } static krb5_error_code -acc_default_name(krb5_context context, char **str) +acc_get_default_name(krb5_context context, char **str) { krb5_error_code ret; cc_context_t cc; @@ -975,6 +975,23 @@ acc_default_name(krb5_context context, char **str) return 0; } +static krb5_error_code +acc_set_default(krb5_context context, krb5_ccache id) +{ + krb5_acc *a = ACACHE(id); + cc_int32 error; + + if (a->ccache == NULL) { + krb5_set_error_string(context, "No API credential found"); + return KRB5_CC_NOTFOUND; + } + + error = (*a->ccache->func->set_default)(a->ccache); + if (error) + return translate_cc_error(context, error); + + return 0; +} /** * Variable containing the API based credential cache implemention. @@ -1003,5 +1020,6 @@ const krb5_cc_ops krb5_acc_ops = { acc_get_cache_next, acc_end_cache_get, acc_move, - acc_default_name + acc_get_default_name, + acc_set_default };