From: Ken Raeburn Date: Mon, 21 May 2007 21:58:24 +0000 (+0000) Subject: Change struct _krb5_context.os_context into a single element instead of array[1] X-Git-Tag: krb5-1.7-alpha1~1106 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e89bf95300ae09c24e858398bcd79e2135603925;p=krb5.git Change struct _krb5_context.os_context into a single element instead of array[1] git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19554 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/include/k5-int.h b/src/include/k5-int.h index 0b01026ec..b5791a926 100644 --- a/src/include/k5-int.h +++ b/src/include/k5-int.h @@ -1203,16 +1203,7 @@ struct _krb5_context { unsigned int in_tkt_ktype_count; krb5_enctype *tgs_ktypes; unsigned int tgs_ktype_count; - /* This used to be a void*, but since we always allocate them - together (though in different source files), and the types - are declared in the same header, might as well just combine - them. - - The array[1] is so the existing code treating the field as - a pointer will still work. For cleanliness, it should - eventually get changed to a single element instead of an - array. */ - struct _krb5_os_context os_context[1]; + struct _krb5_os_context os_context; char *default_realm; profile_t profile; void *db_context; diff --git a/src/lib/krb5/ccache/cc_file.c b/src/lib/krb5/ccache/cc_file.c index c87fef4e0..84d278765 100644 --- a/src/lib/krb5/ccache/cc_file.c +++ b/src/lib/krb5/ccache/cc_file.c @@ -1,7 +1,7 @@ /* * lib/krb5/ccache/cc_file.c * - * Copyright 1990,1991,1992,1993,1994,2000,2004 Massachusetts Institute of Technology. + * Copyright 1990,1991,1992,1993,1994,2000,2004,2007 Massachusetts Institute of Technology. * All Rights Reserved. * * Original stdio support copyright 1995 by Cygnus Support. @@ -1205,7 +1205,7 @@ krb5_fcc_close_file (krb5_context context, krb5_fcc_data *data) static krb5_error_code krb5_fcc_open_file (krb5_context context, krb5_ccache id, int mode) { - krb5_os_context os_ctx = (krb5_os_context)context->os_context; + krb5_os_context os_ctx = &context->os_context; krb5_fcc_data *data = (krb5_fcc_data *)id->data; krb5_ui_2 fcc_fvno; krb5_ui_2 fcc_flen; diff --git a/src/lib/krb5/ccache/cccursor.c b/src/lib/krb5/ccache/cccursor.c index ab6f2a971..f0ae4a832 100644 --- a/src/lib/krb5/ccache/cccursor.c +++ b/src/lib/krb5/ccache/cccursor.c @@ -1,7 +1,7 @@ /* * lib/krb5/ccache/cccursor.c * - * Copyright 2006 by the Massachusetts Institute of Technology. + * Copyright 2006, 2007 by the Massachusetts Institute of Technology. * All Rights Reserved. * * Export of this software from the United States of America may @@ -120,7 +120,7 @@ krb5_cccol_cursor_next( krb5_os_context os_ctx = NULL; *ccache = NULL; - os_ctx = context->os_context; + os_ctx = &context->os_context; switch (cursor->pos) { case CCCURSOR_CONTEXT: diff --git a/src/lib/krb5/ccache/ccdefault.c b/src/lib/krb5/ccache/ccdefault.c index 3c363229a..f256bfd08 100644 --- a/src/lib/krb5/ccache/ccdefault.c +++ b/src/lib/krb5/ccache/ccdefault.c @@ -1,7 +1,7 @@ /* * lib/krb5/ccache/ccdefault.c * - * Copyright 1990 by the Massachusetts Institute of Technology. + * Copyright 1990, 2007 by the Massachusetts Institute of Technology. * All Rights Reserved. * * Export of this software from the United States of America may @@ -45,7 +45,7 @@ krb5_cc_default(krb5_context context, krb5_ccache *ccache) if (!context || context->magic != KV5M_CONTEXT) return KV5M_CONTEXT; - os_ctx = context->os_context; + os_ctx = &context->os_context; return krb5_cc_resolve(context, krb5_cc_default_name(context), ccache); } diff --git a/src/lib/krb5/krb/init_ctx.c b/src/lib/krb5/krb/init_ctx.c index be20c4067..57f5b8fba 100644 --- a/src/lib/krb5/krb/init_ctx.c +++ b/src/lib/krb5/krb/init_ctx.c @@ -1,7 +1,7 @@ /* * lib/krb5/krb/init_ctx.c * - * Copyright 1994,1999,2000, 2002, 2003 by the Massachusetts Institute of Technology. + * Copyright 1994,1999,2000, 2002, 2003, 2007 by the Massachusetts Institute of Technology. * All Rights Reserved. * * Export of this software from the United States of America may @@ -533,7 +533,7 @@ krb5_copy_context(krb5_context ctx, krb5_context *nctx_out) nctx->ser_ctx_count = 0; nctx->ser_ctx = NULL; nctx->prompt_types = NULL; - nctx->os_context->default_ccname = NULL; + nctx->os_context.default_ccname = NULL; memset(&nctx->preauth_plugins, 0, sizeof(nctx->preauth_plugins)); nctx->preauth_context = NULL; @@ -556,10 +556,10 @@ krb5_copy_context(krb5_context ctx, krb5_context *nctx_out) goto errout; nctx->tgs_ktype_count = ctx->tgs_ktype_count; - if (ctx->os_context->default_ccname != NULL) { - nctx->os_context->default_ccname = - strdup(ctx->os_context->default_ccname); - if (nctx->os_context->default_ccname == NULL) { + if (ctx->os_context.default_ccname != NULL) { + nctx->os_context.default_ccname = + strdup(ctx->os_context.default_ccname); + if (nctx->os_context.default_ccname == NULL) { ret = ENOMEM; goto errout; } diff --git a/src/lib/krb5/krb/ser_ctx.c b/src/lib/krb5/krb/ser_ctx.c index e76b650d2..8a0088768 100644 --- a/src/lib/krb5/krb/ser_ctx.c +++ b/src/lib/krb5/krb/ser_ctx.c @@ -1,7 +1,7 @@ /* * lib/krb5/krb/ser_ctx.c * - * Copyright 1995 by the Massachusetts Institute of Technology. + * Copyright 1995, 2007 by the Massachusetts Institute of Technology. * All Rights Reserved. * * Export of this software from the United States of America may @@ -132,11 +132,10 @@ krb5_context_size(krb5_context kcontext, krb5_pointer arg, size_t *sizep) if (context->default_realm) required += strlen(context->default_realm); /* Calculate size required by os_context, if appropriate */ - if (context->os_context) - kret = krb5_size_opaque(kcontext, - KV5M_OS_CONTEXT, - (krb5_pointer) context->os_context, - &required); + kret = krb5_size_opaque(kcontext, + KV5M_OS_CONTEXT, + (krb5_pointer) &context->os_context, + &required); /* Calculate size required by db_context, if appropriate */ if (!kret && context->db_context) @@ -282,14 +281,12 @@ krb5_context_externalize(krb5_context kcontext, krb5_pointer arg, krb5_octet **b return (kret); /* Now handle os_context, if appropriate */ - if (context->os_context) { - kret = krb5_externalize_opaque(kcontext, KV5M_OS_CONTEXT, - (krb5_pointer) context->os_context, - &bp, &remain); - if (kret) - return (kret); - } - + kret = krb5_externalize_opaque(kcontext, KV5M_OS_CONTEXT, + (krb5_pointer) &context->os_context, + &bp, &remain); + if (kret) + return (kret); + /* Now handle database context, if appropriate */ if (context->db_context) { kret = krb5_externalize_opaque(kcontext, KV5M_DB_CONTEXT, @@ -462,7 +459,7 @@ krb5_context_internalize(krb5_context kcontext, krb5_pointer *argp, krb5_octet * /* Put the newly allocated data into the krb5_context structure where we're really keeping it these days. */ if (osp) - *context->os_context = *osp; + context->os_context = *osp; free(osp); } diff --git a/src/lib/krb5/os/ccdefname.c b/src/lib/krb5/os/ccdefname.c index e5059a5e6..d140b0896 100644 --- a/src/lib/krb5/os/ccdefname.c +++ b/src/lib/krb5/os/ccdefname.c @@ -1,7 +1,7 @@ /* * lib/krb5/os/ccdefname.c * - * Copyright 1990 by the Massachusetts Institute of Technology. + * Copyright 1990, 2007 by the Massachusetts Institute of Technology. * All Rights Reserved. * * Export of this software from the United States of America may @@ -261,7 +261,7 @@ krb5_cc_set_default_name(krb5_context context, const char *name) if (!err) { /* free the old ccname and store the new one */ - krb5_os_context os_ctx = context->os_context; + krb5_os_context os_ctx = &context->os_context; if (os_ctx->default_ccname) { free (os_ctx->default_ccname); } os_ctx->default_ccname = new_ccname; new_ccname = NULL; /* don't free */ @@ -282,7 +282,7 @@ krb5_cc_default_name(krb5_context context) if (!context || context->magic != KV5M_CONTEXT) { err = KV5M_CONTEXT; } if (!err) { - os_ctx = context->os_context; + os_ctx = &context->os_context; if (os_ctx->default_ccname == NULL) { /* Default ccache name has not been set yet */ diff --git a/src/lib/krb5/os/init_os_ctx.c b/src/lib/krb5/os/init_os_ctx.c index 88b5ed044..16ff0435f 100644 --- a/src/lib/krb5/os/init_os_ctx.c +++ b/src/lib/krb5/os/init_os_ctx.c @@ -1,7 +1,7 @@ /* * lib/krb5/os/init_ctx.c * - * Copyright 1994 by the Massachusetts Institute of Technology. + * Copyright 1994, 2007 by the Massachusetts Institute of Technology. * All Rights Reserved. * * Export of this software from the United States of America may @@ -382,7 +382,7 @@ krb5_os_init_context(krb5_context ctx, krb5_boolean kdc) WSADATA wsaData; #endif /* _WIN32 */ - os_ctx = ctx->os_context; + os_ctx = &ctx->os_context; os_ctx->magic = KV5M_OS_CONTEXT; os_ctx->time_offset = 0; os_ctx->usec_offset = 0; @@ -480,7 +480,7 @@ krb5_os_free_context(krb5_context ctx) { krb5_os_context os_ctx; - os_ctx = ctx->os_context; + os_ctx = &ctx->os_context; if (os_ctx->default_ccname) { free(os_ctx->default_ccname); diff --git a/src/lib/krb5/os/timeofday.c b/src/lib/krb5/os/timeofday.c index dcc75f566..c65ce6fc0 100644 --- a/src/lib/krb5/os/timeofday.c +++ b/src/lib/krb5/os/timeofday.c @@ -1,7 +1,7 @@ /* * lib/krb5/os/timeofday.c * - * Copyright 1990 by the Massachusetts Institute of Technology. + * Copyright 1990, 2007 by the Massachusetts Institute of Technology. * All Rights Reserved. * * Export of this software from the United States of America may @@ -35,7 +35,7 @@ krb5_error_code KRB5_CALLCONV krb5_timeofday(krb5_context context, register krb5_timestamp *timeret) { - krb5_os_context os_ctx = context->os_context; + krb5_os_context os_ctx = &context->os_context; time_t tval; if (os_ctx->os_flags & KRB5_OS_TOFFSET_TIME) { diff --git a/src/lib/krb5/os/toffset.c b/src/lib/krb5/os/toffset.c index 967b9d62b..3a06e335b 100644 --- a/src/lib/krb5/os/toffset.c +++ b/src/lib/krb5/os/toffset.c @@ -1,7 +1,7 @@ /* * lib/krb5/os/toffset.c * - * Copyright 1995 by the Massachusetts Institute of Technology. + * Copyright 1995, 2007 by the Massachusetts Institute of Technology. * All Rights Reserved. * * Export of this software from the United States of America may @@ -38,7 +38,7 @@ krb5_error_code KRB5_CALLCONV krb5_set_real_time(krb5_context context, krb5_timestamp seconds, krb5_int32 microseconds) { - krb5_os_context os_ctx = context->os_context; + krb5_os_context os_ctx = &context->os_context; krb5_int32 sec, usec; krb5_error_code retval; @@ -60,7 +60,7 @@ krb5_set_real_time(krb5_context context, krb5_timestamp seconds, krb5_int32 micr krb5_error_code krb5_set_debugging_time(krb5_context context, krb5_timestamp seconds, krb5_int32 microseconds) { - krb5_os_context os_ctx = context->os_context; + krb5_os_context os_ctx = &context->os_context; os_ctx->time_offset = seconds; os_ctx->usec_offset = microseconds; @@ -76,7 +76,7 @@ krb5_set_debugging_time(krb5_context context, krb5_timestamp seconds, krb5_int32 krb5_error_code krb5_use_natural_time(krb5_context context) { - krb5_os_context os_ctx = context->os_context; + krb5_os_context os_ctx = &context->os_context; os_ctx->os_flags &= ~(KRB5_OS_TOFFSET_VALID|KRB5_OS_TOFFSET_TIME); @@ -89,7 +89,7 @@ krb5_use_natural_time(krb5_context context) krb5_error_code KRB5_CALLCONV krb5_get_time_offsets(krb5_context context, krb5_timestamp *seconds, krb5_int32 *microseconds) { - krb5_os_context os_ctx = context->os_context; + krb5_os_context os_ctx = &context->os_context; if (seconds) *seconds = os_ctx->time_offset; @@ -105,7 +105,7 @@ krb5_get_time_offsets(krb5_context context, krb5_timestamp *seconds, krb5_int32 krb5_error_code krb5_set_time_offsets(krb5_context context, krb5_timestamp seconds, krb5_int32 microseconds) { - krb5_os_context os_ctx = context->os_context; + krb5_os_context os_ctx = &context->os_context; os_ctx->time_offset = seconds; os_ctx->usec_offset = microseconds; diff --git a/src/lib/krb5/os/ustime.c b/src/lib/krb5/os/ustime.c index ef923d387..bb34c228e 100644 --- a/src/lib/krb5/os/ustime.c +++ b/src/lib/krb5/os/ustime.c @@ -1,7 +1,7 @@ /* * lib/krb5/os/ustime.c * - * Copyright 1990,1991 by the Massachusetts Institute of Technology. + * Copyright 1990,1991,2007 by the Massachusetts Institute of Technology. * All Rights Reserved. * * Export of this software from the United States of America may @@ -36,7 +36,7 @@ krb5_error_code KRB5_CALLCONV krb5_us_timeofday(krb5_context context, krb5_timestamp *seconds, krb5_int32 *microseconds) { - krb5_os_context os_ctx = context->os_context; + krb5_os_context os_ctx = &context->os_context; krb5_int32 sec, usec; krb5_error_code retval;