mirror of
https://github.com/cesanta/mongoose.git
synced 2024-12-31 01:13:01 +08:00
Honor hostname validation for openssl
This commit is contained in:
parent
1bc81df00e
commit
b78ced4fa9
@ -4588,6 +4588,13 @@ void mg_tls_init(struct mg_connection *c, struct mg_tls_opts *opts) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (opts->srvname.len > 0) {
|
||||||
|
char mem[128], *buf = mem;
|
||||||
|
size_t len = mg_asprintf(&buf, sizeof(mem), "%.*s", (int) opts->srvname.len,
|
||||||
|
opts->srvname.ptr);
|
||||||
|
X509_VERIFY_PARAM_set1_host(SSL_get0_param(tls->ssl), buf, len);
|
||||||
|
if (buf != mem) free(buf);
|
||||||
|
}
|
||||||
if (opts->ciphers != NULL) SSL_set_cipher_list(tls->ssl, opts->ciphers);
|
if (opts->ciphers != NULL) SSL_set_cipher_list(tls->ssl, opts->ciphers);
|
||||||
if (opts->srvname.len > 0) {
|
if (opts->srvname.len > 0) {
|
||||||
char mem[128], *buf = mem;
|
char mem[128], *buf = mem;
|
||||||
|
@ -88,6 +88,13 @@ void mg_tls_init(struct mg_connection *c, struct mg_tls_opts *opts) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (opts->srvname.len > 0) {
|
||||||
|
char mem[128], *buf = mem;
|
||||||
|
size_t len = mg_asprintf(&buf, sizeof(mem), "%.*s", (int) opts->srvname.len,
|
||||||
|
opts->srvname.ptr);
|
||||||
|
X509_VERIFY_PARAM_set1_host(SSL_get0_param(tls->ssl), buf, len);
|
||||||
|
if (buf != mem) free(buf);
|
||||||
|
}
|
||||||
if (opts->ciphers != NULL) SSL_set_cipher_list(tls->ssl, opts->ciphers);
|
if (opts->ciphers != NULL) SSL_set_cipher_list(tls->ssl, opts->ciphers);
|
||||||
if (opts->srvname.len > 0) {
|
if (opts->srvname.len > 0) {
|
||||||
char mem[128], *buf = mem;
|
char mem[128], *buf = mem;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user