2
0
Fork 0

[plugin_core] fix some setup parameter handling

This commit is contained in:
Stefan Bühler 2013-09-09 23:23:46 +02:00
parent 1a7eec4aa5
commit 5222d524ad
2 changed files with 15 additions and 0 deletions

View File

@ -1248,6 +1248,8 @@ static gboolean core_module_load(liServer *srv, liPlugin* p, liValue *val, gpoin
static gboolean core_io_timeout(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) {
UNUSED(p); UNUSED(userdata);
val = li_value_get_single_argument(val);
if (LI_VALUE_NUMBER != li_value_type(val) || val->data.number < 1) {
ERROR(srv, "%s", "io.timeout expects a positive number as parameter");
return FALSE;
@ -1261,6 +1263,8 @@ static gboolean core_io_timeout(liServer *srv, liPlugin* p, liValue *val, gpoint
static gboolean core_stat_cache_ttl(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) {
UNUSED(p); UNUSED(userdata);
val = li_value_get_single_argument(val);
if (LI_VALUE_NUMBER != li_value_type(val) || val->data.number < 0) {
ERROR(srv, "%s", "stat_cache.ttl expects a positive number as parameter");
return FALSE;
@ -1274,6 +1278,8 @@ static gboolean core_stat_cache_ttl(liServer *srv, liPlugin* p, liValue *val, gp
static gboolean core_tasklet_pool_threads(liServer *srv, liPlugin* p, liValue *val, gpointer userdata) {
UNUSED(p); UNUSED(userdata);
val = li_value_get_single_argument(val);
if (LI_VALUE_NUMBER != li_value_type(val)) {
ERROR(srv, "%s", "tasklet_pool.threads expects a number as parameter");
return FALSE;
@ -1413,6 +1419,13 @@ static gboolean core_setup_log_timestamp(liServer *srv, liPlugin* p, liValue *va
UNUSED(p);
UNUSED(userdata);
val = li_value_get_single_argument(val);
if (LI_VALUE_STRING != li_value_type(val)) {
ERROR(srv, "%s", "log.timestamp expects a string as parameter");
return FALSE;
}
if (NULL != srv->logs.timestamp.format) {
g_string_free(srv->logs.timestamp.format, TRUE);
}

View File

@ -598,6 +598,8 @@ static gboolean openssl_setup(liServer *srv, liPlugin* p, liValue *val, gpointer
}
ecdh_curve = entryValue->data.string->str;
} else if (g_str_equal(entryKeyStr->str, "options")) {
/* accept single parameter too */
if (LI_VALUE_STRING == li_value_type(entryValue)) li_value_wrap_in_list(entryValue);
if (LI_VALUE_LIST != li_value_type(entryValue)) {
ERROR(srv, "%s", "openssl options expects a list of strings as parameter");
return FALSE;