From: Theodore Tso Date: Fri, 23 Apr 1999 04:33:19 +0000 (+0000) Subject: wrap_size_limit.c (krb5_gss_wrap_size_limit): Fix wrap_size limit so X-Git-Tag: krb5-1.1-beta1~210 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=03c8dc0b570c38d17ba78e4de7fd13bde86a3df3;p=krb5.git wrap_size_limit.c (krb5_gss_wrap_size_limit): Fix wrap_size limit so that it correctly calculates its results, and underestimates the correct size instead of overestimating it, and not returning zero all the time. (Which it used to do after the March 25 fix.) git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@11380 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/gssapi/krb5/ChangeLog b/src/lib/gssapi/krb5/ChangeLog index 61b9cb586..dbab40a0c 100644 --- a/src/lib/gssapi/krb5/ChangeLog +++ b/src/lib/gssapi/krb5/ChangeLog @@ -1,3 +1,11 @@ +Fri Apr 23 00:31:17 1999 Theodore Y. Ts'o + + * wrap_size_limit.c (krb5_gss_wrap_size_limit): Fix wrap_size + limit so that it correctly calculates its results, and + underestimates the correct size instead of overestimating + it, and not returning zero all the time. (Which it used + to do after the March 25 fix.) + Sat Apr 17 01:23:57 1999 Theodore Y. Ts'o * gssapi_krb5.h, copy_ccache.c, get_tkt_flags.c, set_ccache.c: diff --git a/src/lib/gssapi/krb5/wrap_size_limit.c b/src/lib/gssapi/krb5/wrap_size_limit.c index 54c29da30..f7fee73cd 100644 --- a/src/lib/gssapi/krb5/wrap_size_limit.c +++ b/src/lib/gssapi/krb5/wrap_size_limit.c @@ -150,21 +150,27 @@ krb5_gss_wrap_size_limit(minor_status, context_handle, conf_req_flag, *max_input_size = req_output_size - headerlen; } } else { - OM_uint32 cfsize; + OM_uint32 data_size, conflen; OM_uint32 ohlen; + int overhead; /* Calculate the token size and subtract that from the output size */ - cfsize = (conf_req_flag) ? kg_confounder_size(context, ctx->enc) : 0; + overhead = 7 + ctx->mech_used->length; + data_size = req_output_size; + if (conf_req_flag) { + conflen = kg_confounder_size(context, ctx->enc); + data_size = (conflen + data_size + 8) & (~7); + } ohlen = g_token_size((gss_OID) ctx->mech_used, - (unsigned int) (req_output_size + cfsize + - ctx->cksum_size + 14)); + (unsigned int) (data_size + ctx->cksum_size + 14)) + - req_output_size; - if (ohlen < req_output_size) + if (ohlen+overhead < req_output_size) /* * Cannot have trailer length that will cause us to pad over * our length */ - *max_input_size = (req_output_size - ohlen - 1) & (~7); + *max_input_size = (req_output_size - ohlen - overhead) & (~7); else *max_input_size = 0; }