Config file parsing inconsistencies
I seem to have discovered some discrepancies in the parsing of config file statements. I'm using syslog-ng 1.6.2. For example, the following: destination test { udp("10.0.0.1" port(514) localport(0)); }; results in a segfault upon startup, whereas the following: destination test { udp("10.0.0.1" port(514) localport("0")); }; works fine. I haven't gone searching through the code yet, but it seems that parsing of options is inconsisent (note 514 is not in quotes). A brief grep of some source files seems to suggest that there might be a inconsistencies on when to parse the option as a number versus a string. John
2004-04-14, sze keltezéssel 22:22-kor John Kristoff ezt írta:
I seem to have discovered some discrepancies in the parsing of config file statements. I'm using syslog-ng 1.6.2. For example, the following:
destination test { udp("10.0.0.1" port(514) localport(0)); };
results in a segfault upon startup, whereas the following:
destination test { udp("10.0.0.1" port(514) localport("0")); };
works fine. I haven't gone searching through the code yet, but it seems that parsing of options is inconsisent (note 514 is not in quotes). A brief grep of some source files seems to suggest that there might be a inconsistencies on when to parse the option as a number versus a string.
the parser should accept both string and number cases and it really does, but there was a problem when the value specified as string was equal to '0'. This patch fixes it (and will be included in tomorrow's snapshot) diff -u -r1.25.4.1 afinet.c --- src/afinet.c 13 Jan 2004 18:08:02 -0000 1.25.4.1 +++ src/afinet.c 15 Apr 2004 07:40:59 -0000 @@ -59,7 +59,7 @@ CAST(inet_address_info, addr, *a); struct servent *srv; - if (!port) { + if (!port && service && proto) { if ((srv = getservbyname(service, proto))) { port=srv->s_port; } -- Bazsi PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1
participants (2)
-
Balazs Scheidler
-
John Kristoff