check_tcp and check_smtp: fixing duplicate messages at cert errors

This commit is contained in:
Jan Wagner 2012-02-21 14:04:16 +00:00
parent 9f8b903c22
commit c79d5ca02d
3 changed files with 56 additions and 0 deletions

4
debian/changelog vendored
View file

@ -4,6 +4,10 @@ nagios-plugins (1.4.15-6) UNRELEASED; urgency=low
* Add '-w %d' as ping argument for check_ping on non-linux plattforms, as
inetutils-ping is now supporting this, thanks Guillem Jover for bringing
this up (Closes: #655023)
* Adding 17_check_smtp_fix_duplicate_cert_message.dpatch and
17_check_tcp_fix_duplicate_cert_message.dpatch (Closes: #654682), to fix
duplicate messages when certificate errors occures, thanks Sebastian Harl
for reporting
-- Jan Wagner <waja@cyconet.org> Wed, 07 Sep 2011 15:33:55 +0200

View file

@ -0,0 +1,24 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 17_check_smtp_fix_duplicate_cert_message.dpatch
## From 4d06603060fc1233861b164870f0d3a2e0d8d2eb Fri, 15 Jul 2011 20:19:15 +0000 (+0100)
## From: Ton Voon <ton.voon@opsera.com>
## Date: Tue, 6 Sep 2011 23:20:21 -0400
## Subject: [PATCH] Fix check_smtp and check_tcp where duplicate messages were displayed for certificate...
## X-Git-Url: http://nagiosplug.git.sourceforge.net/git/gitweb.cgi?p=nagiosplug/nagiosplug;a=commitdiff_plain;h=4d06603060fc1233861b164870f0d3a2e0d8d2eb
##
## DP: Fix check_smtp where duplicate messages were displayed for certificate errors
@DPATCH@
--- 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;
}

View file

@ -0,0 +1,28 @@
#! /bin/sh /usr/share/dpatch/dpatch-run
## 17_check_tcp_fix_duplicate_cert_message.dpatch
## From 4d06603060fc1233861b164870f0d3a2e0d8d2eb Fri, 15 Jul 2011 20:19:15 +0000 (+0100)
## From: Ton Voon <ton.voon@opsera.com>
## Date: Tue, 6 Sep 2011 23:20:21 -0400
## Subject: [PATCH] Fix check_smtp and check_tcp where duplicate messages were displayed for certificate...
## X-Git-Url: http://nagiosplug.git.sourceforge.net/git/gitweb.cgi?p=nagiosplug/nagiosplug;a=commitdiff_plain;h=4d06603060fc1233861b164870f0d3a2e0d8d2eb
##
## DP: Fix check_tcp where duplicate messages were displayed for certificate errors
@DPATCH@
--- 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;