diff --git a/src/conf.c b/src/conf.c index 46624bf582..ea3d8f086e 100644 --- a/src/conf.c +++ b/src/conf.c @@ -136,7 +136,7 @@ ConfSet(char *name, char *val, int allow_override) lookup_key.name = name; conf_node = HashTableLookup(conf_hash, &lookup_key, sizeof(lookup_key)); if (conf_node != NULL) { - if (!allow_override) { + if (!conf_node->allow_override) { return 0; } HashTableRemove(conf_hash, conf_node, sizeof(*conf_node)); @@ -210,6 +210,28 @@ ConfRemove(char *name) return 0; } +/** + * \brief Dump configuration to stdout. + */ +void +ConfDump(void) +{ + HashTableBucket *b; + ConfNode *cn; + int i; + + for (i = 0; i < conf_hash->array_size; i++) { + if (conf_hash->array[i] != NULL) { + b = (HashTableBucket *)conf_hash->array[i]; + while (b != NULL) { + cn = (ConfNode *)b->data; + printf("%s=%s\n", cn->name, cn->val); + b = b->next; + } + } + } +} + #ifdef UNITTESTS /** diff --git a/src/conf.h b/src/conf.h index 2e9262461b..30ba1afd01 100644 --- a/src/conf.h +++ b/src/conf.h @@ -15,6 +15,7 @@ void ConfInit(void); int ConfGet(char *name, char **vptr); int ConfSet(char *name, char *val, int allow_override); +void ConfDump(void); void ConfRegisterTests(); #endif /* ! __CONF_H__ */