[Nagiosplug-checkins] nagiosplug/plugins sslutils.c,1.5,1.6
Holger Weiss
hweiss at users.sourceforge.net
Sat Jun 2 00:57:33 CEST 2007
Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv29412
Modified Files:
sslutils.c
Log Message:
Call the SSL library initialization functions only once (not for every
SSL connection).
Index: sslutils.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/sslutils.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- sslutils.c 1 Jun 2007 17:06:33 -0000 1.5
+++ sslutils.c 1 Jun 2007 22:57:31 -0000 1.6
@@ -38,15 +38,17 @@
#ifdef HAVE_SSL
static SSL_CTX *c=NULL;
static SSL *s=NULL;
+static int initialized=0;
int np_net_ssl_init (int sd){
- SSL_METHOD *m=NULL;
- /* Initialize SSL context */
- SSLeay_add_ssl_algorithms ();
- m = SSLv23_client_method ();
- SSL_load_error_strings ();
- OpenSSL_add_all_algorithms();
- if ((c = SSL_CTX_new (m)) == NULL) {
+ if (!initialized) {
+ /* Initialize SSL context */
+ SSLeay_add_ssl_algorithms ();
+ SSL_load_error_strings ();
+ OpenSSL_add_all_algorithms ();
+ initialized = 1;
+ }
+ if ((c = SSL_CTX_new (SSLv23_client_method ())) == NULL) {
printf ("%s\n", _("CRITICAL - Cannot create SSL context."));
return STATE_CRITICAL;
}
More information about the Commits
mailing list