pull up r24590 from trunk
authorTom Yu <tlyu@mit.edu>
Mon, 31 Jan 2011 22:44:13 +0000 (22:44 +0000)
committerTom Yu <tlyu@mit.edu>
Mon, 31 Jan 2011 22:44:13 +0000 (22:44 +0000)
 ------------------------------------------------------------------------
 r24590 | ghudson | 2010-12-28 13:27:17 -0500 (Tue, 28 Dec 2010) | 8 lines

 ticket: 6675
 target_version: 1.9.1
 tags: pullup

 Don't attempt to serialize a NULL authdata context when serializing a
 GSSAPI context (most often seen with initiator contexts).  Patch from
 aberry@likewise.com.

ticket: 6675
version_fixed: 1.9.1
status: resolved

git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-9@24607 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/gssapi/krb5/ser_sctx.c

index 63a7bd82a5eff7e6f6e32e2c2bab429810fac180..ae6350cced854abb98b7566c79f19b10910e7191 100644 (file)
@@ -357,7 +357,7 @@ kg_ctx_size(kcontext, arg, sizep)
 
             initiator_name = ctx->initiate ? ctx->here : ctx->there;
 
-            if (initiator_name) {
+            if (initiator_name && initiator_name->ad_context) {
                 kret = krb5_size_opaque(kcontext,
                                         KV5M_AUTHDATA_CONTEXT,
                                         initiator_name->ad_context,
@@ -534,7 +534,7 @@ kg_ctx_externalize(kcontext, arg, buffer, lenremain)
 
                 initiator_name = ctx->initiate ? ctx->here : ctx->there;
 
-                if (initiator_name) {
+                if (initiator_name && initiator_name->ad_context) {
                     kret = krb5_externalize_opaque(kcontext,
                                                    KV5M_AUTHDATA_CONTEXT,
                                                    initiator_name->ad_context,
@@ -775,6 +775,8 @@ kg_ctx_internalize(kcontext, argp, buffer, lenremain)
                                                    (krb5_pointer *)&initiator_name->ad_context,
                                                    &bp,
                                                    &remain);
+                    if (kret == EINVAL)
+                        kret = 0;
                 }
             }
             /* Get trailer */