}
ret = 0; /* DH params not found */
+
+ /* Clear openssl global errors stack */
+ ERR_clear_error();
end:
if (dh)
DH_free(dh);
}
}
#endif
+ ERR_clear_error();
}
if (global.tune.ssllifetime)
return 1;
out_error:
+ /* Clear openssl global errors stack */
+ ERR_clear_error();
+
/* free resumed session if exists */
if (objt_server(conn->target) && objt_server(conn->target)->ssl_ctx.reused_sess) {
SSL_SESSION_free(objt_server(conn->target)->ssl_ctx.reused_sess);
ret = SSL_read(conn->xprt_ctx, bi_end(buf), try);
if (conn->flags & CO_FL_ERROR) {
/* CO_FL_ERROR may be set by ssl_sock_infocbk */
- break;
+ goto out_error;
}
if (ret > 0) {
buf->i += ret;
try = count;
}
else if (ret == 0) {
+ ret = SSL_get_error(conn->xprt_ctx, ret);
+ if (ret != SSL_ERROR_ZERO_RETURN) {
+ /* Clear openssl global errors stack */
+ ERR_clear_error();
+ }
goto read0;
}
else {
conn_sock_read0(conn);
return done;
out_error:
+ /* Clear openssl global errors stack */
+ ERR_clear_error();
+
conn->flags |= CO_FL_ERROR;
return done;
}
ret = SSL_write(conn->xprt_ctx, bo_ptr(buf), try);
if (conn->flags & CO_FL_ERROR) {
/* CO_FL_ERROR may be set by ssl_sock_infocbk */
- break;
+ goto out_error;
}
if (ret > 0) {
buf->o -= ret;
return done;
out_error:
+ /* Clear openssl global errors stack */
+ ERR_clear_error();
+
conn->flags |= CO_FL_ERROR;
return done;
}
-
static void ssl_sock_close(struct connection *conn) {
if (conn->xprt_ctx) {
if (conn->flags & CO_FL_HANDSHAKE)
return;
/* no handshake was in progress, try a clean ssl shutdown */
- if (clean)
- SSL_shutdown(conn->xprt_ctx);
+ if (clean && (SSL_shutdown(conn->xprt_ctx) <= 0)) {
+ /* Clear openssl global errors stack */
+ ERR_clear_error();
+ }
/* force flag on ssl to keep session in cache regardless shutdown result */
SSL_set_shutdown(conn->xprt_ctx, SSL_SENT_SHUTDOWN);