svn rev #21558: branches/mskrb-integ/src/lib/gssapi/krb5/
lhoward@MIT.EDU
lhoward at MIT.EDU
Sun Dec 21 00:57:46 EST 2008
http://src.mit.edu/fisheye/changelog/krb5/?cs=21558
Commit By: lhoward
Log Message:
Fix incorrect ordering of acceptor_key_cksumtype and cred_rcache in
kg_ctx_internalize()
Serialize/deserialize context (ticket) authorization data
Changed Files:
U branches/mskrb-integ/src/lib/gssapi/krb5/ser_sctx.c
Modified: branches/mskrb-integ/src/lib/gssapi/krb5/ser_sctx.c
===================================================================
--- branches/mskrb-integ/src/lib/gssapi/krb5/ser_sctx.c 2008-12-21 05:31:38 UTC (rev 21557)
+++ branches/mskrb-integ/src/lib/gssapi/krb5/ser_sctx.c 2008-12-21 05:57:45 UTC (rev 21558)
@@ -278,11 +278,13 @@
* ... for acceptor_subkey
* krb5_int32 for acceptor_key_cksumtype
* krb5_int32 for cred_rcache
+ * krb5_int32 for number of elements in authdata array
+ * ... for authdata array
* krb5_int32 for trailer.
*/
kret = EINVAL;
if ((ctx = (krb5_gss_ctx_id_rec *) arg)) {
- required = 17*sizeof(krb5_int32);
+ required = 18*sizeof(krb5_int32);
required += 2*sizeof(krb5_int64);
required += sizeof(ctx->seed);
@@ -340,6 +342,16 @@
KV5M_KEYBLOCK,
(krb5_pointer) ctx->acceptor_subkey,
&required);
+ if (!kret && ctx->authdata) {
+ krb5_int32 i;
+
+ for (i = 0; !kret && ctx->authdata[i]; i++) {
+ kret = krb5_size_opaque(kcontext,
+ KV5M_AUTHDATA,
+ (krb5_pointer)ctx->authdata[i],
+ &required);
+ }
+ }
if (!kret)
*sizep += required;
}
@@ -486,6 +498,25 @@
if (!kret)
kret = krb5_ser_pack_int32((krb5_int32) ctx->cred_rcache,
&bp, &remain);
+ if (!kret) {
+ int i = 0;
+
+ if (ctx->authdata) {
+ for (; ctx->authdata[i]; i++)
+ ;
+ }
+ /* authdata count */
+ kret = krb5_ser_pack_int32(i, &bp, &remain);
+ if (!kret && ctx->authdata) {
+ /* authdata */
+ for (i = 0; !kret && ctx->authdata[i]; i++)
+ kret = krb5_externalize_opaque(kcontext,
+ KV5M_AUTHDATA,
+ ctx->authdata[i],
+ &bp,
+ &remain);
+ }
+ }
/* trailer */
if (!kret)
kret = krb5_ser_pack_int32(KG_CONTEXT, &bp, &remain);
@@ -662,11 +693,31 @@
}
if (!kret)
kret = krb5_ser_unpack_int32(&ibuf, &bp, &remain);
+ ctx->acceptor_subkey_cksumtype = ibuf;
+ if (!kret)
+ kret = krb5_ser_unpack_int32(&ibuf, &bp, &remain);
ctx->cred_rcache = ibuf;
+ /* authdata */
if (!kret)
kret = krb5_ser_unpack_int32(&ibuf, &bp, &remain);
- ctx->acceptor_subkey_cksumtype = ibuf;
+ if (!kret) {
+ krb5_int32 nadata = ibuf, i;
+ if (nadata > 0) {
+ ctx->authdata = (krb5_authdata **)calloc((size_t)nadata + 1,
+ sizeof(krb5_authdata *));
+ if (ctx->authdata == NULL) {
+ kret = ENOMEM;
+ } else {
+ for (i = 0; !kret && i < nadata; i++)
+ kret = krb5_internalize_opaque(kcontext,
+ KV5M_AUTHDATA,
+ (krb5_pointer *)&ctx->authdata[i],
+ &bp,
+ &remain);
+ }
+ }
+ }
/* Get trailer */
if (!kret)
kret = krb5_ser_unpack_int32(&ibuf, &bp, &remain);
More information about the cvs-krb5
mailing list