Commit 5a19135c authored by Deomid Ryabkov's avatar Deomid Ryabkov Committed by Cesanta Bot

Ignore SL_ENOPROTOOPT w/ DOMAIN_NAME_VERIFICATION

Domain name verification feature was added in NWP service pack
(reported version: 2.6.0.5). Older versions do not support it.
There's not much we can do about it, so we just ignore the error.

PUBLISHED_FROM=9495250de1945aae4f2bdf7dddcd7bf1248e24c2
parent 290e5f83
...@@ -11167,7 +11167,7 @@ int sl_set_ssl_opts(struct mg_connection *nc) { ...@@ -11167,7 +11167,7 @@ int sl_set_ssl_opts(struct mg_connection *nc) {
err = sl_SetSockOpt(nc->sock, SL_SOL_SOCKET, err = sl_SetSockOpt(nc->sock, SL_SOL_SOCKET,
SL_SO_SECURE_FILES_CERTIFICATE_FILE_NAME, nc->ssl_cert, SL_SO_SECURE_FILES_CERTIFICATE_FILE_NAME, nc->ssl_cert,
strlen(nc->ssl_cert)); strlen(nc->ssl_cert));
DBG(("CERTIFICATE_FILE_NAME %s -> %d", nc->ssl_cert, nc->err)); DBG(("CERTIFICATE_FILE_NAME %s -> %d", nc->ssl_cert, err));
if (err != 0) return err; if (err != 0) return err;
err = sl_SetSockOpt(nc->sock, SL_SOL_SOCKET, err = sl_SetSockOpt(nc->sock, SL_SOL_SOCKET,
SL_SO_SECURE_FILES_PRIVATE_KEY_FILE_NAME, nc->ssl_key, SL_SO_SECURE_FILES_PRIVATE_KEY_FILE_NAME, nc->ssl_key,
...@@ -11183,7 +11183,7 @@ int sl_set_ssl_opts(struct mg_connection *nc) { ...@@ -11183,7 +11183,7 @@ int sl_set_ssl_opts(struct mg_connection *nc) {
err = sl_SetSockOpt(nc->sock, SL_SOL_SOCKET, err = sl_SetSockOpt(nc->sock, SL_SOL_SOCKET,
SL_SO_SECURE_FILES_CA_FILE_NAME, nc->ssl_ca_cert, SL_SO_SECURE_FILES_CA_FILE_NAME, nc->ssl_ca_cert,
strlen(nc->ssl_ca_cert)); strlen(nc->ssl_ca_cert));
DBG(("CA_FILE_NAME %s -> %d", nc->ssl_ca_cert, nc->err)); DBG(("CA_FILE_NAME %s -> %d", nc->ssl_ca_cert, err));
if (err != 0) return err; if (err != 0) return err;
} }
MG_FREE(nc->ssl_ca_cert); MG_FREE(nc->ssl_ca_cert);
...@@ -11193,8 +11193,11 @@ int sl_set_ssl_opts(struct mg_connection *nc) { ...@@ -11193,8 +11193,11 @@ int sl_set_ssl_opts(struct mg_connection *nc) {
err = sl_SetSockOpt(nc->sock, SL_SOL_SOCKET, err = sl_SetSockOpt(nc->sock, SL_SOL_SOCKET,
SO_SECURE_DOMAIN_NAME_VERIFICATION, nc->ssl_server_name, SO_SECURE_DOMAIN_NAME_VERIFICATION, nc->ssl_server_name,
strlen(nc->ssl_server_name)); strlen(nc->ssl_server_name));
DBG(("DOMAIN_NAME_VERIFICATION %s -> %d", nc->ssl_server_name, nc->err)); DBG(("DOMAIN_NAME_VERIFICATION %s -> %d", nc->ssl_server_name, err));
if (err != 0) return err; /* Domain name verificationw as added in a NWP service pack, older versions
* return SL_ENOPROTOOPT. There isn't much we can do about it, so we ignore
* the error. */
if (err != 0 && err != SL_ENOPROTOOPT) return err;
MG_FREE(nc->ssl_server_name); MG_FREE(nc->ssl_server_name);
nc->ssl_server_name = NULL; nc->ssl_server_name = NULL;
} }
......
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