Don't attempt to serialize a NULL authdata context when serializing a
authorGreg Hudson <ghudson@mit.edu>
Tue, 28 Dec 2010 18:27:17 +0000 (18:27 +0000)
committerGreg Hudson <ghudson@mit.edu>
Tue, 28 Dec 2010 18:27:17 +0000 (18:27 +0000)
GSSAPI context (most often seen with initiator contexts).  Patch from
aberry@likewise.com.

ticket: 6675
target_version: 1.9.1
tags: pullup

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24590 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 */