Blame SOURCES/Properly-initialize-ccaches-before-storing-into-them.patch

68bf20
From 2d91093925c8546d68f9314546353226b4f41569 Mon Sep 17 00:00:00 2001
1f3433
From: Robbie Harwood <rharwood@redhat.com>
1f3433
Date: Tue, 5 Dec 2017 13:14:29 -0500
1f3433
Subject: [PATCH] Properly initialize ccaches before storing into them
1f3433
1f3433
krb5_cc_new_unique() doesn't initialize ccaches, which results in the
1f3433
krb5 libraries being aware of their presence within the collection but
1f3433
being unable to manipulate them.
1f3433
1f3433
This is transparent to most gssproxy consumers because we just
1f3433
re-fetch the ccache on error.
1f3433
1f3433
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
1f3433
Reviewed-by: Simo Sorce <simo@redhat.com>
1f3433
Merges: #223
1f3433
(cherry picked from commit be7df45b6a56631033de387d28a2c06b7658c36a)
1f3433
---
1f3433
 proxy/src/mechglue/gpp_creds.c | 7 +++++++
1f3433
 1 file changed, 7 insertions(+)
1f3433
1f3433
diff --git a/proxy/src/mechglue/gpp_creds.c b/proxy/src/mechglue/gpp_creds.c
1f3433
index 187ada7..f8ab320 100644
1f3433
--- a/proxy/src/mechglue/gpp_creds.c
1f3433
+++ b/proxy/src/mechglue/gpp_creds.c
1f3433
@@ -247,6 +247,13 @@ uint32_t gpp_store_remote_creds(uint32_t *min, bool store_as_default_cred,
1f3433
 
1f3433
         ret = krb5_cc_new_unique(ctx, cc_type, NULL, &ccache);
1f3433
         free(cc_type);
1f3433
+        if (ret)
1f3433
+            goto done;
1f3433
+
1f3433
+        /* krb5_cc_new_unique() doesn't initialize, and we need to initialize
1f3433
+         * before storing into the ccache.  Note that this will only clobber
1f3433
+         * the ccache handle, not the whole collection. */
1f3433
+        ret = krb5_cc_initialize(ctx, ccache, cred.client);
1f3433
     }
1f3433
     if (ret)
1f3433
         goto done;