Re: [PATCH] config parsing: detecting unknown group identifiers

Alexander Malysh <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Hi,

looks ok, +1

Stipe Tolj schrieb:
> Hi list,
> 
> I got recently across an error a user claimed with the following output:
> 
> 2008-07-23 06:16:16.258 [1887] [0] ERROR: Group 'pgsql-conneciton' may 
> not contain field 'group'.
> 2008-07-23 06:16:16.258 [1887] [0] ERROR: Error found on line 377 of 
> file `etc/kannel_smppbox.conf'.
> 2008-07-23 06:16:16.258 [1887] [0] PANIC: Error reading configuration 
> file, cannot start.
> 
> and the first error line indicated that there was a 'group' directive 
> "inside" of the pgsql-connection group. I searched almost 30 minutes and 
> couldn't find any obvious config file error. Then started debugging in 
> deeper. Then my eyes got the catch, it's a simple typo in the group 
> identifier. It's 'pgsql-connection' and not the scrambled one.
> 
> Now, this seems to misleading users when parsing gets such errors, since 
> they don't see any specific error that there is _no_ group identifier 
> with that name.
> 
> I patched gwlib/cfg.c to provide such an error state if there is a group 
> inside the config that out config parser doesn't know.
> 
> Actually it's fairly simple: the foobar_is_allowed_in_group() have to 
> exit with -1 to indicate an unknown identifier and the allowed_hooks 
> loop has to mangle a bit with previous and present result values of 
> those hook returns. That's it.
> 
> (the rest is simply line indent fixes with NLC.)
> 
> Please test and vote for committing to CVS.
> 
> Stipe
> 
> -------------------------------------------------------------------
> Kölner Landstrasse 419
> 40589 DÃŒsseldorf, NRW, Germany
> 
> tolj.org system architecture      Kannel Software Foundation (KSF)
> http://www.tolj.org/              http://www.kannel.org/
> 
> mailto:st_{at}_tolj.org           mailto:stolj_{at}_kannel.org
> -------------------------------------------------------------------
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.