|
|
|
@ -11,86 +11,20 @@
|
|
|
|
|
*
|
|
|
|
|
* \author Endace Technology Limited - Jason Ish <jason.ish@endace.com>
|
|
|
|
|
*
|
|
|
|
|
* \todo Consider using HashListTable to allow easy dumping of all data.
|
|
|
|
|
* \todo Consider having the in-memory configuration database a direct
|
|
|
|
|
* reflection of the configuration file and moving command line
|
|
|
|
|
* parameters to a primary lookup table?
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
|
|
#include "suricata-common.h"
|
|
|
|
|
#include "conf.h"
|
|
|
|
|
#include "util-hash.h"
|
|
|
|
|
#include "util-unittest.h"
|
|
|
|
|
#include "util-debug.h"
|
|
|
|
|
|
|
|
|
|
#define CONF_HASH_TBL_SIZE 1024
|
|
|
|
|
|
|
|
|
|
static HashTable *conf_hash = NULL;
|
|
|
|
|
|
|
|
|
|
/* temporary variable that would be used to hold the hash_table instance
|
|
|
|
|
* present in conf_hash. Used while running tests that require their
|
|
|
|
|
* own yaml conf file. The backup can be set and then be reused by using
|
|
|
|
|
* the function ConfCreateContextBackup() and ConfRestoreContextBackup() */
|
|
|
|
|
static HashTable *backup_conf_hash = NULL;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Function to generate the hash of a configuration value.
|
|
|
|
|
*
|
|
|
|
|
* This is a callback function provided to HashTable for creating the
|
|
|
|
|
* hash key. Its a simple wrapper around the generic hash function
|
|
|
|
|
* the passes on the configuration parameter name.
|
|
|
|
|
*
|
|
|
|
|
* \retval The hash ID of the configuration parameters name.
|
|
|
|
|
*/
|
|
|
|
|
static uint32_t
|
|
|
|
|
ConfHashFunc(HashTable *ht, void *data, uint16_t len)
|
|
|
|
|
{
|
|
|
|
|
ConfNode *cn = (ConfNode *)data;
|
|
|
|
|
uint32_t hash;
|
|
|
|
|
|
|
|
|
|
hash = HashTableGenericHash(ht, cn->name, strlen(cn->name));
|
|
|
|
|
SCLogDebug("%s -> %" PRIu32 "", cn->name, hash);
|
|
|
|
|
return hash;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Function to compare 2 hash nodes.
|
|
|
|
|
*
|
|
|
|
|
* This is a callback function provided to the HashTable for comparing
|
|
|
|
|
* 2 nodes.
|
|
|
|
|
*
|
|
|
|
|
* \retval 1 if equivalant otherwise 0.
|
|
|
|
|
*/
|
|
|
|
|
static char
|
|
|
|
|
ConfHashComp(void *a, uint16_t a_len, void *b, uint16_t b_len)
|
|
|
|
|
{
|
|
|
|
|
ConfNode *ca = (ConfNode *)a;
|
|
|
|
|
ConfNode *cb = (ConfNode *)b;
|
|
|
|
|
|
|
|
|
|
if (strcmp(ca->name, cb->name) == 0)
|
|
|
|
|
return 1;
|
|
|
|
|
else
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Callback function to free a hash node.
|
|
|
|
|
*/
|
|
|
|
|
static void ConfHashFree(void *data)
|
|
|
|
|
{
|
|
|
|
|
ConfNode *cn = (ConfNode *)data;
|
|
|
|
|
if (cn == NULL)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/** \todo VJ apparently the list that is free is also in the hash
|
|
|
|
|
* individually resulting in double free errors if we
|
|
|
|
|
* call ConfNodeFree (that clears the list) from this
|
|
|
|
|
* hash free function */
|
|
|
|
|
|
|
|
|
|
if (cn->name != NULL)
|
|
|
|
|
free(cn->name);
|
|
|
|
|
if (cn->val != NULL)
|
|
|
|
|
free(cn->val);
|
|
|
|
|
free(cn);
|
|
|
|
|
//ConfNodeFree(cn);
|
|
|
|
|
}
|
|
|
|
|
static ConfNode *root = NULL;
|
|
|
|
|
static ConfNode *root_backup = NULL;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Initialize the configuration system.
|
|
|
|
@ -98,18 +32,16 @@ static void ConfHashFree(void *data)
|
|
|
|
|
void
|
|
|
|
|
ConfInit(void)
|
|
|
|
|
{
|
|
|
|
|
/* Prevent double initialization. */
|
|
|
|
|
if (conf_hash != NULL) {
|
|
|
|
|
if (root != NULL) {
|
|
|
|
|
SCLogDebug("already initialized");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
conf_hash = HashTableInit(CONF_HASH_TBL_SIZE, ConfHashFunc, ConfHashComp,
|
|
|
|
|
ConfHashFree);
|
|
|
|
|
if (conf_hash == NULL) {
|
|
|
|
|
fprintf(stderr,
|
|
|
|
|
"ERROR: Failed to allocate memory for configuration, aborting.\n");
|
|
|
|
|
exit(1);
|
|
|
|
|
root = ConfNodeNew();
|
|
|
|
|
if (root == NULL) {
|
|
|
|
|
SCLogError(SC_ERR_MEM_ALLOC,
|
|
|
|
|
"ERROR: Failed to allocate memory for root configuration node, "
|
|
|
|
|
"aborting.");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
}
|
|
|
|
|
SCLogDebug("configuration module initialized");
|
|
|
|
|
}
|
|
|
|
@ -158,50 +90,43 @@ ConfNodeFree(ConfNode *node)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Set a configuration node.
|
|
|
|
|
* \brief Get a ConfNode by name.
|
|
|
|
|
*
|
|
|
|
|
* \param key The full name of the configuration node to lookup.
|
|
|
|
|
*
|
|
|
|
|
* \retval 1 on success, 0 on failure.
|
|
|
|
|
* \retval A pointer to ConfNode is found or NULL if the configuration
|
|
|
|
|
* node does not exist.
|
|
|
|
|
*/
|
|
|
|
|
int
|
|
|
|
|
ConfSetNode(ConfNode *node)
|
|
|
|
|
ConfNode *
|
|
|
|
|
ConfGetNode(char *key)
|
|
|
|
|
{
|
|
|
|
|
ConfNode lookup;
|
|
|
|
|
ConfNode *pnode;
|
|
|
|
|
ConfNode *node = root;
|
|
|
|
|
char *saveptr;
|
|
|
|
|
char *token;
|
|
|
|
|
|
|
|
|
|
lookup.name = node->name;
|
|
|
|
|
pnode = HashTableLookup(conf_hash, &lookup, sizeof(lookup));
|
|
|
|
|
if (pnode != NULL) {
|
|
|
|
|
if (!pnode->allow_override) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
HashTableRemove(conf_hash, pnode, sizeof(*pnode));
|
|
|
|
|
}
|
|
|
|
|
/* Need to dup the key for tokenization... */
|
|
|
|
|
char *tokstr = strdup(key);
|
|
|
|
|
|
|
|
|
|
if (HashTableAdd(conf_hash, node, sizeof(*node)) != 0) {
|
|
|
|
|
SCLogError(SC_ERR_MEM_ALLOC, "Failed to add new configuration node.");
|
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
|
token = strtok_r(tokstr, ".", &saveptr);
|
|
|
|
|
for (;;) {
|
|
|
|
|
node = ConfNodeLookupChild(node, token);
|
|
|
|
|
if (node == NULL)
|
|
|
|
|
break;
|
|
|
|
|
token = strtok_r(NULL, ".", &saveptr);
|
|
|
|
|
if (token == NULL)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
free(tokstr);
|
|
|
|
|
return node;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Get a ConfNode by key.
|
|
|
|
|
*
|
|
|
|
|
* \param key The lookup key of the node to find.
|
|
|
|
|
*
|
|
|
|
|
* \retval The node matching the key or NULL if not found.
|
|
|
|
|
* \brief Get the root configuration node.
|
|
|
|
|
*/
|
|
|
|
|
ConfNode *
|
|
|
|
|
ConfGetNode(char *key)
|
|
|
|
|
ConfGetRootNode(void)
|
|
|
|
|
{
|
|
|
|
|
ConfNode lookup;
|
|
|
|
|
ConfNode *node;
|
|
|
|
|
|
|
|
|
|
lookup.name = key;
|
|
|
|
|
|
|
|
|
|
node = HashTableLookup(conf_hash, &lookup, sizeof(lookup));
|
|
|
|
|
return node;
|
|
|
|
|
return root;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -216,37 +141,65 @@ ConfGetNode(char *key)
|
|
|
|
|
int
|
|
|
|
|
ConfSet(char *name, char *val, int allow_override)
|
|
|
|
|
{
|
|
|
|
|
ConfNode lookup_key, *conf_node;
|
|
|
|
|
ConfNode *parent = root;
|
|
|
|
|
ConfNode *node;
|
|
|
|
|
char *token;
|
|
|
|
|
char *saveptr;
|
|
|
|
|
|
|
|
|
|
lookup_key.name = name;
|
|
|
|
|
conf_node = HashTableLookup(conf_hash, &lookup_key, sizeof(lookup_key));
|
|
|
|
|
if (conf_node != NULL) {
|
|
|
|
|
if (!conf_node->allow_override) {
|
|
|
|
|
/* First check if the node already exists. */
|
|
|
|
|
node = ConfGetNode(name);
|
|
|
|
|
if (node != NULL) {
|
|
|
|
|
if (!node->allow_override) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
HashTableRemove(conf_hash, conf_node, sizeof(*conf_node));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
conf_node = ConfNodeNew();
|
|
|
|
|
if (conf_node == NULL) {
|
|
|
|
|
return 0;
|
|
|
|
|
else {
|
|
|
|
|
if (node->val != NULL)
|
|
|
|
|
free(node->val);
|
|
|
|
|
node->val = strdup(val);
|
|
|
|
|
node->allow_override = allow_override;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
conf_node->name = strdup(name);
|
|
|
|
|
conf_node->val = strdup(val);
|
|
|
|
|
conf_node->allow_override = allow_override;
|
|
|
|
|
|
|
|
|
|
if (HashTableAdd(conf_hash, conf_node, sizeof(*conf_node)) != 0) {
|
|
|
|
|
fprintf(stderr, "ERROR: Failed to set configuration parameter %s\n",
|
|
|
|
|
name);
|
|
|
|
|
exit(1);
|
|
|
|
|
else {
|
|
|
|
|
char *tokstr = strdup(name);
|
|
|
|
|
token = strtok_r(tokstr, ".", &saveptr);
|
|
|
|
|
node = ConfNodeLookupChild(parent, token);
|
|
|
|
|
for (;;) {
|
|
|
|
|
if (node == NULL) {
|
|
|
|
|
node = ConfNodeNew();
|
|
|
|
|
node->name = strdup(token);
|
|
|
|
|
node->parent = parent;
|
|
|
|
|
TAILQ_INSERT_TAIL(&parent->head, node, next);
|
|
|
|
|
parent = node;
|
|
|
|
|
}
|
|
|
|
|
token = strtok_r(NULL, ".", &saveptr);
|
|
|
|
|
if (token == NULL) {
|
|
|
|
|
if (node->val != NULL)
|
|
|
|
|
free(node->val);
|
|
|
|
|
node->val = strdup(val);
|
|
|
|
|
node->allow_override = allow_override;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
node = ConfNodeLookupChild(parent, token);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
free(tokstr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SCLogDebug("configuration parameter '%s' set", name);
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Retrieve a configuration value.
|
|
|
|
|
* \brief Retrieve the value of a configuration node.
|
|
|
|
|
*
|
|
|
|
|
* This function will return the value for a configuration node based
|
|
|
|
|
* on the full name of the node. It is possible that the value
|
|
|
|
|
* returned could be NULL, this could happen if the requested node
|
|
|
|
|
* does exist but is not a node that contains a value, but contains
|
|
|
|
|
* children ConfNodes instead.
|
|
|
|
|
*
|
|
|
|
|
* \param name Name of configuration parameter to get.
|
|
|
|
|
* \param vptr Pointer that will be set to the configuration value parameter.
|
|
|
|
@ -258,21 +211,13 @@ ConfSet(char *name, char *val, int allow_override)
|
|
|
|
|
int
|
|
|
|
|
ConfGet(char *name, char **vptr)
|
|
|
|
|
{
|
|
|
|
|
ConfNode lookup_key;
|
|
|
|
|
ConfNode *conf_node;
|
|
|
|
|
|
|
|
|
|
if (conf_hash == NULL)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
lookup_key.name = name;
|
|
|
|
|
|
|
|
|
|
conf_node = HashTableLookup(conf_hash, &lookup_key, sizeof(lookup_key));
|
|
|
|
|
if (conf_node == NULL) {
|
|
|
|
|
ConfNode *node = ConfGetNode(name);
|
|
|
|
|
if (node == NULL) {
|
|
|
|
|
SCLogDebug("failed to lookup configuration parameter '%s'", name);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
*vptr = conf_node->val;
|
|
|
|
|
*vptr = node->val;
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -339,6 +284,17 @@ ConfGetBool(char *name, int *val)
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Remove (and free) the provided configuration node.
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
ConfNodeRemove(ConfNode *node)
|
|
|
|
|
{
|
|
|
|
|
if (node->parent != NULL)
|
|
|
|
|
TAILQ_REMOVE(&node->parent->head, node, next);
|
|
|
|
|
ConfNodeFree(node);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Remove a configuration parameter from the configuration db.
|
|
|
|
|
*
|
|
|
|
@ -350,13 +306,15 @@ ConfGetBool(char *name, int *val)
|
|
|
|
|
int
|
|
|
|
|
ConfRemove(char *name)
|
|
|
|
|
{
|
|
|
|
|
ConfNode cn;
|
|
|
|
|
ConfNode *node;
|
|
|
|
|
|
|
|
|
|
cn.name = name;
|
|
|
|
|
if (HashTableRemove(conf_hash, &cn, sizeof(cn)) == 0)
|
|
|
|
|
return 1;
|
|
|
|
|
else
|
|
|
|
|
node = ConfGetNode(name);
|
|
|
|
|
if (node == NULL)
|
|
|
|
|
return 0;
|
|
|
|
|
else {
|
|
|
|
|
ConfNodeRemove(node);
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -365,8 +323,8 @@ ConfRemove(char *name)
|
|
|
|
|
void
|
|
|
|
|
ConfCreateContextBackup(void)
|
|
|
|
|
{
|
|
|
|
|
backup_conf_hash = conf_hash;
|
|
|
|
|
conf_hash = NULL;
|
|
|
|
|
root_backup = root;
|
|
|
|
|
root = NULL;
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -378,7 +336,7 @@ ConfCreateContextBackup(void)
|
|
|
|
|
void
|
|
|
|
|
ConfRestoreContextBackup(void)
|
|
|
|
|
{
|
|
|
|
|
conf_hash = backup_conf_hash;
|
|
|
|
|
root = root_backup;
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -389,11 +347,8 @@ ConfRestoreContextBackup(void)
|
|
|
|
|
void
|
|
|
|
|
ConfDeInit(void)
|
|
|
|
|
{
|
|
|
|
|
if (conf_hash == NULL)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
HashTableFree(conf_hash);
|
|
|
|
|
conf_hash = NULL;
|
|
|
|
|
if (root != NULL)
|
|
|
|
|
ConfNodeFree(root);
|
|
|
|
|
|
|
|
|
|
SCLogDebug("configuration module de-initialized");
|
|
|
|
|
}
|
|
|
|
@ -428,16 +383,14 @@ ConfNodeDump(ConfNode *node, const char *prefix)
|
|
|
|
|
level++;
|
|
|
|
|
TAILQ_FOREACH(child, &node->head, next) {
|
|
|
|
|
name[level] = strdup(child->name);
|
|
|
|
|
// if (child->val != NULL) {
|
|
|
|
|
if (prefix == NULL) {
|
|
|
|
|
printf("%s = %s\n", ConfPrintNameArray(name, level),
|
|
|
|
|
child->val);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
printf("%s.%s = %s\n", prefix,
|
|
|
|
|
ConfPrintNameArray(name, level), child->val);
|
|
|
|
|
}
|
|
|
|
|
//}
|
|
|
|
|
if (prefix == NULL) {
|
|
|
|
|
printf("%s = %s\n", ConfPrintNameArray(name, level),
|
|
|
|
|
child->val);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
printf("%s.%s = %s\n", prefix,
|
|
|
|
|
ConfPrintNameArray(name, level), child->val);
|
|
|
|
|
}
|
|
|
|
|
ConfNodeDump(child, prefix);
|
|
|
|
|
free(name[level]);
|
|
|
|
|
}
|
|
|
|
@ -450,22 +403,7 @@ ConfNodeDump(ConfNode *node, const char *prefix)
|
|
|
|
|
void
|
|
|
|
|
ConfDump(void)
|
|
|
|
|
{
|
|
|
|
|
HashTableBucket *b;
|
|
|
|
|
ConfNode *cn;
|
|
|
|
|
uint32_t u;
|
|
|
|
|
|
|
|
|
|
for (u = 0; u < conf_hash->array_size; u++) {
|
|
|
|
|
if (conf_hash->array[u] != NULL) {
|
|
|
|
|
b = (HashTableBucket *)conf_hash->array[u];
|
|
|
|
|
while (b != NULL) {
|
|
|
|
|
cn = (ConfNode *)b->data;
|
|
|
|
|
if (cn->val != NULL)
|
|
|
|
|
printf("%s = %s\n", cn->name, cn->val);
|
|
|
|
|
ConfNodeDump(cn, cn->name);
|
|
|
|
|
b = b->next;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ConfNodeDump(root, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -553,38 +491,6 @@ ConfTestSetAndGet(void)
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
ConfTestSetGetNode(void)
|
|
|
|
|
{
|
|
|
|
|
ConfNode *set;
|
|
|
|
|
ConfNode *get;
|
|
|
|
|
char key[] = "some-key";
|
|
|
|
|
char val[] = "some-val";
|
|
|
|
|
|
|
|
|
|
set = ConfNodeNew();
|
|
|
|
|
if (set == NULL)
|
|
|
|
|
return 0;
|
|
|
|
|
set->name = strdup(key);
|
|
|
|
|
set->val = strdup(val);
|
|
|
|
|
if (ConfSetNode(set) != 1)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
get = ConfGetNode(key);
|
|
|
|
|
if (get == NULL)
|
|
|
|
|
return 0;
|
|
|
|
|
if (strcmp(get->name, key) != 0)
|
|
|
|
|
return 0;
|
|
|
|
|
if (strcmp(get->val, val) != 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
ConfRemove(key);
|
|
|
|
|
get = ConfGetNode(key);
|
|
|
|
|
if (get != NULL)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Test that overriding a value is allowed provided allow_override is
|
|
|
|
|
* true and that the config parameter gets the new value.
|
|
|
|
@ -647,13 +553,14 @@ ConfTestOverrideValue2(void)
|
|
|
|
|
static int
|
|
|
|
|
ConfTestGetInt(void)
|
|
|
|
|
{
|
|
|
|
|
char name[] = "some-int";
|
|
|
|
|
char name[] = "some-int.x";
|
|
|
|
|
intmax_t val;
|
|
|
|
|
|
|
|
|
|
if (ConfSet(name, "0", 1) != 1)
|
|
|
|
|
return 0;
|
|
|
|
|
if (ConfGetInt(name, &val) != 1)
|
|
|
|
|
return 0;
|
|
|
|
|
return 1;
|
|
|
|
|
if (val != 0)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
@ -816,11 +723,37 @@ ConfNodeLookupChildValueTest(void)
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Test the removal of a configuration node.
|
|
|
|
|
*/
|
|
|
|
|
static int
|
|
|
|
|
ConfNodeRemoveTest(void)
|
|
|
|
|
{
|
|
|
|
|
ConfCreateContextBackup();
|
|
|
|
|
ConfInit();
|
|
|
|
|
|
|
|
|
|
if (ConfSet("some.nested.parameter", "blah", 1) != 1)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
ConfNode *node = ConfGetNode("some.nested.parameter");
|
|
|
|
|
if (node == NULL)
|
|
|
|
|
return 0;
|
|
|
|
|
ConfNodeRemove(node);
|
|
|
|
|
|
|
|
|
|
node = ConfGetNode("some.nested.parameter");
|
|
|
|
|
if (node != NULL)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
ConfDeInit();
|
|
|
|
|
ConfRestoreContextBackup();
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
ConfRegisterTests(void)
|
|
|
|
|
{
|
|
|
|
|
UtRegisterTest("ConfTestGetNonExistant", ConfTestGetNonExistant, 1);
|
|
|
|
|
UtRegisterTest("ConfTestSetGetNode", ConfTestSetGetNode, 1);
|
|
|
|
|
UtRegisterTest("ConfTestSetAndGet", ConfTestSetAndGet, 1);
|
|
|
|
|
UtRegisterTest("ConfTestOverrideValue1", ConfTestOverrideValue1, 1);
|
|
|
|
|
UtRegisterTest("ConfTestOverrideValue2", ConfTestOverrideValue2, 1);
|
|
|
|
@ -828,6 +761,7 @@ ConfRegisterTests(void)
|
|
|
|
|
UtRegisterTest("ConfTestGetBool", ConfTestGetBool, 1);
|
|
|
|
|
UtRegisterTest("ConfNodeLookupChildTest", ConfNodeLookupChildTest, 1);
|
|
|
|
|
UtRegisterTest("ConfNodeLookupChildValueTest", ConfNodeLookupChildValueTest, 1);
|
|
|
|
|
UtRegisterTest("ConfNodeRemoveTest", ConfNodeRemoveTest, 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif /* UNITTESTS */
|
|
|
|
|