[nagiosplug] Fix check_smtp and check_tcp where duplicate ...

"Ton Voon" <[email protected]> Fri, 15 Jul 2011 20:19:57 +0000
Newsgroups gmane.network.nagios.plugins.cvs
Message-ID <[email protected]>
 Module: nagiosplug
 Branch: master
 Commit: 4d06603060fc1233861b164870f0d3a2e0d8d2eb
 Author: Ton Voon <[email protected]>
   Date: Fri Jul 15 21:19:15 2011 +0100
    URL: http://nagiosplug.git.sf.net/git/gitweb.cgi?p=nagiosplug/nagiosplug;a=commit;h=4d06603

Fix check_smtp and check_tcp where duplicate messages were displayed for certificate errors (Opsview team)

---

 NEWS                 |    1 +
 plugins/check_smtp.c |    3 ---
 plugins/check_tcp.c  |    5 +----
 3 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/NEWS b/NEWS
index 9ff8755..fd9b8e8 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,7 @@ This file documents the major additions and syntax changes between releases.
 	Fix check_ldap overriding the port when --ssl was specified after -p
 	Fix check_procs where regex input of '|' would get displayed in output - now replaced with ','
 	Fix segfault in check_host when hostname returns multiple IP addresses (Sebastian Harl)
+	Fix check_smtp and check_tcp where duplicate messages were displayed for certificate errors
 
 1.4.15 27th July 2010
 	ENHANCEMENTS
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c
index 6c5994c..494bc2c 100644
--- a/plugins/check_smtp.c
+++ b/plugins/check_smtp.c
@@ -276,9 +276,6 @@ main (int argc, char **argv)
 #  ifdef USE_OPENSSL
 		  if ( check_cert ) {
 		    result = np_net_ssl_check_cert(days_till_exp);
-		    if(result != STATE_OK){
-		      printf ("%s\n", _("CRITICAL - Cannot retrieve server certificate."));
-		    }
 		    my_close();
 		    return result;
 		  }
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c
index 178bd56..d3c92a4 100644
--- a/plugins/check_tcp.c
+++ b/plugins/check_tcp.c
@@ -236,12 +236,9 @@ main (int argc, char **argv)
 		result = np_net_ssl_init(sd);
 		if (result == STATE_OK && check_cert == TRUE) {
 			result = np_net_ssl_check_cert(days_till_exp);
-			if(result != STATE_OK) {
-				printf(_("CRITICAL - Cannot retrieve server certificate.\n"));
-			}
 		}
 	}
-	if(result != STATE_OK){
+	if(result != STATE_OK || check_cert == TRUE){
 		np_net_ssl_cleanup();
 		if(sd) close(sd);
 		return result;


------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric 
Ries, the creator of the Lean Startup Methodology on "Lean Startup 
Secrets Revealed." This video shows you how to validate your ideas, 
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev