diff options
author | Alan Antonuk <alan.antonuk@gmail.com> | 2015-11-10 22:19:55 -0800 |
---|---|---|
committer | Alan Antonuk <alan.antonuk@gmail.com> | 2015-11-10 22:19:55 -0800 |
commit | 1b9c0adbd722d849ceb451fdb4ca02e96630e2ea (patch) | |
tree | 42e66ebc9e6c1113b6dc7fe541335c6413b7b1c8 | |
parent | 9bf698d339550ca9c49b35fc000f52280be4d753 (diff) | |
download | rabbitmq-c-1b9c0adbd722d849ceb451fdb4ca02e96630e2ea.tar.gz |
Lib: use amqp_hostcheck correctly
Use amqp_hostcheck instead of strcasecmp, and pass in the correct arguments in
the right order in both SAN and CN codepaths.
-rw-r--r-- | librabbitmq/amqp_openssl_hostname_validation.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/librabbitmq/amqp_openssl_hostname_validation.c b/librabbitmq/amqp_openssl_hostname_validation.c index 5fad5f7..88a3a7e 100644 --- a/librabbitmq/amqp_openssl_hostname_validation.c +++ b/librabbitmq/amqp_openssl_hostname_validation.c @@ -79,7 +79,7 @@ static amqp_hostname_validation_result amqp_matches_common_name( } // Compare expected hostname with the CN - if (strcasecmp(hostname, common_name_str) == 0) { + if (amqp_hostcheck(common_name_str, hostname) == AMQP_HCR_MATCH) { return AMQP_HVR_MATCH_FOUND; } else { return AMQP_HVR_MATCH_NOT_FOUND; @@ -126,7 +126,7 @@ static amqp_hostname_validation_result amqp_matches_subject_alternative_name( result = AMQP_HVR_MALFORMED_CERTIFICATE; break; } else { // Compare expected hostname with the DNS name - if (amqp_hostcheck(hostname, dns_name) == 0) { + if (amqp_hostcheck(dns_name, hostname) == AMQP_HCR_MATCH) { result = AMQP_HVR_MATCH_FOUND; break; } |