Re: [Nagios-devel] Bug and (loosely related) patch: Nagios 3.2.1

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] Bug and (loosely related) patch: Nagios 3.2.1

Post by Guest »

This is a multi-part message in MIME format.
--------------010206020506090906060403
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On 09/01/2010 01:54 PM, Ethan Galstad wrote:
> Please resubmit this patch against CVS HEAD, as your previous patch was=
=20
> already applied. Thanks!

Patch vs. cgi/config.c Rev 1.50 (HEAD as of now) attached.

Kind regards,
J. Bern

>> -- Replaced the offending strtok() with some local code ...
>> -- ... which also handles the backslash escapes of Nagios 3.x.
>> -- Tells "(undefined)" and "(empty)" $ARGn$s apart.
>> -- Warns of $ARGn$s with leading or trailing whitespace ...
>> -- ... and additionally puts them into "‍...‍" to make
>> sure that there'll be *something* displayed with the $ARGn$'s color
>> (see the "unused: $ARG5$=3D" line in the screenshot for an example)=
.
>> -- Changed a boatload of "printf(...,some_string);" to
>> "printf(...,html_encode(some_string,FALSE));".
>>
>> The whitespace detection is still not quite finished because I hit a
>> snag in the existing code, namely, in cgi/cgiutils.c::url_encode() :
>>
>>> /* spaces are pluses */
>>> else if((char)input[x]>> str[y]=3D'+';
>>> y++;
>>> }
>>>
>>> /* anything else gets represented by its hex value */
>>> else{
>>
>> Note the "> whenever a command contains whitespace *other* than spaces, the
>> hyperlink to config.cgi?type=3Dcommand&expand=3D... converts it to spa=
ces
>> (as seen in $ARG1$ in the screenshot; I currently have the code output
>> "[WS]" instead of "[SP]" whenever it sees spaces to obscure the proble=
m).
>>
>> I would like to get and display the *original* whitespace characters (=
as
>> simulated, by manually changing the URL, for $ARG2$ and $ARG5$ in the
>> screenshot), but I don't feel comfortable changing the widely-used
>> url_encode() just like that ... any opinions?
--=20
Jochen Bern, Systemingenieur --- LINworks GmbH
Postfach 100121, 64201 Darmstadt | Robert-Koch-Str. 9, 64331 Weiterstadt
PGP (1024D/4096g) FP =3D D18B 41B1 16C0 11BA 7F8C DCF7 E1D5 FAF4 444E 1C2=
7
Tel. +49 6151 9067-231, Zentr. -0, Fax -299 - Amtsg. Darmstadt HRB 85202
Unternehmenssitz Weiterstadt, Gesch=E4ftsf=FChrer Metin Dogan, Oliver Mic=
hel

--------------010206020506090906060403
Content-Type: text/plain;
name="nagios-3.2.1-CommandExpand-patch.Increment20100901.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename*0="nagios-3.2.1-CommandExpand-patch.Increment20100901.txt"

--- config.c.HEAD 2010-09-01 14:57:33.000000000 +0200
+++ config.c 2010-08-31 15:40:37.000000000 +0200
@@ -94,7 +94,6 @@

int display_type=DISPLAY_NONE;
char to_expand[MAX_COMMAND_BUFFER];
-char *command_args[MAX_COMMAND_ARGUMENTS];
char hashed_color[8];

int embedded=FALSE;
@@ -530,9 +529,9 @@
printf("\n",bg_class);

printf("%s\n",bg_class,
- url_encode(temp_host->name),CONFIG_CGI,url_encode(temp_host->name),temp_host->name);
- printf("%s\n",bg_class,temp_host->alias);
- printf("%s\n",bg_class,temp_host->address);
+ url_encode(temp_host->name),CONFIG_CGI,url_encode(temp_host->name),html_encode(temp_host->name,FALSE));
+ printf("%s\n",bg_class,html_encode(temp_host->alias,FALSE));
+ printf("%s\n",bg_class,html_encode(temp_host->address,FALSE));

printf("",bg_class);
for(temp_hostsmember=temp_host->parent_hosts;temp_hostsmember!=NULL;temp_hostsmember=temp_hostsmember->next){
@@ -540,7 +539,7 @@
if(temp_hostsmember!=temp_host->parent_hosts)
printf(", ");

- printf("%s\n",CONFIG_CGI,url_encode(temp_hostsmember->host_name),temp_hostsmember->host_name);
+ printf("<a href='%s?type=hosts&expand=%s'

...[email truncated]...


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