fix shib reentrancy regression in recent commit
authorLuke Howard <lukeh@padl.com>
Wed, 30 Mar 2011 04:30:37 +0000 (15:30 +1100)
committerLuke Howard <lukeh@padl.com>
Wed, 30 Mar 2011 04:30:37 +0000 (15:30 +1100)
mech_eap/util_attr.cpp

index 4d4efde..01c3135 100644 (file)
@@ -1159,9 +1159,11 @@ gssEapCreateAttrContext(OM_uint32 *minor,
         return major;
 
     try {
-        ctx = new gss_eap_attr_ctx();
+        /* Set *pAttrContext here to for reentrancy */
+        *pAttrContext = ctx = new gss_eap_attr_ctx();
 
         if (ctx->initWithGssContext(gssCred, gssCtx)) {
+            *pExpiryTime = ctx->getExpiryTime();
             major = GSS_S_COMPLETE;
             *minor = 0;
         } else {
@@ -1173,13 +1175,10 @@ gssEapCreateAttrContext(OM_uint32 *minor,
             major = ctx->mapException(minor, e);
     }
 
-    if (major == GSS_S_COMPLETE) {
-        *pExpiryTime = ctx->getExpiryTime();
-        *pAttrContext = ctx;
-    }
-
-    if (GSS_ERROR(major))
+    if (GSS_ERROR(major)) {
         delete ctx;
+        *pAttrContext = NULL;
+    }
 
     return major;
 }