From c5770cfd91ca3b01f6e9ee79139cf8e6b8e95eee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Wed, 12 Nov 2008 04:20:14 +0000 Subject: [PATCH] check cache returned from krb5_cccol_cursor_next git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24037 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/krb5/cache.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/krb5/cache.c b/lib/krb5/cache.c index 80b755cd2..8584bf7ca 100644 --- a/lib/krb5/cache.c +++ b/lib/krb5/cache.c @@ -1082,7 +1082,7 @@ krb5_cc_cache_match (krb5_context context, if (ret) return ret; - while ((ret = krb5_cccol_cursor_next (context, cursor, &cache)) == 0) { + while ((ret = krb5_cccol_cursor_next (context, cursor, &cache)) == 0 && cache != NULL) { krb5_principal principal; ret = krb5_cc_get_principal(context, cache, &principal); @@ -1345,6 +1345,8 @@ krb5_cccol_cursor_new(krb5_context context, krb5_cccol_cursor *cursor) * @param cache the returned cursor, pointer is set to NULL on failure * and a cache on success. The returned cache needs to be freed * with krb5_cc_close() or destroyed with krb5_cc_destroy(). + * MIT Kerberos behavies slightly diffrent and sets cache to NULL + * when all caches are iterated over and return 0. * * @return Return 0 or and error, KRB5_CC_END is returned at the end * of iteration. See krb5_get_error_message(). @@ -1470,7 +1472,7 @@ krb5_cccol_last_change_time(krb5_context context, if (ret) return ret; - while ((ret = krb5_cccol_cursor_next (context, cursor, &id)) == 0) { + while ((ret = krb5_cccol_cursor_next (context, cursor, &id) && id) == 0) { if (type && strcmp(krb5_cc_get_type(context, id), type) != 0) continue;