mirror of
https://github.com/cesanta/mongoose.git
synced 2024-11-30 23:49:01 +08:00
Fix #1510 - wrap X509_VERIFY_PARAM_set1_host() usage inside a conditional
This commit is contained in:
parent
fde8b82b78
commit
d11173fe90
@ -4540,6 +4540,7 @@ void mg_tls_init(struct mg_connection *c, struct mg_tls_opts *opts) {
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#if OPENSSL_VERSION_NUMBER > 0x10002000L
|
||||
if (opts->srvname.len > 0) {
|
||||
char mem[128], *buf = mem;
|
||||
size_t len = mg_asprintf(&buf, sizeof(mem), "%.*s", (int) opts->srvname.len,
|
||||
@ -4547,6 +4548,7 @@ void mg_tls_init(struct mg_connection *c, struct mg_tls_opts *opts) {
|
||||
X509_VERIFY_PARAM_set1_host(SSL_get0_param(tls->ssl), buf, len);
|
||||
if (buf != mem) free(buf);
|
||||
}
|
||||
#endif
|
||||
if (opts->ciphers != NULL) SSL_set_cipher_list(tls->ssl, opts->ciphers);
|
||||
if (opts->srvname.len > 0) {
|
||||
char mem[128], *buf = mem;
|
||||
|
@ -88,6 +88,7 @@ void mg_tls_init(struct mg_connection *c, struct mg_tls_opts *opts) {
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#if OPENSSL_VERSION_NUMBER > 0x10002000L
|
||||
if (opts->srvname.len > 0) {
|
||||
char mem[128], *buf = mem;
|
||||
size_t len = mg_asprintf(&buf, sizeof(mem), "%.*s", (int) opts->srvname.len,
|
||||
@ -95,6 +96,7 @@ void mg_tls_init(struct mg_connection *c, struct mg_tls_opts *opts) {
|
||||
X509_VERIFY_PARAM_set1_host(SSL_get0_param(tls->ssl), buf, len);
|
||||
if (buf != mem) free(buf);
|
||||
}
|
||||
#endif
|
||||
if (opts->ciphers != NULL) SSL_set_cipher_list(tls->ssl, opts->ciphers);
|
||||
if (opts->srvname.len > 0) {
|
||||
char mem[128], *buf = mem;
|
||||
|
Loading…
Reference in New Issue
Block a user