From 51d539646c4ebd71934ae7a924dfa07a668c8384 Mon Sep 17 00:00:00 2001 From: Greg Hudson Date: Thu, 8 Apr 2010 16:39:31 +0000 Subject: [PATCH] Add krb5_cc_dup() to make it possible to copy ccache handles git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23874 dc483132-0cff-0310-8789-dd5450dbe970 --- src/include/krb5/krb5.hin | 7 +++++++ src/lib/krb5/ccache/ccbase.c | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/src/include/krb5/krb5.hin b/src/include/krb5/krb5.hin index d9f3ba864..740390c9a 100644 --- a/src/include/krb5/krb5.hin +++ b/src/include/krb5/krb5.hin @@ -1850,6 +1850,13 @@ krb5_principal2salt(krb5_context, krb5_const_principal, krb5_data *); krb5_error_code KRB5_CALLCONV krb5_cc_resolve(krb5_context, const char *, krb5_ccache *); +/** + * Create a new handle referring to the same cache as @a in. + * The new handle and @a in can be closed independently. + */ +krb5_error_code KRB5_CALLCONV +krb5_cc_dup(krb5_context context, krb5_ccache in, krb5_ccache *out); + const char *KRB5_CALLCONV krb5_cc_default_name(krb5_context); diff --git a/src/lib/krb5/ccache/ccbase.c b/src/lib/krb5/ccache/ccbase.c index 2e40b48f3..023c7b158 100644 --- a/src/lib/krb5/ccache/ccbase.c +++ b/src/lib/krb5/ccache/ccbase.c @@ -238,6 +238,12 @@ krb5_cc_resolve (krb5_context context, const char *name, krb5_ccache *cache) return ops->resolve(context, cache, resid); } +krb5_error_code KRB5_CALLCONV +krb5_cc_dup(krb5_context context, krb5_ccache in, krb5_ccache *out) +{ + return in->ops->resolve(context, out, in->ops->get_name(context, in)); +} + /* * cc_getops * -- 2.26.2