Skip to content

Commit be7df45

Browse files
Properly initialize ccaches before storing into them
krb5_cc_new_unique() doesn't initialize ccaches, which results in the krb5 libraries being aware of their presence within the collection but being unable to manipulate them. This is transparent to most gssproxy consumers because we just re-fetch the ccache on error. Signed-off-by: Robbie Harwood <[email protected]> Reviewed-by: Simo Sorce <[email protected]> Merges: #223
1 parent 670240a commit be7df45

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/mechglue/gpp_creds.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,13 @@ uint32_t gpp_store_remote_creds(uint32_t *min, bool store_as_default_cred,
247247

248248
ret = krb5_cc_new_unique(ctx, cc_type, NULL, &ccache);
249249
free(cc_type);
250+
if (ret)
251+
goto done;
252+
253+
/* krb5_cc_new_unique() doesn't initialize, and we need to initialize
254+
* before storing into the ccache. Note that this will only clobber
255+
* the ccache handle, not the whole collection. */
256+
ret = krb5_cc_initialize(ctx, ccache, cred.client);
250257
}
251258
if (ret)
252259
goto done;

0 commit comments

Comments
 (0)