as of kannel at the moment overwrites duplicate entries with the last occurance 
I 've locked up my sim another time. 
I think, ignoring valid values in a config file is a bad behaviour, and if valid
values occure twice, this is worth a panic, and the user should be hit with the 
nose to the ground, to review it's config before firing up a kannel configured
wrong.

so here's the patch to panic if the configvalue occurs a second time:

ndex: cfg.c
===================================================================
RCS file: /home/cvs/gateway/gwlib/cfg.c,v
retrieving revision 1.30
diff -u -r1.30 cfg.c
--- cfg.c       11 Feb 2005 15:35:48 -0000      1.30
+++ cfg.c       15 Aug 2005 13:29:51 -0000
@@ -652,7 +652,20 @@
 
 void cfg_set(CfgGroup *grp, Octstr *varname, Octstr *value)
 {
-    dict_put(grp->vars, varname, octstr_duplicate(value));
+       Octstr *check = (Octstr*)dict_get(grp->vars, varname);
+       if (check == NULL){
+               dict_put(grp->vars, varname, octstr_duplicate(value));
+       }
+       else {
+               Octstr *groupname=(Octstr*)dict_get(grp->vars, 
octstr_imm("group"));
+        panic(0, "Duplicate entry '%s' with values '%s|%s' in group %s, %s. 
Aborting!", 
+                         octstr_get_cstr(varname),
+                         octstr_get_cstr(check),
+                         octstr_get_cstr(value),
+                         octstr_get_cstr(groupname),
+                         octstr_get_cstr(grp->configfile));
+
+       }
 }




Willi

-- 

Attachment: cfg-value_once_per_group.patch.gz
Description: application/gunzip

Reply via email to