Revision: 1887
http://nagiosplug.svn.sourceforge.net/nagiosplug/?rev=1887&view=rev
Author: dermoth
Date: 2008-01-05 06:09:29 -0800 (Sat, 05 Jan 2008)
Log Message:
-----------
Fix Bug #1862300: check_ntp_time segfault in 1.4.11 (Also apply to check_ntp)
Modified Paths:
--------------
nagiosplug/trunk/NEWS
nagiosplug/trunk/plugins/check_ntp.c
nagiosplug/trunk/plugins/check_ntp_time.c
Modified: nagiosplug/trunk/NEWS
===================================================================
--- nagiosplug/trunk/NEWS 2008-01-05 01:06:36 UTC (rev 1886)
+++ nagiosplug/trunk/NEWS 2008-01-05 14:09:29 UTC (rev 1887)
@@ -5,6 +5,7 @@
check_tcp now returns UNKNOWN with invalid hostname
New check_icmp -s option to specify the source IP address
check_dns now sorts addresses for testing results for more than one returned IP (Matthias Urlichs)
+ Fix segfault in check_ntp_time and (deprecated) check_ntp. (Bug #1862300)
1.4.11 13th December 2007
Fixed check_http regression in 1.4.10 where following redirects to
Modified: nagiosplug/trunk/plugins/check_ntp.c
===================================================================
--- nagiosplug/trunk/plugins/check_ntp.c 2008-01-05 01:06:36 UTC (rev 1886)
+++ nagiosplug/trunk/plugins/check_ntp.c 2008-01-05 14:09:29 UTC (rev 1887)
@@ -329,7 +329,7 @@
/* if we haven't reached the current list's end, move everyone
* over one to the right, and insert the new candidate */
if(i<csize){
- for(j=5; j>i; j--){
+ for(j=4; j>i; j--){
candidates[j]=candidates[j-1];
}
}
@@ -392,6 +392,7 @@
servers=(ntp_server_results*)malloc(sizeof(ntp_server_results)*num_hosts);
if(servers==NULL) die(STATE_UNKNOWN, "can not allocate server array");
memset(servers, 0, sizeof(ntp_server_results)*num_hosts);
+ DBG(printf("Found %d peers to check\n", num_hosts));
/* setup each socket for writing, and the corresponding struct pollfd */
ai_tmp=ai;
@@ -837,11 +838,11 @@
printf ("Copyright (c) 2006 Sean Finney\n");
printf (COPYRIGHT, copyright, email);
-
- printf ("%s\n", _("This plugin checks the selected ntp server"));
- printf ("\n\n");
-
+ printf ("%s\n", _("This plugin checks the selected ntp server"));
+
+ printf ("\n\n");
+
print_usage();
printf (_(UT_HELP_VRSN));
printf (_(UT_HOST_PORT), 'p', "123");
@@ -871,11 +872,17 @@
printf(" %s\n", ("./check_ntp -H ntpserv -w 0.5 -c 1 -j -1:100 -k -1:200"));
printf (_(UT_SUPPORT));
+
+ printf("\n");
+ printf ("%s\n", _("WARNING: check_ntp is deprecated. Please use check_ntp_peer or"));
+ printf ("%s\n\n", _("check_ntp_time istead."));
}
void
print_usage(void)
{
- printf (_("Usage:"));
- printf(" %s -H <host> [-w <warn>] [-c <crit>] [-j <warn>] [-k <crit>] [-v verbose]\n", progname);
+ printf ("%s\n", _("WARNING: check_ntp is deprecated. Please use check_ntp_peer or"));
+ printf ("%s\n\n", _("check_ntp_time istead."));
+ printf (_("Usage:"));
+ printf(" %s -H <host> [-w <warn>] [-c <crit>] [-j <warn>] [-k <crit>] [-v verbose]\n", progname);
}
Modified: nagiosplug/trunk/plugins/check_ntp_time.c
===================================================================
--- nagiosplug/trunk/plugins/check_ntp_time.c 2008-01-05 01:06:36 UTC (rev 1886)
+++ nagiosplug/trunk/plugins/check_ntp_time.c 2008-01-05 14:09:29 UTC (rev 1887)
@@ -274,7 +274,7 @@
/* if we haven't reached the current list's end, move everyone
* over one to the right, and insert the new candidate */
if(i<csize){
- for(j=5; j>i; j--){
+ for(j=4; j>i; j--){
candidates[j]=candidates[j-1];
}
}
@@ -337,6 +337,7 @@
servers=(ntp_server_results*)malloc(sizeof(ntp_server_results)*num_hosts);
if(servers==NULL) die(STATE_UNKNOWN, "can not allocate server array");
memset(servers, 0, sizeof(ntp_server_results)*num_hosts);
+ DBG(printf("Found %d peers to check\n", num_hosts));
/* setup each socket for writing, and the corresponding struct pollfd */
ai_tmp=ai;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.