Fossil SCM
Fix src/http_ssl.c in [6753e74e26c9167c] so that it works with older versions of OpenSSL found on archaic platforms that cannot upgrade.
Commit
a04df47528b150f5e5dc4bf4235b05be8e6af3e3b42a3d3abf37afb63b8d9c84
Parent
2f5b53565d98f1b…
1 file changed
+5
+5
| --- src/http_ssl.c | ||
| +++ src/http_ssl.c | ||
| @@ -457,17 +457,22 @@ | ||
| 457 | 457 | ** Return true if zHost is an IPv4 or IPv6 address. A certificate |
| 458 | 458 | ** lists an IP address separately from its DNS names, and RFC 6066 does not |
| 459 | 459 | ** permit an IP address as the TLS server name. |
| 460 | 460 | */ |
| 461 | 461 | static int ssl_host_is_ip_address(const char *zHost){ |
| 462 | +#if OPENSSL_VERSION_NUMBER >= 0x010002000 | |
| 462 | 463 | ASN1_OCTET_STRING *pIp = a2i_IPADDRESS(zHost); |
| 463 | 464 | if( pIp==0 ){ |
| 464 | 465 | ERR_clear_error(); |
| 465 | 466 | return 0; |
| 466 | 467 | } |
| 467 | 468 | ASN1_OCTET_STRING_free(pIp); |
| 468 | 469 | return 1; |
| 470 | +#else | |
| 471 | + (void)zHost; | |
| 472 | + return 0; /* old OpenSSL: IP-vs-name distinction is never used */ | |
| 473 | +#endif | |
| 469 | 474 | } |
| 470 | 475 | |
| 471 | 476 | /* |
| 472 | 477 | ** Return true if zHost contains a byte outside ASCII. RFC 6066 permits |
| 473 | 478 | ** only an ASCII DNS name as the TLS server name, so an internationalized |
| 474 | 479 |
| --- src/http_ssl.c | |
| +++ src/http_ssl.c | |
| @@ -457,17 +457,22 @@ | |
| 457 | ** Return true if zHost is an IPv4 or IPv6 address. A certificate |
| 458 | ** lists an IP address separately from its DNS names, and RFC 6066 does not |
| 459 | ** permit an IP address as the TLS server name. |
| 460 | */ |
| 461 | static int ssl_host_is_ip_address(const char *zHost){ |
| 462 | ASN1_OCTET_STRING *pIp = a2i_IPADDRESS(zHost); |
| 463 | if( pIp==0 ){ |
| 464 | ERR_clear_error(); |
| 465 | return 0; |
| 466 | } |
| 467 | ASN1_OCTET_STRING_free(pIp); |
| 468 | return 1; |
| 469 | } |
| 470 | |
| 471 | /* |
| 472 | ** Return true if zHost contains a byte outside ASCII. RFC 6066 permits |
| 473 | ** only an ASCII DNS name as the TLS server name, so an internationalized |
| 474 |
| --- src/http_ssl.c | |
| +++ src/http_ssl.c | |
| @@ -457,17 +457,22 @@ | |
| 457 | ** Return true if zHost is an IPv4 or IPv6 address. A certificate |
| 458 | ** lists an IP address separately from its DNS names, and RFC 6066 does not |
| 459 | ** permit an IP address as the TLS server name. |
| 460 | */ |
| 461 | static int ssl_host_is_ip_address(const char *zHost){ |
| 462 | #if OPENSSL_VERSION_NUMBER >= 0x010002000 |
| 463 | ASN1_OCTET_STRING *pIp = a2i_IPADDRESS(zHost); |
| 464 | if( pIp==0 ){ |
| 465 | ERR_clear_error(); |
| 466 | return 0; |
| 467 | } |
| 468 | ASN1_OCTET_STRING_free(pIp); |
| 469 | return 1; |
| 470 | #else |
| 471 | (void)zHost; |
| 472 | return 0; /* old OpenSSL: IP-vs-name distinction is never used */ |
| 473 | #endif |
| 474 | } |
| 475 | |
| 476 | /* |
| 477 | ** Return true if zHost contains a byte outside ASCII. RFC 6066 permits |
| 478 | ** only an ASCII DNS name as the TLS server name, so an internationalized |
| 479 |