Re: [Nagios-devel] 2 patches to fix minor issues in Nagios 2.0

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

Re: [Nagios-devel] 2 patches to fix minor issues in Nagios 2.0

Post by Guest »

Thanks! Patches will be applied.

On 15 Mar 2004 at 16:31, Christopher Gurnee wrote:

>
> First issue:
> When a hostgroup is defined with no members, the last host definition
> to have a "hostgroups" attribute which references the hostgroup is not
> correctly added to the hostgroup, and causes an error. (Host
> definitions in the config files are added to hostgroups in reverse
> order.)
>
> *** ../nagios-orig/xdata/xodtemplate.c Mon Feb 16 20:59:32 2004
> --- xdata/xodtemplate.c Mon Mar 15 14:38:01 2004
> ***************
> *** 6408,6414 ****
>
> /* add this list to the hostgroup members
> directive */ if(temp_hostgroup->members==NULL)
> ! temp_hostgroup->members=strdup(temp_pt
> ! r);
> else{
> new_members=(char
> *)realloc(temp_hostgroup->members,strl
> en(temp_hostgroup->members)+strlen(tem
> p_host->host_name)+2);
> if(new_members!=NULL){
> --- 6408,6414 ----
>
> /* add this list to the hostgroup members
> directive */ if(temp_hostgroup->members==NULL)
> ! temp_hostgroup->members=strdup(temp_ho
> ! st->host_name);
> else{
> new_members=(char
> *)realloc(temp_hostgroup->members,strl
> en(temp_hostgroup->members)+strlen(tem
> p_host->host_name)+2);
> if(new_members!=NULL){
>
>
> Second issue:
> The clean_macro_chars are stripped from handlers before they are
> executed, but not from notifications as the docs suggest.
>
> *** ../nagios-orig/base/notifications.c Tue Feb 10 23:48:47 2004
> --- base/notifications.c Fri Mar 5 13:52:43 2004
> ***************
> *** 577,582 ****
> --- 577,583 ----
> char temp_buffer[MAX_INPUT_BUFFER];
> int early_timeout=FALSE;
> double exectime;
> + int
> + macro_options=STRIP_ILLEGAL_MACRO_CHARS|ESCAPE_MACRO_CHARS;
>
> #ifdef DEBUG0
> printf("notify_contact_of_service() start\n");
> ***************
> *** 599,609 ****
> command_name_ptr=strtok(command_name,"!");
>
> /* get the raw command line */
> ! get_raw_command_line(temp_commandsmember->command,raw_
> ! command,sizeof(raw_command),0);
> strip(raw_command);
>
> /* process any macros contained in the argument */ !
>
> process_macros(raw_command,processed_command,sizeof(processed_command)
> ,0);
> strip(processed_command);
>
> /* run the notification command */
> --- 600,610 ----
> command_name_ptr=strtok(command_name,"!");
>
> /* get the raw command line */
> ! get_raw_command_line(temp_commandsmember->command,raw_
> ! command,sizeof(raw_command),macro_options);
> strip(raw_command);
>
> /* process any macros contained in the argument */ !
>
> process_macros(raw_command,processed_command,sizeof(processed_command)
> ,macro_options);
> strip(processed_command);
>
> /* run the notification command */
> ***************
> *** 1250,1257 ****
> char processed_command[MAX_INPUT_BUFFER];
> int early_timeout=FALSE;
> double exectime;
>
> -
> #ifdef DEBUG0
> printf("notify_contact_of_host() start\n");
> #endif
> --- 1251,1258 ----
> char processed_command[MAX_INPUT_BUFFER];
> int early_timeout=FALSE;
> double exectime;
> + int
> + macro_options=STRIP_ILLEGAL_MACRO_CHARS|ESCAPE_MACRO_CHARS;
>
> #ifdef DEBUG0
> printf("notify_contact_of_host() start\n");
> #endif
> ***************
> *** 1273,1289 ***

...[email truncated]...


This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked