Subject: [PATCH] ssl fix self-singed certificate acceptation
This commit is contained in:
parent
c0eb2c3e9d
commit
76fc5fc88d
1 changed files with 10 additions and 8 deletions
18
lib/client.c
18
lib/client.c
|
@ -309,15 +309,17 @@ int lws_client_socket_service(struct libwebsocket_context *context,
|
|||
lws_latency(context, wsi,
|
||||
"SSL_get_verify_result LWS_CONNMODE..HANDSHAKE",
|
||||
n, n > 0);
|
||||
if ((n != X509_V_OK) && (
|
||||
n != X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT ||
|
||||
wsi->use_ssl != 2)) {
|
||||
|
||||
lwsl_err(
|
||||
"server's cert didn't look good %d\n", n);
|
||||
libwebsocket_close_and_free_session(context,
|
||||
wsi, LWS_CLOSE_STATUS_NOSTATUS);
|
||||
return 0;
|
||||
if (n != X509_V_OK) {
|
||||
if((n == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT || n == X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN) && wsi->use_ssl == 2) {
|
||||
lwsl_notice("accepting self-signed certificate\n");
|
||||
} else {
|
||||
lwsl_err(
|
||||
"server's cert didn't look good %d\n", n);
|
||||
libwebsocket_close_and_free_session(context,
|
||||
wsi, LWS_CLOSE_STATUS_NOSTATUS);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif /* USE_CYASSL */
|
||||
} else
|
||||
|
|
Loading…
Add table
Reference in a new issue