Major bug ? (Was: Fw: Daily patch: gateway)

"Bruno David Rodrigues" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <01b601c1c622$c38e38b0$6e01290a@hobbes>
----- Original Message -----
From: "kannel" <[email protected]>
To: <[email protected]>
Sent: Thursday, March 07, 2002 6:30 AM
Subject: Daily patch: gateway


> +2002-03-07  Stipe Tolj  <[email protected]>
> +    * gw/cfg.[ch]: implemented inclusion feature for configuration file
> +      processing. Now you may use 'include = "foobar.conf"' anywhere in
> +      the config file to include sub-configuration parts.
> +    * doc/userguide/userguide.xml: added section which describes the new
> +      'include' configuration directive.
> +
(...)
>            /*
>             * this is a "normal" line, so process it accodingly
>             */
>            else  {
(...)
> +                /*
> +                 * Remember where the group has been defined.
> +                 * This may be referenced in several other places,
> +                 * i.e. dump_group()
> +                 */
> +                grp->configfile = octstr_duplicate(loc->filename);
> +                grp->line = loc->line_no;
> +
> +                cfg_set(grp, name, value);
> +                octstr_destroy(name);
> +                octstr_destroy(value);
> +            }
> +        }

This is totally wrong!

Have you checked your patch ? like killing smsbox and checking the zillion
warnings ?

Every line in kannel.conf would create a new octstr in that
octstr_duplicate!

I've checked the code and the functioning of this module is something like
this:

. kannel reads the file and search for empty lines (*1).
. It reads the <name> = <value> and add it to a hash table (grp)
. when it gets to another empty line, add that group to another hash table
(cfg) and create a
new group (grp).

Then later, it will check for a group = <something> for each grp in cfg.

The hash table function (dict_put) only accepts a key and a value, so you
can't put the line
number in it, therefor you can't inject the line number for every line read.

The best we can do is to define the filename and first line of the group.

I'm commiting a patch for this one.




(*1) empty lines, comments or alike
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.