more locking cleanups
authorLuke Howard <lukeh@padl.com>
Sat, 2 Oct 2010 20:18:59 +0000 (22:18 +0200)
committerLuke Howard <lukeh@padl.com>
Sat, 2 Oct 2010 20:18:59 +0000 (22:18 +0200)
verify_mic.c
wrap_iov.c
wrap_iov_length.c

index 7eeefd1..1403eca 100644 (file)
@@ -43,6 +43,8 @@ gss_verify_mic(OM_uint32 *minor,
     gss_iov_buffer_desc iov[3];
     int conf_state;
 
+    *minor = 0;
+
     if (message_token->length < 16) {
         *minor = KRB5_BAD_MSIZE;
         return GSS_S_BAD_SIG;
index cdf9c3b..659d634 100644 (file)
@@ -328,18 +328,24 @@ gss_wrap_iov(OM_uint32 *minor,
 {
     OM_uint32 major;
 
+    *minor = 0;
+
     if (ctx == GSS_C_NO_CONTEXT)
         return GSS_S_NO_CONTEXT;
 
     GSSEAP_MUTEX_LOCK(&ctx->mutex);
 
     if (!CTX_IS_ESTABLISHED(ctx)) {
-        *minor = 0;
         major = GSS_S_NO_CONTEXT;
-    } else
-        major = gssEapWrapOrGetMIC(minor, ctx, conf_req_flag, conf_state,
-                                   iov, iov_count, TOK_TYPE_WRAP);
+        goto cleanup;
+    }
 
+    major = gssEapWrapOrGetMIC(minor, ctx, conf_req_flag, conf_state,
+                               iov, iov_count, TOK_TYPE_WRAP);
+    if (GSS_ERROR(major))
+        goto cleanup;
+
+cleanup:
     GSSEAP_MUTEX_UNLOCK(&ctx->mutex);
 
     return major;
index 7930693..24bc1a5 100644 (file)
@@ -190,6 +190,8 @@ gss_wrap_iov_length(OM_uint32 *minor,
 {
     OM_uint32 major;
 
+    *minor = 0;
+
     if (ctx == GSS_C_NO_CONTEXT)
         return GSS_S_NO_CONTEXT;