[Nagiosplug-checkins] SF.net SVN: nagiosplug:[2189] nagiosplug/trunk

dermoth at users.sourceforge.net dermoth at users.sourceforge.net
Fri May 1 11:19:23 CEST 2009


Revision: 2189
          http://nagiosplug.svn.sourceforge.net/nagiosplug/?rev=2189&view=rev
Author:   dermoth
Date:     2009-05-01 09:19:23 +0000 (Fri, 01 May 2009)

Log Message:
-----------
Fixed crash from check_nt when -H unspecified or given multiple times (sf.net #2731755, debian #521097)

From: Matthias Eble <psychotrahe at gmx.de>

Modified Paths:
--------------
    nagiosplug/trunk/NEWS
    nagiosplug/trunk/plugins/check_nt.c
    nagiosplug/trunk/plugins/tests/check_nt.t

Modified: nagiosplug/trunk/NEWS
===================================================================
--- nagiosplug/trunk/NEWS	2009-04-02 23:26:46 UTC (rev 2188)
+++ nagiosplug/trunk/NEWS	2009-05-01 09:19:23 UTC (rev 2189)
@@ -23,6 +23,7 @@
 	check_http --onredirect=sticky follows using the same IP address (sf.net #2550208)
 	check_http --onredirect=stickyport also follows the same port
 	Fixed coredump from check_nt when invalid drive is specified (#2179754 - Olli Hauer)
+	Fixed crash from check_nt when -H unspecified or given multiple times (sf.net #2731755, debian #521097)
 	Fixed passing of quotes in OID for check_snmp (#1985230 - Jan Wagner, patch by John Barbuto)
 	Fixed check_http sending HTTP/1.0 with v1.1 headers (#2638765)
 	Fixed check_http not timing-out on redirects

Modified: nagiosplug/trunk/plugins/check_nt.c
===================================================================
--- nagiosplug/trunk/plugins/check_nt.c	2009-04-02 23:26:46 UTC (rev 2188)
+++ nagiosplug/trunk/plugins/check_nt.c	2009-05-01 09:19:23 UTC (rev 2189)
@@ -522,7 +522,6 @@
 				print_revision(progname, NP_VERSION);
 				exit(STATE_OK);
 			case 'H': /* hostname */
-				if (server_address)	free(server_address);
 				server_address = optarg;
 				break;
 			case 's': /* password */
@@ -585,6 +584,8 @@
 			}
 
 	}
+	if (server_address == NULL)
+		usage4 (_("You must provide a server address or host name"));
 
 	if (vars_to_check==CHECK_NONE)
 		return ERROR;

Modified: nagiosplug/trunk/plugins/tests/check_nt.t
===================================================================
--- nagiosplug/trunk/plugins/tests/check_nt.t	2009-04-02 23:26:46 UTC (rev 2188)
+++ nagiosplug/trunk/plugins/tests/check_nt.t	2009-05-01 09:19:23 UTC (rev 2189)
@@ -59,7 +59,7 @@
 }
 
 if (-x "./check_nt") {
-	plan tests => 4;
+	plan tests => 5;
 } else {
 	plan skip_all => "No check_nt compiled";
 }
@@ -75,3 +75,6 @@
 is( $result->return_code, 3, "USEDDISKSPACE d - invalid");
 is( $result->output, "Free disk space : Invalid drive", "Output right" );
 
+$result = NPTest->testCmd( "./check_nt -v USEDDISKSPACE -l d" );
+is( $result->return_code, 3, "Fail if -H missing");
+


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Commits mailing list