From ac134c6bf0accc0a6abbbf85ee505722303a29c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Mon, 8 Mar 2004 18:49:12 +0000 Subject: [PATCH] (krb5_ret_creds): if the higher ticket flags are set, its a mit cache, reverse the bits, bug pointed out by Sergio Gelato git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@13480 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/krb5/store.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/krb5/store.c b/lib/krb5/store.c index 6c8d6e557..004cf5cfd 100644 --- a/lib/krb5/store.c +++ b/lib/krb5/store.c @@ -672,6 +672,20 @@ krb5_ret_creds(krb5_storage *sp, krb5_creds *creds) if(ret) goto cleanup; ret = krb5_ret_int32 (sp, &dummy32); if(ret) goto cleanup; + /* + * If the higher hits are set, its either a new ticket flag (and + * this code need to be removed), or its a MIT cache (or new + * Heimdal cache), lets change it to our current format. + */ + if (dummy32 & 0xffff0000) { + int32_t rdummy32 = 0; + int i; + for (i = 0; i < 32; i++) { + rdummy32 = rdummy32 << 1 | (dummy32 & 1); + dummy32 = dummy32 >> 1; + } + dummy32 = rdummy32; + } creds->flags.i = dummy32; ret = krb5_ret_addrs (sp, &creds->addresses); if(ret) goto cleanup;