mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-15 10:06:55 +00:00
MINOR: ssl_sock: implement and use prepare_srv()/destroy_srv()
Now we can simply check the transport layer at run time and decide whether or not to initialize or destroy these entries. This removes other ifdefs and includes from cfgparse.c, haproxy.c and hlua.c.
This commit is contained in:
parent
d84dab733a
commit
17d4538044
@ -84,11 +84,6 @@
|
||||
#include <proto/task.h>
|
||||
#include <proto/tcp_rules.h>
|
||||
|
||||
#ifdef USE_OPENSSL
|
||||
#include <types/ssl_sock.h>
|
||||
#include <proto/ssl_sock.h>
|
||||
#include <proto/shctx.h>
|
||||
#endif /*USE_OPENSSL */
|
||||
|
||||
/* This is the SSLv3 CLIENT HELLO packet used in conjunction with the
|
||||
* ssl-hello-chk option to ensure that the remote server speaks SSL.
|
||||
@ -8286,10 +8281,11 @@ out_uri_auth_compat:
|
||||
newsrv->minconn = newsrv->maxconn;
|
||||
}
|
||||
|
||||
#ifdef USE_OPENSSL
|
||||
if (newsrv->use_ssl || newsrv->check.use_ssl)
|
||||
cfgerr += ssl_sock_prepare_srv_ctx(newsrv);
|
||||
#endif /* USE_OPENSSL */
|
||||
/* this will also properly set the transport layer for prod and checks */
|
||||
if (newsrv->use_ssl || newsrv->check.use_ssl) {
|
||||
if (xprt_get(XPRT_SSL) && xprt_get(XPRT_SSL)->prepare_srv)
|
||||
cfgerr += xprt_get(XPRT_SSL)->prepare_srv(newsrv);
|
||||
}
|
||||
|
||||
/* set the check type on the server */
|
||||
newsrv->check.type = curproxy->options2 & PR_O2_CHK_ANY;
|
||||
|
@ -1446,10 +1446,11 @@ static void deinit(void)
|
||||
free(s->agent.bo);
|
||||
free(s->agent.send_string);
|
||||
free((char*)s->conf.file);
|
||||
#ifdef USE_OPENSSL
|
||||
if (s->use_ssl || s->check.use_ssl)
|
||||
ssl_sock_free_srv_ctx(s);
|
||||
#endif
|
||||
|
||||
if (s->use_ssl || s->check.use_ssl) {
|
||||
if (xprt_get(XPRT_SSL) && xprt_get(XPRT_SSL)->destroy_srv)
|
||||
xprt_get(XPRT_SSL)->destroy_srv(s);
|
||||
}
|
||||
free(s);
|
||||
s = s_next;
|
||||
}/* end while(s) */
|
||||
|
@ -48,7 +48,6 @@
|
||||
#include <proto/server.h>
|
||||
#include <proto/session.h>
|
||||
#include <proto/stream.h>
|
||||
#include <proto/ssl_sock.h>
|
||||
#include <proto/stream_interface.h>
|
||||
#include <proto/task.h>
|
||||
#include <proto/tcp_rules.h>
|
||||
@ -7697,7 +7696,8 @@ void hlua_init(void)
|
||||
}
|
||||
|
||||
/* Initialize SSL server. */
|
||||
ssl_sock_prepare_srv_ctx(&socket_ssl);
|
||||
if (socket_ssl.xprt->prepare_srv)
|
||||
socket_ssl.xprt->prepare_srv(&socket_ssl);
|
||||
#endif
|
||||
|
||||
RESET_SAFE_LJMP(gL.T);
|
||||
|
@ -6660,6 +6660,8 @@ static struct xprt_ops ssl_sock = {
|
||||
.init = ssl_sock_init,
|
||||
.prepare_bind_conf = ssl_sock_prepare_bind_conf,
|
||||
.destroy_bind_conf = ssl_sock_destroy_bind_conf,
|
||||
.prepare_srv = ssl_sock_prepare_srv_ctx,
|
||||
.destroy_srv = ssl_sock_free_srv_ctx,
|
||||
.name = "SSL",
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user