Merge branch 'master' into tlv-mic
authorLuke Howard <lukeh@padl.com>
Wed, 30 Mar 2011 04:39:37 +0000 (15:39 +1100)
committerLuke Howard <lukeh@padl.com>
Wed, 30 Mar 2011 04:39:37 +0000 (15:39 +1100)
1  2 
mech_eap/util_attr.cpp

diff --combined mech_eap/util_attr.cpp
@@@ -854,15 -854,13 +854,15 @@@ gssEapInquireName(OM_uint32 *minor
          return GSS_S_UNAVAILABLE;
      }
  
 -    try {
 -        if (!name->attrCtx->getAttributeTypes(attrs)) {
 -            *minor = GSSEAP_NO_ATTR_CONTEXT;
 -            return GSS_S_UNAVAILABLE;
 +    if (attrs != NULL) {
 +        try {
 +            if (!name->attrCtx->getAttributeTypes(attrs)) {
 +                *minor = GSSEAP_NO_ATTR_CONTEXT;
 +                return GSS_S_UNAVAILABLE;
 +            }
 +        } catch (std::exception &e) {
 +            return name->attrCtx->mapException(minor, e);
          }
 -    } catch (std::exception &e) {
 -        return name->attrCtx->mapException(minor, e);
      }
  
      return GSS_S_COMPLETE;
@@@ -1161,9 -1159,11 +1161,11 @@@ gssEapCreateAttrContext(OM_uint32 *mino
          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 {
              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;
  }