Hello community, here is the log from the commit of package nagios for openSUSE:Factory checked in at 2013-01-17 09:50:15 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/nagios (Old) and /work/SRC/openSUSE:Factory/.nagios.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "nagios", Maintainer is "[email protected]" Changes: -------- --- /work/SRC/openSUSE:Factory/nagios/nagios.changes 2012-12-28 22:45:53.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.nagios.new/nagios.changes 2013-01-17 09:50:18.000000000 +0100 @@ -1,0 +2,25 @@ +Sat Jan 12 18:25:49 UTC 2013 - [email protected] + +- update to 3.4.4: + + Fixed bug #408: service checks get duplicated on reload (Eric Stanley) + + Added NULL pointer checks to CGI code. (Eric Stanley) + + Fixed buffer overflow vulnerability in CGI code. Thanks to Neohapsis + for finding this. (Eric Stanley) +- refreshed patches + +------------------------------------------------------------------- +Wed Jan 9 11:10:21 CET 2013 - [email protected] + +- added new subpackage nagios-www-dch (don't call home): + + add plain html pages to allow users to disable PHP and + loading of external references + + re-added documentation (no external link any more) + +------------------------------------------------------------------- +Tue Jan 1 15:02:49 UTC 2013 - [email protected] + +- use new rpm macros for basic user-/groupadd commands: + %%nagios_user_group_add + %%nagios_command_user_group_add + +------------------------------------------------------------------- Old: ---- nagios-3.4.3.tar.bz2 New: ---- nagios-3.0.6-docs.tar.bz2 nagios-3.4.4.tar.bz2 nagios-html-pages.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ nagios.spec ++++++ --- /var/tmp/diff_new_pack.qzU3o8/_old 2013-01-17 09:50:19.000000000 +0100 +++ /var/tmp/diff_new_pack.qzU3o8/_new 2013-01-17 09:50:19.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package nagios # -# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -20,7 +20,7 @@ Summary: The Nagios Network Monitor License: GPL-2.0+ Group: System/Monitoring -Version: 3.4.3 +Version: 3.4.4 Release: 0 Url: http://www.nagios.org/ Source0: %{name}-%{version}.tar.bz2 @@ -35,6 +35,8 @@ Source9: new_mini_epn.8 # Source10: %{name}-README.SuSE +Source11: %{name}-html-pages.tar.bz2 +Source12: %{name}-3.0.6-docs.tar.bz2 Source20: %{name}-rpmlintrc # PATCH-FIX-UPSTREAM Fixes the output of spurious $ signs in commandoutput (deb#480001) Patch2: nagios-fix_spurious_dollar_signs_added_to_command_lines.patch @@ -136,6 +138,29 @@ for the Nagios web interface. In addition, HTML documentation is included in this package. +%package www-dch +Summary: HTML and CGI files that do not call home +Group: System/Monitoring +Requires: %{name}-www = %{version} + +%description www-dch +Several CGI programs are included with Nagios in order to allow you to +view the current service status, problem history, notification history, +and log file via the web. + +Since Version 3.1, some of those CGI files and the Nagios process itself +try to detect the latest version and fetching news feeds from the upstream +server www.nagios.org. + +This additional package provides simply HTML files that do not "call +home" and also allow to run the web interface without PHP support. + +There is also an offline version of the documentation included in this +package. + +Please enable the flag "NAGIOSDCH" in the apache configuration. +Note: The HTML pages use 'side' and 'main' and frame targets. + %package devel Summary: Development files for Nagios @@ -301,39 +326,32 @@ done # we use nagios_spooldir for this test -d %{buildroot}%{nagios_localstatedir}/rw && rmdir %{buildroot}%{nagios_localstatedir}/rw +# install plain html files to allow users to use Nagios without internet connection +# and without PHP at all +pushd %{buildroot}%{nagios_datadir} >/dev/null +tar -xf %{SOURCE11} +tar -xf %{SOURCE12} +# jip: ugly at the moment +#LINES=$(echo $(wc -l %%{buildroot}%%{apache2_sysconfdir}/%%{name}.conf | awk '" " { print $1}')-2 | bc) +LINES=40 +head -n $LINES %{buildroot}%{apache2_sysconfdir}/%{name}.conf > %{buildroot}%{apache2_sysconfdir}/%{name}.conf.in +cat >> %{buildroot}%{apache2_sysconfdir}/%{name}.conf.in << EOF + <IfDefine KOHANA2> + DirectoryIndex index.html index.php + </IfDefine> +</Directory> +EOF +mv -f %{buildroot}%{apache2_sysconfdir}/%{name}.conf.in %{buildroot}%{apache2_sysconfdir}/%{name}.conf +popd >/dev/null %clean %{__rm} -rf %{buildroot} %pre # Create user and group on the system if necessary -# default group: nagios -if - getent group %{nagios_group} >/dev/null -then - : OK group %{nagios_group} already present -else - groupadd -r %{nagios_group} 2>/dev/null || : - %{nnmmsg} "Added group %{nagios_group} for package %{name}" -fi -# default group: nagcmd -if - getent group %{nagios_command_group} >/dev/null -then - : OK group %{nagios_command_group} already present -else - groupadd -r %{nagios_command_group} 2>/dev/null || : - %{nnmmsg} "Added group %{nagios_command_group} for package %{name}" -fi -# default user: nagios -if - id %{nagios_user} > /dev/null 2>&1 -then - : OK user %{nagios_user} already present -else - useradd -r -g %{nagios_group} -s /bin/false -c "User for Nagios" -d %{nagios_localstatedir} %{nagios_user} 2> /dev/null || : - %{nnmmsg} "Added user %{nagios_user} for package %{name}" -fi +%nagios_user_group_add +%nagios_command_user_group_add + # update? if [ ${1:-0} -gt 1 ]; then # in the past, group www was used as nagios_command_group - now we use the default: nagcmd @@ -454,6 +472,16 @@ fi %restart_on_update apache2 +%post www-dch +# Update ? +if [ ${1:-0} -eq 1 ]; then + if [ -x %{_sbindir}/a2enflag ]; then + # enable NAGIOSDCH flag in apache configuration + %{_sbindir}/a2enflag NAGIOSDCH >/dev/null + fi +fi +%restart_on_update apache2 + %preun www %restart_on_update apache2 @@ -506,6 +534,14 @@ %{nagios_datadir} %config(noreplace) %{apache2_sysconfdir}/%{name}.conf %attr(0640,root,%nagios_command_group) %config(missingok,noreplace) %{_sysconfdir}/%{name}/htpasswd.users +%exclude %{nagios_datadir}/*.html +%exclude %{nagios_datadir}/docs/* + +%files www-dch +%defattr(-,root,root) +%{nagios_datadir}/*.html +%dir %{nagios_datadir}/docs +%{nagios_datadir}/docs/* %files devel %defattr(-,root,root) ++++++ nagios-3.4.3.tar.bz2 -> nagios-3.4.4.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nagios/Changelog new/nagios/Changelog --- old/nagios/Changelog 2012-11-30 17:58:25.000000000 +0100 +++ new/nagios/Changelog 2013-01-12 14:21:46.000000000 +0100 @@ -2,11 +2,19 @@ Nagios 3.x Change Log ##################### +3.4.4 - 01/12/2013 +------------------ +* Reenabled check for newer versions of Nagios Core (Mike Guthrie) +* Fixed bug #408: service checks get duplicated on reload (Eric Stanley) +* Fixed bug #401: segmentation fault on Solaris when parsing unknown timeperiod directives. (Eric Stanley) +* Added NULL pointer checks to CGI code. (Eric Stanley) +* Fixed buffer overflow vulnerability in CGI code. Thanks to Neohapsis (http://archives.neohapsis.com/archives/fulldisclosure/2012-12/0108.html) for finding this. (Eric Stanley) + 3.4.3 - 11/30/2012 ------------------ -- Reverted squeue changes intended for Nagios 4 -- Reapplied all patches from 3.4.2 release -- Applied fix for pagination and sorting on status.cgi #381 (Phil Randal) +* Reverted squeue changes intended for Nagios 4 +* Reapplied all patches from 3.4.2 release +* Applied fix for pagination and sorting on status.cgi #381 (Phil Randal) 3.4.2 - 11/09/2012 ------------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nagios/base/checks.c new/nagios/base/checks.c --- old/nagios/base/checks.c 2012-06-21 12:58:41.000000000 +0200 +++ new/nagios/base/checks.c 2012-12-31 13:30:24.000000000 +0100 @@ -151,7 +151,7 @@ process_check_result_queue(check_result_path); /* read all check results that have come in... */ - while((queued_check_result = read_check_result())) { + while((queued_check_result = read_check_result(&check_result_list))) { reaped_checks++; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nagios/base/events.c new/nagios/base/events.c --- old/nagios/base/events.c 2012-04-21 17:30:17.000000000 +0200 +++ new/nagios/base/events.c 2013-01-03 22:10:27.000000000 +0100 @@ -348,6 +348,14 @@ continue; } + /* skip services whose checks are currently executing */ + if(temp_service->is_executing) { + log_debug_info(DEBUGL_EVENTS, 2, + "Service check '%s' on host '%s' is already executing.\n", + temp_service->description, temp_service->host_name); + continue; + } + /* * skip services that are already scheduled for the (near) * future from retention data, but reschedule ones that @@ -407,6 +415,10 @@ /* update status of all services (scheduled or not) */ update_service_status(temp_service, FALSE); + /* skip services whose checks are currently executing */ + if(temp_service->is_executing) + continue; + /* skip most services that shouldn't be scheduled */ if(temp_service->should_be_scheduled == FALSE) { @@ -416,6 +428,9 @@ } /* create a new service check event */ + log_debug_info(DEBUGL_EVENTS, 2, + "Scheduling check for service '%s' on host '%s'.\n", + temp_service->description, temp_service->host_name); schedule_new_event(EVENT_SERVICE_CHECK, FALSE, temp_service->next_check, FALSE, 0, NULL, TRUE, (void *)temp_service, NULL, temp_service->check_options); } @@ -505,6 +520,13 @@ continue; } + /* skip hosts whose checks are currently executing */ + if(temp_host->is_executing) { + log_debug_info(DEBUGL_EVENTS, 2, + "Host check %s is already executing.\n", temp_host->name); + continue; + } + /* skip hosts that are already scheduled for the future (from retention data), but reschedule ones that were supposed to be checked before we started */ if(temp_host->next_check > current_time) { log_debug_info(DEBUGL_EVENTS, 2, "Host is already scheduled to be checked in the future: %s\n", ctime(&temp_host->next_check)); @@ -543,6 +565,10 @@ /* update status of all hosts (scheduled or not) */ update_host_status(temp_host, FALSE); + /* skip hosts whose checks are currently executing */ + if(temp_host->is_executing) + continue; + /* skip most hosts that shouldn't be scheduled */ if(temp_host->should_be_scheduled == FALSE) { @@ -552,6 +578,8 @@ } /* schedule a new host check event */ + log_debug_info(DEBUGL_EVENTS, 2, "Scheduling check for host '%s'.\n", + temp_host->name); schedule_new_event(EVENT_HOST_CHECK, FALSE, temp_host->next_check, FALSE, 0, NULL, TRUE, (void *)temp_host, NULL, temp_host->check_options); } @@ -768,8 +796,28 @@ timed_event **event_list_tail = NULL; timed_event *new_event = NULL; + char run_time_string[MAX_DATETIME_LENGTH] = ""; + log_debug_info(DEBUGL_FUNCTIONS, 0, "schedule_new_event()\n"); + get_datetime_string(&run_time, run_time_string, MAX_DATETIME_LENGTH, + SHORT_DATE_TIME); + log_debug_info(DEBUGL_EVENTS, 0, "New Event Details:\n"); + log_debug_info(DEBUGL_EVENTS, 0, " Type: %s\n", + EVENT_TYPE_STR( event_type)); + log_debug_info(DEBUGL_EVENTS, 0, " High Priority: %s\n", + ( high_priority ? "Yes" : "No")); + log_debug_info(DEBUGL_EVENTS, 0, " Run Time: %s\n", + run_time_string); + log_debug_info(DEBUGL_EVENTS, 0, " Recurring: %s\n", + ( recurring ? "Yes" : "No")); + log_debug_info(DEBUGL_EVENTS, 0, " Event Interval: %lu\n", + event_interval); + log_debug_info(DEBUGL_EVENTS, 0, " Compensate for Time Change: %s\n", + ( compensate_for_time_change ? "Yes" : "No")); + log_debug_info(DEBUGL_EVENTS, 0, " Event Options: %d\n", + event_options); + if(high_priority == TRUE) { event_list = &event_list_high; event_list_tail = &event_list_high_tail; @@ -1232,7 +1280,7 @@ broker_timed_event(NEBTYPE_TIMEDEVENT_EXECUTE, NEBFLAG_NONE, NEBATTR_NONE, event, NULL); #endif - log_debug_info(DEBUGL_EVENTS, 0, "** Timed Event ** Type: %d, Run Time: %s", event->event_type, ctime(&event->run_time)); + log_debug_info(DEBUGL_EVENTS, 0, "** Timed Event ** Type: %s, Run Time: %s", EVENT_TYPE_STR(event->event_type), ctime(&event->run_time)); /* how should we handle the event? */ switch(event->event_type) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nagios/base/logging.c new/nagios/base/logging.c --- old/nagios/base/logging.c 2012-06-06 11:20:06.000000000 +0200 +++ new/nagios/base/logging.c 2013-01-02 15:18:04.000000000 +0100 @@ -490,6 +490,29 @@ } +/* change the ownership of the debug log. This is done so that if Nagios + receives a HUP signal, it will be owned by a user that can reopen the file */ +int chown_debug_log(uid_t uid, gid_t gid) { + + /* don't do anything if we're not actually running... */ + if(verify_config == TRUE || test_scheduling == TRUE) + return OK; + + /* don't do anything if we're not debugging */ + if(debug_level == DEBUGL_NONE) + return OK; + + if( chown(debug_file, uid, gid) < 0) { + logit(NSLOG_RUNTIME_WARNING, TRUE, + "Failed to change ownership on debug log: %s.", + strerror( errno)); + return ERROR; + } + + return OK; + } + + /* closes the debug log */ int close_debug_log(void) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nagios/base/nagios.c new/nagios/base/nagios.c --- old/nagios/base/nagios.c 2012-11-30 17:58:25.000000000 +0100 +++ new/nagios/base/nagios.c 2013-01-12 14:21:46.000000000 +0100 @@ -3,7 +3,7 @@ * NAGIOS.C - Core Program Code For Nagios * * Program: Nagios Core - * Version: 3.4.3 + * Version: 3.4.4 * License: GPL * Copyright (c) 2009-2010 Nagios Core Development Team and Community Contributors * Copyright (c) 1999-2009 Ethan Galstad @@ -814,6 +814,10 @@ /* initialize performance data */ initialize_performance_data(config_file); + /* Determine which checks are still executing so they are not + scheduled when the timing loop is initialized */ + find_executing_checks(check_result_path); + /* initialize the event timing loop */ init_timing_loop(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nagios/base/nagiostats.c new/nagios/base/nagiostats.c --- old/nagios/base/nagiostats.c 2012-11-30 17:58:25.000000000 +0100 +++ new/nagios/base/nagiostats.c 2013-01-12 14:21:46.000000000 +0100 @@ -3,7 +3,7 @@ * NAGIOSTATS.C - Displays Nagios Statistics * * Program: Nagiostats - * Version: 3.4.3 + * Version: 3.4.4 * License: GPL * Copyright (c) 2003-2008 Ethan Galstad ([email protected]) * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nagios/base/utils.c new/nagios/base/utils.c --- old/nagios/base/utils.c 2012-06-21 12:58:41.000000000 +0200 +++ new/nagios/base/utils.c 2013-01-10 20:51:16.000000000 +0100 @@ -2135,6 +2135,9 @@ } } #endif + /* Change the ownership on the debug log file */ + chown_debug_log( uid, gid); + if(setuid(uid) == -1) { logit(NSLOG_RUNTIME_WARNING, TRUE, "Warning: Could not set effective UID=%d", (int)uid); result = ERROR; @@ -2281,11 +2284,141 @@ continue; /* process the file */ - result = process_check_result_file(file); + result = process_check_result_file(file, &check_result_list, + TRUE, TRUE); + + /* break out if we encountered an error */ + if(result == ERROR) + break; + } + } + + closedir(dirp); + + return result; + + } + + + + +/* Find checks that are currently executing. This function is intended to + be used on a Nagios restart to prevent currently executing checks from + being rescheduled. */ +int find_executing_checks(char *dirname) { + char file[MAX_FILENAME_LENGTH]; + DIR *dirp = NULL; + struct dirent *dirfile = NULL; + int x = 0; + struct stat stat_buf; + int result = OK; + check_result *crl = NULL; + check_result *cr = NULL; + service *svc = NULL; + host *host = NULL; + time_t current_time; + + log_debug_info(DEBUGL_FUNCTIONS, 0, "find_executing_checks() start\n"); + + /* make sure we have what we need */ + if(dirname == NULL) { + logit(NSLOG_CONFIG_ERROR, TRUE, "Error: No check directory specified.\n"); + return ERROR; + } + + /* open the directory for reading */ + if((dirp = opendir(dirname)) == NULL) { + logit(NSLOG_CONFIG_ERROR, TRUE, "Error: Could not open check directory '%s' for reading.\n", dirname); + return ERROR; + } + + log_debug_info(DEBUGL_CHECKS, 1, "Starting to read check directory '%s'...\n", dirname); + + /* process all files in the directory... */ + while((dirfile = readdir(dirp)) != NULL) { + + /* create /path/to/file */ + snprintf(file, sizeof(file), "%s/%s", dirname, dirfile->d_name); + file[sizeof(file) - 1] = '\x0'; + + /* process this if it's a check result file... */ + x = strlen(dirfile->d_name); + if(x == 11 && !strncmp( dirfile->d_name, "check", 5)) { + + if(stat(file, &stat_buf) == -1) { + logit(NSLOG_RUNTIME_WARNING, TRUE, "Warning: Could not stat() check status '%s'.\n", file); + continue; + } + + switch(stat_buf.st_mode & S_IFMT) { + + case S_IFREG: + /* don't process symlinked files */ + if(!S_ISREG(stat_buf.st_mode)) + continue; + break; + + default: + /* everything else we ignore */ + continue; + break; + } + + /* at this point we have a regular file... */ + log_debug_info(DEBUGL_CHECKS, 2, + "Looking for still-executing checks in %s.\n", file); + + /* process the file */ + result = process_check_result_file(file, &crl, FALSE, FALSE); /* break out if we encountered an error */ if(result == ERROR) break; + + time(¤t_time); + + /* examine the check results */ + while(( cr = read_check_result(&crl)) != NULL) { + if( HOST_CHECK == cr->object_check_type) { + log_debug_info(DEBUGL_CHECKS, 2, + "Determining whether check for host '%s' is still executing.\n", + cr->host_name); + if((host = find_host(cr->host_name)) == NULL) { + logit(NSLOG_RUNTIME_WARNING, TRUE, + "Warning: Check status contained host '%s', " + "but the host could not be found! Ignoring " + "check.\n", cr->host_name); + } + if( current_time - cr->start_time.tv_sec < + host_check_timeout) { + log_debug_info(DEBUGL_CHECKS, 1, + "Check for host %s is still executing.\n", + cr->host_name); + host->is_executing = TRUE; + } + } + else if( SERVICE_CHECK == cr->object_check_type) { + log_debug_info(DEBUGL_CHECKS, 2, + "Determining whether check for service '%s' on host '%s' isstill executing.\n", + cr->host_name, cr->service_description); + if((svc = find_service(cr->host_name, + cr->service_description)) == NULL) { + logit(NSLOG_RUNTIME_WARNING, TRUE, + "Warning: Check status contained service '%s' " + "on host '%s', but the service could not be " + "found! Ignoring check.\n", + cr->service_description, cr->host_name); + } + if( current_time - cr->start_time.tv_sec < + service_check_timeout) { + log_debug_info(DEBUGL_CHECKS, 1, + "Check for service %s:%s is still executing.\n", + cr->host_name, cr->service_description); + svc->is_executing = TRUE; + } + } + free_check_result_list(&crl); + } } } @@ -2299,13 +2432,12 @@ /* reads check result(s) from a file */ -int process_check_result_file(char *fname) { +int process_check_result_file(char *fname, check_result **listp, int delete_file, int need_output) { mmapfile *thefile = NULL; char *input = NULL; char *var = NULL; char *val = NULL; char *v1 = NULL, *v2 = NULL; - int delete_file = FALSE; time_t current_time; check_result *new_cr = NULL; @@ -2346,10 +2478,11 @@ if(new_cr) { /* do we have the minimum amount of data? */ - if(new_cr->host_name != NULL && new_cr->output != NULL) { + if(new_cr->host_name != NULL && + ( !need_output || new_cr->output != NULL)) { /* add check result to list in memory */ - add_check_result_to_list(new_cr); + add_check_result_to_list(listp, new_cr); /* reset pointer */ new_cr = NULL; @@ -2441,10 +2574,11 @@ if(new_cr) { /* do we have the minimum amount of data? */ - if(new_cr->host_name != NULL && new_cr->output != NULL) { + if(new_cr->host_name != NULL && + ( !need_output || new_cr->output != NULL)) { /* add check result to list in memory */ - add_check_result_to_list(new_cr); + add_check_result_to_list(listp, new_cr); /* reset pointer */ new_cr = NULL; @@ -2462,9 +2596,9 @@ my_free(input); mmap_fclose(thefile); - /* delete the file (as well its ok-to-go file) if it's too old */ - /* other (current) files are deleted later (when results are processed) */ - delete_check_result_file(fname); + /* delete the file (as well its ok-to-go file) if they exist */ + if(TRUE == delete_file) + delete_check_result_file(fname); return OK; } @@ -2491,14 +2625,14 @@ /* reads the first host/service check result from the list in memory */ -check_result *read_check_result(void) { +check_result *read_check_result(check_result **listp) { check_result *first_cr = NULL; - if(check_result_list == NULL) + if(*listp == NULL) return NULL; - first_cr = check_result_list; - check_result_list = check_result_list->next; + first_cr = *listp; + *listp = (*listp)->next; return first_cr; } @@ -2539,7 +2673,7 @@ /* adds a new host/service check result to the list in memory */ -int add_check_result_to_list(check_result *new_cr) { +int add_check_result_to_list(check_result **listp, check_result *new_cr) { check_result *temp_cr = NULL; check_result *last_cr = NULL; @@ -2549,8 +2683,8 @@ /* add to list, sorted by finish time (asc) */ /* find insertion point */ - last_cr = check_result_list; - for(temp_cr = check_result_list; temp_cr != NULL; temp_cr = temp_cr->next) { + last_cr = *listp; + for(temp_cr = *listp; temp_cr != NULL; temp_cr = temp_cr->next) { if(temp_cr->finish_time.tv_sec >= new_cr->finish_time.tv_sec) { if(temp_cr->finish_time.tv_sec > new_cr->finish_time.tv_sec) break; @@ -2561,9 +2695,9 @@ } /* item goes at head of list */ - if(check_result_list == NULL || temp_cr == check_result_list) { - new_cr->next = check_result_list; - check_result_list = new_cr; + if(*listp == NULL || temp_cr == *listp) { + new_cr->next = *listp; + *listp = new_cr; } /* item goes in middle or at end of list */ @@ -2579,17 +2713,17 @@ /* frees all memory associated with the check result list */ -int free_check_result_list(void) { +int free_check_result_list(check_result **listp) { check_result *this_cr = NULL; check_result *next_cr = NULL; - for(this_cr = check_result_list; this_cr != NULL; this_cr = next_cr) { + for(this_cr = *listp; this_cr != NULL; this_cr = next_cr) { next_cr = this_cr->next; free_check_result(this_cr); my_free(this_cr); } - check_result_list = NULL; + *listp = NULL; return OK; } @@ -3712,8 +3846,6 @@ unsigned int rand_seed = 0; int randnum = 0; - return 0; /* op5 users get their updates elsewhere */ - time(¤t_time); /* @@ -3998,7 +4130,7 @@ free_comment_data(); /* free check result list */ - free_check_result_list(); + free_check_result_list(&check_result_list); /* free memory for the high priority event list */ this_event = event_list_high; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nagios/cgi/getcgi.c new/nagios/cgi/getcgi.c --- old/nagios/cgi/getcgi.c 2011-08-17 09:36:27.000000000 +0200 +++ new/nagios/cgi/getcgi.c 2012-12-21 17:59:06.000000000 +0100 @@ -137,14 +137,15 @@ /* check for NULL query string environment variable - 04/28/00 (Ludo Bosmans) */ if(getenv("QUERY_STRING") == NULL) { cgiinput = (char *)malloc(1); - if(cgiinput == NULL) { - printf("getcgivars(): Could not allocate memory for CGI input.\n"); - exit(1); - } - cgiinput[0] = '\x0'; + if(cgiinput != NULL) + cgiinput[0] = '\x0'; } else cgiinput = strdup(getenv("QUERY_STRING")); + if(cgiinput == NULL) { + printf("getcgivars(): Could not allocate memory for CGI input.\n"); + exit(1); + } } else if(!strcmp(request_method, "POST") || !strcmp(request_method, "PUT")) { @@ -220,7 +221,12 @@ paircount = 0; nvpair = strtok(cgiinput, "&"); while(nvpair) { - pairlist[paircount++] = strdup(nvpair); + pairlist[paircount] = strdup(nvpair); + if( NULL == pairlist[paircount]) { + printf("getcgivars(): Could not allocate memory for name-value pair #%d.\n", paircount); + exit(1); + } + paircount++; if(!(paircount % 256)) { pairlist = (char **)realloc(pairlist, (paircount + 256) * sizeof(char **)); if(pairlist == NULL) { @@ -245,13 +251,29 @@ /* get the variable name preceding the equal (=) sign */ if((eqpos = strchr(pairlist[i], '=')) != NULL) { *eqpos = '\0'; - unescape_cgi_input(cgivars[i * 2 + 1] = strdup(eqpos + 1)); + cgivars[i * 2 + 1] = strdup(eqpos + 1); + if( NULL == cgivars[ i * 2 + 1]) { + printf("getcgivars(): Could not allocate memory for cgi value #%d.\n", i); + exit(1); + } + unescape_cgi_input(cgivars[i * 2 + 1]); + } + else { + cgivars[i * 2 + 1] = strdup(""); + if( NULL == cgivars[ i * 2 + 1]) { + printf("getcgivars(): Could not allocate memory for empty stringfor variable value #%d.\n", i); + exit(1); + } + unescape_cgi_input(cgivars[i * 2 + 1]); } - else - unescape_cgi_input(cgivars[i * 2 + 1] = strdup("")); /* get the variable value (or name/value of there was no real "pair" in the first place) */ - unescape_cgi_input(cgivars[i * 2] = strdup(pairlist[i])); + cgivars[i * 2] = strdup(pairlist[i]); + if( NULL == cgivars[ i * 2]) { + printf("getcgivars(): Could not allocate memory for cgi name #%d.\n", i); + exit(1); + } + unescape_cgi_input(cgivars[i * 2]); } /* terminate the name-value list */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nagios/cgi/history.c new/nagios/cgi/history.c --- old/nagios/cgi/history.c 2011-08-17 09:36:27.000000000 +0200 +++ new/nagios/cgi/history.c 2012-12-21 17:57:22.000000000 +0100 @@ -805,16 +805,22 @@ else if(display_type == DISPLAY_HOSTS) { if(history_type == HOST_HISTORY || history_type == SERVICE_HISTORY) { - sprintf(match1, " HOST ALERT: %s;", host_name); - sprintf(match2, " SERVICE ALERT: %s;", host_name); + snprintf(match1, sizeof( match1), + " HOST ALERT: %s;", host_name); + snprintf(match2, sizeof( match2), + " SERVICE ALERT: %s;", host_name); } else if(history_type == HOST_FLAPPING_HISTORY || history_type == SERVICE_FLAPPING_HISTORY) { - sprintf(match1, " HOST FLAPPING ALERT: %s;", host_name); - sprintf(match2, " SERVICE FLAPPING ALERT: %s;", host_name); + snprintf(match1, sizeof( match1), + " HOST FLAPPING ALERT: %s;", host_name); + snprintf(match2, sizeof( match2), + " SERVICE FLAPPING ALERT: %s;", host_name); } else if(history_type == HOST_DOWNTIME_HISTORY || history_type == SERVICE_DOWNTIME_HISTORY) { - sprintf(match1, " HOST DOWNTIME ALERT: %s;", host_name); - sprintf(match2, " SERVICE DOWNTIME ALERT: %s;", host_name); + snprintf(match1, sizeof( match1), + " HOST DOWNTIME ALERT: %s;", host_name); + snprintf(match2, sizeof( match2), + " SERVICE DOWNTIME ALERT: %s;", host_name); } if(show_all_hosts == TRUE) @@ -853,11 +859,11 @@ else if(display_type == DISPLAY_SERVICES) { if(history_type == SERVICE_HISTORY) - sprintf(match1, " SERVICE ALERT: %s;%s;", host_name, svc_description); + snprintf(match1, sizeof( match1), " SERVICE ALERT: %s;%s;", host_name, svc_description); else if(history_type == SERVICE_FLAPPING_HISTORY) - sprintf(match1, " SERVICE FLAPPING ALERT: %s;%s;", host_name, svc_description); + snprintf(match1, sizeof( match1), " SERVICE FLAPPING ALERT: %s;%s;", host_name, svc_description); else if(history_type == SERVICE_DOWNTIME_HISTORY) - sprintf(match1, " SERVICE DOWNTIME ALERT: %s;%s;", host_name, svc_description); + snprintf(match1, sizeof( match1), " SERVICE DOWNTIME ALERT: %s;%s;", host_name, svc_description); if(strstr(temp_buffer, match1) && (history_type == SERVICE_HISTORY || history_type == SERVICE_FLAPPING_HISTORY || history_type == SERVICE_DOWNTIME_HISTORY)) display_line = TRUE; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nagios/configure new/nagios/configure --- old/nagios/configure 2012-11-30 17:58:25.000000000 +0100 +++ new/nagios/configure 2013-01-12 14:21:46.000000000 +0100 @@ -1314,9 +1314,9 @@ PKG_NAME=nagios -PKG_VERSION="3.4.3" +PKG_VERSION="3.4.4" PKG_HOME_URL="http://www.nagios.org/" -PKG_REL_DATE="11-30-2012" +PKG_REL_DATE="01-12-2013" ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nagios/configure.in new/nagios/configure.in --- old/nagios/configure.in 2012-11-30 17:58:25.000000000 +0100 +++ new/nagios/configure.in 2013-01-12 14:21:46.000000000 +0100 @@ -9,9 +9,9 @@ AC_PREFIX_DEFAULT(/usr/local/nagios) PKG_NAME=nagios -PKG_VERSION="3.4.3" +PKG_VERSION="3.4.4" PKG_HOME_URL="http://www.nagios.org/" -PKG_REL_DATE="11-30-2012" +PKG_REL_DATE="01-12-2013" dnl Figure out how to invoke "install" and what install options to use. AC_PROG_INSTALL diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nagios/html/main.php new/nagios/html/main.php --- old/nagios/html/main.php 2012-11-30 17:58:25.000000000 +0100 +++ new/nagios/html/main.php 2013-01-12 14:21:46.000000000 +0100 @@ -1,7 +1,7 @@ <?php include_once(dirname(__FILE__).'/includes/utils.inc.php'); -$this_version="3.4.3"; +$this_version="3.4.4"; ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> @@ -38,9 +38,9 @@ <div id="currentversioninfo"> <div class="product">Nagios<sup><span style="font-size: small;">®</span></sup> Core<sup><span style="font-size: small;">™</span></sup></div> -<div class="version">Version 3.4.3</div> -<div class="releasedate">November 30, 2012</div> -<div class="checkforupdates"><a href="http://www.nagios.org/checkforupdates/?version=3.4.3&product=nagioscore" target="_blank">Check for updates</a></div> +<div class="version">Version 3.4.4</div> +<div class="releasedate">January 12, 2013</div> +<div class="checkforupdates"><a href="http://www.nagios.org/checkforupdates/?version=3.4.4&product=nagioscore" target="_blank">Check for updates</a></div> <!--<div class="whatsnew"><a href="http://go.nagios.com/nagioscore/whatsnew">Read what's new in Nagios Core 3</a></div>--> </div> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nagios/include/common.h new/nagios/include/common.h --- old/nagios/include/common.h 2012-11-30 17:58:25.000000000 +0100 +++ new/nagios/include/common.h 2013-01-12 14:21:46.000000000 +0100 @@ -22,8 +22,8 @@ #include "shared.h" -#define PROGRAM_VERSION "3.4.3" -#define PROGRAM_MODIFICATION_DATE "11-30-2012" +#define PROGRAM_VERSION "3.4.4" +#define PROGRAM_MODIFICATION_DATE "01-12-2013" /*#define DEBUG_CHECK_IPC 1 */ /*#define DEBUG_CHECK_IPC2 1*/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nagios/include/logging.h new/nagios/include/logging.h --- old/nagios/include/logging.h 2011-08-17 09:34:41.000000000 +0200 +++ new/nagios/include/logging.h 2013-01-02 15:18:04.000000000 +0100 @@ -81,6 +81,7 @@ int rotate_log_file(time_t); /* rotates the main log file */ int write_log_file_info(time_t *); /* records log file/version info */ int open_debug_log(void); +int chown_debug_log(uid_t, gid_t); int close_debug_log(void); #endif /* !NSCGI */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nagios/include/nagios.h new/nagios/include/nagios.h --- old/nagios/include/nagios.h 2012-11-12 19:27:43.000000000 +0100 +++ new/nagios/include/nagios.h 2013-01-03 22:10:27.000000000 +0100 @@ -245,6 +245,28 @@ #define EVENT_SLEEP 98 /* asynchronous sleep event that occurs when event queues are empty */ #define EVENT_USER_FUNCTION 99 /* USER-defined function (modules) */ +#define EVENT_TYPE_STR( type) ( \ + type == EVENT_SERVICE_CHECK ? "EVENT_SERVICE_CHECK" : \ + type == EVENT_COMMAND_CHECK ? "EVENT_COMMAND_CHECK" : \ + type == EVENT_LOG_ROTATION ? "EVENT_LOG_ROTATION" : \ + type == EVENT_PROGRAM_SHUTDOWN ? "EVENT_PROGRAM_SHUTDOWN" : \ + type == EVENT_PROGRAM_RESTART ? "EVENT_PROGRAM_RESTART" : \ + type == EVENT_CHECK_REAPER ? "EVENT_CHECK_REAPER" : \ + type == EVENT_ORPHAN_CHECK ? "EVENT_ORPHAN_CHECK" : \ + type == EVENT_RETENTION_SAVE ? "EVENT_RETENTION_SAVE" : \ + type == EVENT_STATUS_SAVE ? "EVENT_STATUS_SAVE" : \ + type == EVENT_SCHEDULED_DOWNTIME ? "EVENT_SCHEDULED_DOWNTIME" : \ + type == EVENT_SFRESHNESS_CHECK ? "EVENT_SFRESHNESS_CHECK" : \ + type == EVENT_EXPIRE_DOWNTIME ? "EVENT_EXPIRE_DOWNTIME" : \ + type == EVENT_HOST_CHECK ? "EVENT_HOST_CHECK" : \ + type == EVENT_HFRESHNESS_CHECK ? "EVENT_HFRESHNESS_CHECK" : \ + type == EVENT_RESCHEDULE_CHECKS ? "EVENT_RESCHEDULE_CHECKS" : \ + type == EVENT_EXPIRE_COMMENT ? "EVENT_EXPIRE_COMMENT" : \ + type == EVENT_CHECK_PROGRAM_UPDATE ? "EVENT_CHECK_PROGRAM_UPDATE" : \ + type == EVENT_SLEEP ? "EVENT_SLEEP" : \ + type == EVENT_USER_FUNCTION ? "EVENT_USER_FUNCTION" : \ + "UNKNOWN_EVENT_TYPE" \ +) /******* INTER-CHECK DELAY CALCULATION TYPES **********/ @@ -441,11 +463,12 @@ /**** IPC Functions ****/ int move_check_result_to_queue(char *); int process_check_result_queue(char *); -int process_check_result_file(char *); -int add_check_result_to_list(check_result *); -check_result *read_check_result(void); /* reads a host/service check result from the list in memory */ +int find_executing_checks(char *); +int process_check_result_file(char *, check_result **, int, int); +int add_check_result_to_list(check_result **, check_result *); +check_result *read_check_result(check_result **); /* reads a host/service check result from the list in memory */ int delete_check_result_file(char *); -int free_check_result_list(void); +int free_check_result_list(check_result **); int init_check_result(check_result *); int free_check_result(check_result *); /* frees memory associated with a host/service check result */ int parse_check_output(char *, char **, char **, char **, int, int); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nagios/nagios.spec new/nagios/nagios.spec --- old/nagios/nagios.spec 2012-11-30 17:58:25.000000000 +0100 +++ new/nagios/nagios.spec 2013-01-12 14:21:46.000000000 +0100 @@ -1,5 +1,5 @@ %define name nagios -%define version 3.4.3 +%define version 3.4.4 %define release 1 %define nsusr nagios %define nsgrp nagios diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nagios/update-version new/nagios/update-version --- old/nagios/update-version 2012-11-30 17:58:25.000000000 +0100 +++ new/nagios/update-version 2013-01-12 14:21:46.000000000 +0100 @@ -10,10 +10,10 @@ fi # Current version number -CURRENTVERSION=3.4.3 +CURRENTVERSION=3.4.4 # Last date -LASTDATE=11-30-2012 +LASTDATE=01-12-2013 if [ "x$1" = "x" ] then diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nagios/xdata/xodtemplate.c new/nagios/xdata/xodtemplate.c --- old/nagios/xdata/xodtemplate.c 2012-01-06 19:39:54.000000000 +0100 +++ new/nagios/xdata/xodtemplate.c 2012-12-28 12:54:32.000000000 +0100 @@ -4009,17 +4009,16 @@ else result = ERROR; - /* free memory */ - my_free(input); - - if(result == ERROR) { #ifdef NSCORE + if(result == ERROR) { printf("Error: Could not parse timeperiod directive '%s'!\n", input); -#endif - return ERROR; } +#endif + + /* free memory */ + my_free(input); - return OK; + return result; } ++++++ nagios-disable_phone_home.patch ++++++ --- /var/tmp/diff_new_pack.qzU3o8/_old 2013-01-17 09:50:20.000000000 +0100 +++ /var/tmp/diff_new_pack.qzU3o8/_new 2013-01-17 09:50:20.000000000 +0100 @@ -6,7 +6,7 @@ =================================================================== --- base/utils.c.orig +++ base/utils.c -@@ -3803,138 +3803,11 @@ int check_for_nagios_updates(int force, +@@ -3935,138 +3935,11 @@ int check_for_nagios_updates(int force, /* checks for updates at api.nagios.org */ int query_update_api(void) { ++++++ nagios-p1.pl-location.patch ++++++ --- /var/tmp/diff_new_pack.qzU3o8/_old 2013-01-17 09:50:20.000000000 +0100 +++ /var/tmp/diff_new_pack.qzU3o8/_new 2013-01-17 09:50:20.000000000 +0100 @@ -23,7 +23,7 @@ =================================================================== --- configure.in.orig +++ configure.in -@@ -16,6 +16,7 @@ PKG_REL_DATE="11-30-2012" +@@ -16,6 +16,7 @@ PKG_REL_DATE="01-12-2013" dnl Figure out how to invoke "install" and what install options to use. AC_PROG_INSTALL AC_SUBST(INSTALL) -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
