comment out dumping code
[moonshot.git] / mech_eap / pseudo_random.c
index 05acbcb..4bbf542 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, JANET(UK)
+ * Copyright (c) 2011, JANET(UK)
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * or implied warranty.
  */
 
+/*
+ * PRF
+ */
+
 #include "gssapiP_eap.h"
 
 OM_uint32
@@ -71,18 +75,21 @@ gss_pseudo_random(OM_uint32 *minor,
     unsigned char *p;
     krb5_context krbContext;
 
-    *minor = 0;
-
     prf_out->length = 0;
     prf_out->value = NULL;
 
-    if (ctx == GSS_C_NO_CONTEXT)
-        return GSS_S_NO_CONTEXT;
+    if (ctx == GSS_C_NO_CONTEXT) {
+        *minor = EINVAL;
+        return GSS_S_CALL_INACCESSIBLE_READ | GSS_S_NO_CONTEXT;
+    }
+
+    *minor = 0;
 
     GSSEAP_MUTEX_LOCK(&ctx->mutex);
 
     if (!CTX_IS_ESTABLISHED(ctx)) {
         GSSEAP_MUTEX_UNLOCK(&ctx->mutex);
+        *minor = GSSEAP_CONTEXT_INCOMPLETE;
         return GSS_S_NO_CONTEXT;
     }
 
@@ -96,7 +103,7 @@ gss_pseudo_random(OM_uint32 *minor,
 
     if (prf_key != GSS_C_PRF_KEY_PARTIAL &&
         prf_key != GSS_C_PRF_KEY_FULL) {
-        code = EINVAL;
+        code = GSSEAP_BAD_PRF_KEY;
         goto cleanup;
     }