[Nagios-devel] Nagios3-CVS Patch - Small Bug in config.c with
Posted: Sun Mar 25, 2007 12:57 am
This is a multi-part message in MIME format.
--------------000200020801090901090108
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: 7bit
Hi List,
hi Ethan,
one member of the German Nagios Portal mentioned Problems resulting in
"No Output returns from Plugin" if the temp_path directive direct to a
non existing directory.
In my opinion it would be the best to check the temp_path while config
parsing, cause the temp_path is the single point of getting outputs from
the plugins.
I wrote a small patch to check if nagios would be able to open the
directory, but until now not to check if it would be writeable by the
nagios user. AFAIK there should be one or two more variables like the
structure stat to check the uid/gid of the directory.
Please have a look at the patch.
Maybe it would be better to test the opendir() after checking for the
trailing "/" but I'm not sure.
Kind regards,
Hendrik
--------------000200020801090901090108
Content-Type: text/x-patch;
name="config.c.-temp_path_checking.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="config.c.-temp_path_checking.patch"
--- ./nagios3-clean/base/config.c 2007-03-25 10:06:23.000000000 +0200
+++ ./nagios3/base/config.c 2007-03-25 10:42:11.000000000 +0200
@@ -404,6 +404,20 @@
break;
}
+ if(opendir((char *)value)==NULL){
+ strcpy(error_message,"Temp path '%s' is not valid");
+ error=TRUE;
+ break;
+ }
+ // Maybe we should close the dirhandle but what to close
+ // without a normal DIR handle?
+ // With a temp DIR Handle there would be a new only temp variable...
+ //
+ // closedir(SOMESTUPID_HANDLE);
+ //
+ // Maybe we should check if the DIR Handle is writeable by us?
+ // AFAIK we need ...
+
my_free((void **)&temp_path);
if((temp_path=(char *)strdup(value))){
strip(temp_path);
--------------000200020801090901090108--
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
--------------000200020801090901090108
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: 7bit
Hi List,
hi Ethan,
one member of the German Nagios Portal mentioned Problems resulting in
"No Output returns from Plugin" if the temp_path directive direct to a
non existing directory.
In my opinion it would be the best to check the temp_path while config
parsing, cause the temp_path is the single point of getting outputs from
the plugins.
I wrote a small patch to check if nagios would be able to open the
directory, but until now not to check if it would be writeable by the
nagios user. AFAIK there should be one or two more variables like the
structure stat to check the uid/gid of the directory.
Please have a look at the patch.
Maybe it would be better to test the opendir() after checking for the
trailing "/" but I'm not sure.
Kind regards,
Hendrik
--------------000200020801090901090108
Content-Type: text/x-patch;
name="config.c.-temp_path_checking.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="config.c.-temp_path_checking.patch"
--- ./nagios3-clean/base/config.c 2007-03-25 10:06:23.000000000 +0200
+++ ./nagios3/base/config.c 2007-03-25 10:42:11.000000000 +0200
@@ -404,6 +404,20 @@
break;
}
+ if(opendir((char *)value)==NULL){
+ strcpy(error_message,"Temp path '%s' is not valid");
+ error=TRUE;
+ break;
+ }
+ // Maybe we should close the dirhandle but what to close
+ // without a normal DIR handle?
+ // With a temp DIR Handle there would be a new only temp variable...
+ //
+ // closedir(SOMESTUPID_HANDLE);
+ //
+ // Maybe we should check if the DIR Handle is writeable by us?
+ // AFAIK we need ...
+
my_free((void **)&temp_path);
if((temp_path=(char *)strdup(value))){
strip(temp_path);
--------------000200020801090901090108--
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]