Merge branch 'master' into radius-new-client-pkcs12
authorLuke Howard <lukeh@padl.com>
Thu, 2 Feb 2012 21:04:00 +0000 (08:04 +1100)
committerLuke Howard <lukeh@padl.com>
Thu, 2 Feb 2012 21:04:00 +0000 (08:04 +1100)
mech_eap.spec.in
mech_eap/util_attr.cpp
mech_eap/util_moonshot.c

index 90ac6cf..ada2f90 100644 (file)
@@ -1,7 +1,7 @@
 %global _moonshot_krb5 %{!?_moonshot_krb5:krb5-devel}%{?_moonshot_krb5}
 Name:          moonshot-gss-eap
 Version:       @VERSION@
-Release:       3%{?dist}
+Release:       4%{?dist}
 Summary:       Moonshot GSS-API Mechanism
 
 Group:         Security Tools
index 3bfe785..d1c0075 100644 (file)
@@ -58,16 +58,16 @@ GSSEAP_ONCE_CALLBACK(gssEapAttrProvidersInitInternal)
     if (GSS_ERROR(major))
         goto cleanup;
 
-#ifdef HAVE_OPENSAML
-    major = gssEapSamlAttrProvidersInit(&minor);
-    if (GSS_ERROR(major))
-        goto cleanup;
-#endif
 
 #ifdef HAVE_SHIBRESOLVER
     /* Allow Shibboleth initialization failure to be non-fatal */
     gssEapLocalAttrProviderInit(&minor);
 #endif
+#ifdef HAVE_OPENSAML
+    major = gssEapSamlAttrProvidersInit(&minor);
+    if (GSS_ERROR(major))
+        goto cleanup;
+#endif
 
 cleanup:
 #ifdef GSSEAP_DEBUG
index dc0c35e..46282e8 100644 (file)
@@ -129,6 +129,15 @@ cleanup:
     return major;
 }
 
+static int stringEmpty(const char * s)
+{
+    if (s == NULL)
+      return 1;
+    if (strlen(s) > 0)
+       return 0;
+    return 1;
+}
+
 OM_uint32
 libMoonshotResolveInitiatorCred(OM_uint32 *minor,
                                 gss_cred_id_t cred,
@@ -194,7 +203,7 @@ libMoonshotResolveInitiatorCred(OM_uint32 *minor,
     gss_release_buffer(&tmpMinor, &cred->subjectNameConstraint);
     gss_release_buffer(&tmpMinor, &cred->subjectAltNameConstraint);
 
-    if (serverCertificateHash != NULL) {
+    if (!stringEmpty(serverCertificateHash)) {
         size_t len = strlen(serverCertificateHash);
 
         #define HASH_PREFIX             "hash://server/sha256/"
@@ -213,13 +222,13 @@ libMoonshotResolveInitiatorCred(OM_uint32 *minor,
         ((char *)cred->caCertificate.value)[HASH_PREFIX_LEN + len] = '\0';
 
         cred->caCertificate.length = HASH_PREFIX_LEN + len;
-    } else if (caCertificate != NULL) {
+    } else if (!stringEmpty(caCertificate)) {
         makeStringBufferOrCleanup(caCertificate, &cred->caCertificate);
     }
 
-    if (subjectNameConstraint != NULL)
+    if (!stringEmpty(subjectNameConstraint))
         makeStringBufferOrCleanup(subjectNameConstraint, &cred->subjectNameConstraint);
-    if (subjectAltNameConstraint != NULL)
+    if (!stringEmpty(subjectAltNameConstraint))
         makeStringBufferOrCleanup(subjectAltNameConstraint, &cred->subjectAltNameConstraint);
 
 cleanup: