Skip to content

Commit 1b9c0ad

Browse files
committed
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.
1 parent 9bf698d commit 1b9c0ad

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

librabbitmq/amqp_openssl_hostname_validation.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ static amqp_hostname_validation_result amqp_matches_common_name(
7979
}
8080

8181
// Compare expected hostname with the CN
82-
if (strcasecmp(hostname, common_name_str) == 0) {
82+
if (amqp_hostcheck(common_name_str, hostname) == AMQP_HCR_MATCH) {
8383
return AMQP_HVR_MATCH_FOUND;
8484
} else {
8585
return AMQP_HVR_MATCH_NOT_FOUND;
@@ -126,7 +126,7 @@ static amqp_hostname_validation_result amqp_matches_subject_alternative_name(
126126
result = AMQP_HVR_MALFORMED_CERTIFICATE;
127127
break;
128128
} else { // Compare expected hostname with the DNS name
129-
if (amqp_hostcheck(hostname, dns_name) == 0) {
129+
if (amqp_hostcheck(dns_name, hostname) == AMQP_HCR_MATCH) {
130130
result = AMQP_HVR_MATCH_FOUND;
131131
break;
132132
}

0 commit comments

Comments
 (0)