|
|
68bf20 |
From 1fa33903be640f8d22757d21da294e70f0812698 Mon Sep 17 00:00:00 2001
|
|
|
1f3433 |
From: Robbie Harwood <rharwood@redhat.com>
|
|
|
1f3433 |
Date: Tue, 10 Oct 2017 18:00:45 -0400
|
|
|
1f3433 |
Subject: [PATCH] Only empty FILE ccaches when storing remote creds
|
|
|
1f3433 |
|
|
|
1f3433 |
This mitigates issues when services share a ccache between two
|
|
|
1f3433 |
processes. We cannot fix this for FILE ccaches without introducing
|
|
|
1f3433 |
other issues.
|
|
|
1f3433 |
|
|
|
1f3433 |
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
|
|
|
1f3433 |
Reviewed-by: Simo Sorce <simo@redhat.com>
|
|
|
1f3433 |
Merges: #216
|
|
|
1f3433 |
(cherry picked from commit d09e87f47a21dd250bfd7a9c59a5932b5c995057)
|
|
|
1f3433 |
---
|
|
|
1f3433 |
proxy/src/mechglue/gpp_creds.c | 18 +++++++++++++-----
|
|
|
1f3433 |
1 file changed, 13 insertions(+), 5 deletions(-)
|
|
|
1f3433 |
|
|
|
1f3433 |
diff --git a/proxy/src/mechglue/gpp_creds.c b/proxy/src/mechglue/gpp_creds.c
|
|
|
1f3433 |
index 9fe9bd1..6bdff45 100644
|
|
|
1f3433 |
--- a/proxy/src/mechglue/gpp_creds.c
|
|
|
1f3433 |
+++ b/proxy/src/mechglue/gpp_creds.c
|
|
|
1f3433 |
@@ -147,6 +147,7 @@ uint32_t gpp_store_remote_creds(uint32_t *min, bool default_creds,
|
|
|
1f3433 |
char cred_name[creds->desired_name.display_name.octet_string_len + 1];
|
|
|
1f3433 |
XDR xdrctx;
|
|
|
1f3433 |
bool xdrok;
|
|
|
1f3433 |
+ const char *cc_type;
|
|
|
1f3433 |
|
|
|
1f3433 |
*min = 0;
|
|
|
1f3433 |
|
|
|
1f3433 |
@@ -193,13 +194,20 @@ uint32_t gpp_store_remote_creds(uint32_t *min, bool default_creds,
|
|
|
1f3433 |
}
|
|
|
1f3433 |
cred.ticket.length = xdr_getpos(&xdrctx);
|
|
|
1f3433 |
|
|
|
1f3433 |
- /* Always initialize and destroy any existing contents to avoid pileup of
|
|
|
1f3433 |
- * entries */
|
|
|
1f3433 |
- ret = krb5_cc_initialize(ctx, ccache, cred.client);
|
|
|
1f3433 |
- if (ret == 0) {
|
|
|
1f3433 |
- ret = krb5_cc_store_cred(ctx, ccache, &cred);
|
|
|
1f3433 |
+ cc_type = krb5_cc_get_type(ctx, ccache);
|
|
|
1f3433 |
+ if (strcmp(cc_type, "FILE") == 0) {
|
|
|
1f3433 |
+ /* FILE ccaches don't handle updates properly: if they have the same
|
|
|
1f3433 |
+ * principal name, they are blackholed. We either have to change the
|
|
|
1f3433 |
+ * name (at which point the file grows forever) or flash the cache on
|
|
|
1f3433 |
+ * every update. */
|
|
|
1f3433 |
+ ret = krb5_cc_initialize(ctx, ccache, cred.client);
|
|
|
1f3433 |
+ if (ret != 0) {
|
|
|
1f3433 |
+ goto done;
|
|
|
1f3433 |
+ }
|
|
|
1f3433 |
}
|
|
|
1f3433 |
|
|
|
1f3433 |
+ ret = krb5_cc_store_cred(ctx, ccache, &cred);
|
|
|
1f3433 |
+
|
|
|
1f3433 |
done:
|
|
|
1f3433 |
if (ctx) {
|
|
|
1f3433 |
krb5_free_cred_contents(ctx, &cred);
|