From b345adf741381a01adc07c63013c0fe36866a16b Mon Sep 17 00:00:00 2001 From: Richard Basch Date: Fri, 9 Feb 1996 00:50:32 +0000 Subject: [PATCH] * fcc_maybe.c Only store the os_context time offset if it is valid. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7462 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/ccache/file/fcc_maybe.c | 31 ++++++++++++++++------------ 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/lib/krb5/ccache/file/fcc_maybe.c b/src/lib/krb5/ccache/file/fcc_maybe.c index 5ce020d17..257c06e84 100644 --- a/src/lib/krb5/ccache/file/fcc_maybe.c +++ b/src/lib/krb5/ccache/file/fcc_maybe.c @@ -271,24 +271,29 @@ krb5_fcc_open_file (context, id, mode) if (data->version == KRB5_FCC_FVNO_4) { /* V4 of the credentials cache format allows for header tags */ - fcc_flen = (2*sizeof(krb5_ui_2) + 2*sizeof(krb5_int32)); + fcc_flen = 0; + + if (os_ctx->os_flags & KRB5_OS_TOFFSET_VALID) + fcc_flen += (2*sizeof(krb5_ui_2) + 2*sizeof(krb5_int32)); /* Write header length */ retval = krb5_fcc_store_ui_2(context, id, (krb5_int32)fcc_flen); if (retval) goto done; - /* Write time offset tag */ - fcc_tag = FCC_TAG_DELTATIME; - fcc_taglen = 2*sizeof(krb5_int32); - - retval = krb5_fcc_store_ui_2(context, id, (krb5_int32)fcc_tag); - if (retval) goto done; - retval = krb5_fcc_store_ui_2(context, id, (krb5_int32)fcc_taglen); - if (retval) goto done; - retval = krb5_fcc_store_int32(context, id, os_ctx->time_offset); - if (retval) goto done; - retval = krb5_fcc_store_int32(context, id, os_ctx->usec_offset); - if (retval) goto done; + if (os_ctx->os_flags & KRB5_OS_TOFFSET_VALID) { + /* Write time offset tag */ + fcc_tag = FCC_TAG_DELTATIME; + fcc_taglen = 2*sizeof(krb5_int32); + + retval = krb5_fcc_store_ui_2(context,id,(krb5_int32)fcc_tag); + if (retval) goto done; + retval = krb5_fcc_store_ui_2(context,id,(krb5_int32)fcc_taglen); + if (retval) goto done; + retval = krb5_fcc_store_int32(context,id,os_ctx->time_offset); + if (retval) goto done; + retval = krb5_fcc_store_int32(context,id,os_ctx->usec_offset); + if (retval) goto done; + } } goto done; } -- 2.26.2