From 0489df95fc5ab2c84cd7830df97942a874e431d9 Mon Sep 17 00:00:00 2001 From: Thomas Guyot-Sionnest Date: Wed, 20 May 2009 01:05:35 -0400 Subject: check_http: Add SSL/TLS hostname extension support (SNI) - (#1939022 - Joe Presbrey) --- plugins/sslutils.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'plugins/sslutils.c') diff --git a/plugins/sslutils.c b/plugins/sslutils.c index 1d4ef94a..aa571b6c 100644 --- a/plugins/sslutils.c +++ b/plugins/sslutils.c @@ -35,7 +35,11 @@ static SSL_CTX *c=NULL; static SSL *s=NULL; static int initialized=0; -int np_net_ssl_init (int sd){ +int np_net_ssl_init (int sd) { + return np_net_ssl_init_with_hostname(sd, NULL); +} + +int np_net_ssl_init_with_hostname (int sd, char *host_name) { if (!initialized) { /* Initialize SSL context */ SSLeay_add_ssl_algorithms (); @@ -48,6 +52,10 @@ int np_net_ssl_init (int sd){ return STATE_CRITICAL; } if ((s = SSL_new (c)) != NULL){ +#ifdef SSL_set_tlsext_host_name + if (host_name != NULL) + SSL_set_tlsext_host_name(s, host_name); +#endif SSL_set_fd (s, sd); if (SSL_connect(s) == 1){ return OK; @@ -65,6 +73,9 @@ int np_net_ssl_init (int sd){ void np_net_ssl_cleanup (){ if(s){ +#ifdef SSL_set_tlsext_host_name + SSL_set_tlsext_host_name(s, NULL); +#endif SSL_shutdown (s); SSL_free (s); if(c) { -- cgit v1.2.3-74-g34f1