Cleanup
[mech_eap.orig] / export_sec_context.c
index 1582886..e7080a0 100644 (file)
  * SUCH DAMAGE.
  */
 
-#include "gssapiP_eap.h"
-
 /*
- * Export a partially established acceptor context.
+ * Serialise a security context. On the acceptor, this may be partially
+ * established.
  */
+
+#include "gssapiP_eap.h"
+
 static OM_uint32
 gssEapExportPartialContext(OM_uint32 *minor,
                            gss_ctx_id_t ctx,
@@ -58,8 +60,8 @@ gssEapExportPartialContext(OM_uint32 *minor,
 
     token->value = GSSEAP_MALLOC(length);
     if (token->value == NULL) {
-        *minor = ENOMEM;
         major = GSS_S_FAILURE;
+        *minor = ENOMEM;
         goto cleanup;
     }
     token->length = length;
@@ -135,7 +137,7 @@ gssEapExportSecContext(OM_uint32 *minor,
      * contexts.
      */
     if (!CTX_IS_INITIATOR(ctx) && !CTX_IS_ESTABLISHED(ctx)) {
-        assert((ctx->flags & CTX_FLAG_KRB_REAUTH_GSS) == 0);
+        assert((ctx->flags & CTX_FLAG_KRB_REAUTH) == 0);
 
         major = gssEapExportPartialContext(minor, ctx, &partialCtx);
         if (GSS_ERROR(major))
@@ -154,8 +156,8 @@ gssEapExportSecContext(OM_uint32 *minor,
 
     token->value = GSSEAP_MALLOC(length);
     if (token->value == NULL) {
-        *minor = ENOMEM;
         major = GSS_S_FAILURE;
+        *minor = ENOMEM;
         goto cleanup;
     }
     token->length = length;
@@ -215,7 +217,7 @@ gss_export_sec_context(OM_uint32 *minor,
 
     if (ctx == GSS_C_NO_CONTEXT) {
         *minor = EINVAL;
-        return GSS_S_NO_CONTEXT;
+        return GSS_S_CALL_INACCESSIBLE_READ | GSS_S_NO_CONTEXT;
     }
 
     *minor = 0;