Commit 7776df24 authored by Deomid Ryabkov's avatar Deomid Ryabkov Committed by Cesanta Bot

Enable server name verification on mbedTLS

PUBLISHED_FROM=54774944d5402a5d6a351b4609428940c0ad20ea
parent e17fdcb0
...@@ -4370,10 +4370,6 @@ enum mg_ssl_if_result mg_ssl_if_conn_init( ...@@ -4370,10 +4370,6 @@ enum mg_ssl_if_result mg_ssl_if_conn_init(
return MG_SSL_ERROR; return MG_SSL_ERROR;
} }
if (params->server_name != NULL) {
/* TODO(rojer): Implement server name verification on mbedTLS. */
}
mg_set_cipher_list(ctx, NULL); mg_set_cipher_list(ctx, NULL);
if (!(nc->flags & MG_F_LISTENING)) { if (!(nc->flags & MG_F_LISTENING)) {
...@@ -4383,6 +4379,10 @@ enum mg_ssl_if_result mg_ssl_if_conn_init( ...@@ -4383,6 +4379,10 @@ enum mg_ssl_if_result mg_ssl_if_conn_init(
MG_SET_PTRPTR(err_msg, "Failed to create SSL session"); MG_SET_PTRPTR(err_msg, "Failed to create SSL session");
return MG_SSL_ERROR; return MG_SSL_ERROR;
} }
if (params->server_name != NULL &&
mbedtls_ssl_set_hostname(ctx->ssl, params->server_name) != 0) {
return MG_SSL_ERROR;
}
} }
nc->flags |= MG_F_SSL; nc->flags |= MG_F_SSL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment