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,
MoonshotError *error = NULL;
if (cred->name != GSS_C_NO_NAME) {
- major = gssEapExportName(minor, cred->name, &initiator);
+ major = gssEapDisplayName(minor, cred->name, &initiator, NULL);
if (GSS_ERROR(major))
goto cleanup;
}
if (targetName != GSS_C_NO_NAME) {
- major = gssEapExportName(minor, targetName, &target);
+ major = gssEapDisplayName(minor, targetName, &target, NULL);
if (GSS_ERROR(major))
goto cleanup;
}
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/"
((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: