This commit is contained in:
Xuan Sang LE 2018-06-26 13:40:53 +02:00
parent 44e67913b5
commit 181ee44a51
2 changed files with 9 additions and 6 deletions

View File

@ -52,8 +52,10 @@ void configure_context(SSL_CTX *ctx)
SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv2|SSL_OP_NO_TICKET); SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv2|SSL_OP_NO_TICKET);
SSL_CTX_set_session_id_context(ctx, (void *)&ssl_session_ctx_id, sizeof(ssl_session_ctx_id)); SSL_CTX_set_session_id_context(ctx, (void *)&ssl_session_ctx_id, sizeof(ssl_session_ctx_id));
/* Set the key and cert */ /* Set the key and cert */
if (SSL_CTX_use_certificate_file(ctx, server_config.sslcert, SSL_FILETYPE_PEM) <= 0) { /* use the full chain bundle of certificate */
ERR_print_errors_fp(stderr); //if (SSL_CTX_use_certificate_file(ctx, server_config.sslcert, SSL_FILETYPE_PEM) <= 0) {
if (SSL_CTX_use_certificate_chain_file(ctx, server_config.sslcert) <= 0) {
ERR_print_errors_fp(stderr);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }

View File

@ -87,10 +87,10 @@ int antd_send(void *src, const void* data, int len)
#ifdef USE_OPENSSL #ifdef USE_OPENSSL
} }
#endif #endif
if(ret <= 0) /*if(ret <= 0)
{ {
antd_close(src); antd_close(src);
} }*/
return ret; return ret;
} }
int antd_recv(void *src, void* data, int len) int antd_recv(void *src, void* data, int len)
@ -111,10 +111,10 @@ int antd_recv(void *src, void* data, int len)
#ifdef USE_OPENSSL #ifdef USE_OPENSSL
} }
#endif #endif
if(ret == 0) /*if(ret == 0)
{ {
antd_close(src); antd_close(src);
} }*/
return ret; return ret;
} }
int antd_close(void* src) int antd_close(void* src)
@ -136,6 +136,7 @@ int antd_close(void* src)
server_config.connection--; server_config.connection--;
LOG("Remaining connection %d\n", server_config.connection); LOG("Remaining connection %d\n", server_config.connection);
free(src); free(src);
src = NULL;
return ret; return ret;
} }
int __ti(void* client,int data) int __ti(void* client,int data)