aboutsummaryrefslogtreecommitdiff
path: root/src/lib/krb5/krb/vfy_increds.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/krb5/krb/vfy_increds.c')
-rw-r--r--src/lib/krb5/krb/vfy_increds.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/lib/krb5/krb/vfy_increds.c b/src/lib/krb5/krb/vfy_increds.c
index 62b535d..10a68f2 100644
--- a/src/lib/krb5/krb/vfy_increds.c
+++ b/src/lib/krb5/krb/vfy_increds.c
@@ -60,6 +60,7 @@ krb5_verify_init_creds(krb5_context context,
krb5_error_code ret;
krb5_principal server;
krb5_keytab keytab;
+ krb5_ccache template_ccache;
krb5_ccache ccache;
krb5_keytab_entry kte;
krb5_creds in_creds, *out_creds;
@@ -70,6 +71,7 @@ krb5_verify_init_creds(krb5_context context,
server = NULL;
keytab = NULL;
+ template_ccache = NULL;
ccache = NULL;
out_creds = NULL;
authcon = NULL;
@@ -137,10 +139,14 @@ krb5_verify_init_creds(krb5_context context,
internals with a coherent idea of "in" and "out". */
/* insert the initial cred into the ccache */
-
- if ((ret = krb5_cc_resolve(context, "MEMORY:rd_req", &ccache)))
+
+ if ((ret = krb5_cc_resolve(context, "MEMORY:rd_req", &template_ccache)))
goto cleanup;
-
+ ccache = template_ccache; /* krb5_cc_gen_new will replace so make a copy */
+
+ if ((ret = krb5_cc_gen_new(context, &ccache)))
+ goto cleanup;
+
if ((ret = krb5_cc_initialize(context, ccache, creds->client)))
goto cleanup;
@@ -209,6 +215,8 @@ cleanup:
krb5_free_principal(context, server);
if (!keytab_arg && keytab)
krb5_kt_close(context, keytab);
+ if (template_ccache)
+ krb5_cc_close(context, template_ccache);
if (ccache)
krb5_cc_destroy(context, ccache);
if (out_creds)