starter: Improved how deprecated keywords are handled.
We only throw a warning now instead of rejecting the config.
This commit is contained in:
@@ -51,6 +51,32 @@ static bool daemon_exists(char *daemon, char *path)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process deprecated keywords
|
||||
*/
|
||||
static bool is_deprecated(kw_token_t token, kw_list_t *kw, char *name)
|
||||
{
|
||||
switch (token)
|
||||
{
|
||||
case KW_SETUP_DEPRECATED:
|
||||
DBG1(DBG_APP, "# deprecated keyword '%s' in config setup",
|
||||
kw->entry->name);
|
||||
break;
|
||||
case KW_CONN_DEPRECATED:
|
||||
case KW_END_DEPRECATED:
|
||||
DBG1(DBG_APP, "# deprecated keyword '%s' in conn '%s'",
|
||||
kw->entry->name, name);
|
||||
break;
|
||||
case KW_CA_DEPRECATED:
|
||||
DBG1(DBG_APP, "# deprecated keyword '%s' in ca '%s'",
|
||||
kw->entry->name, name);
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void default_values(starter_config_t *cfg)
|
||||
{
|
||||
if (cfg == NULL)
|
||||
@@ -129,6 +155,12 @@ static void load_setup(starter_config_t *cfg, config_parsed_t *cfgp)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (is_deprecated(token, kw, ""))
|
||||
{
|
||||
cfg->non_fatal_err++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!assign_arg(token, KW_SETUP_FIRST, kw, (char *)cfg, &assigned))
|
||||
{
|
||||
DBG1(DBG_APP, " bad argument value in config setup");
|
||||
@@ -154,6 +186,12 @@ static void kw_end(starter_conn_t *conn, starter_end_t *end, kw_token_t token,
|
||||
char *name = kw->entry->name;
|
||||
char *value = kw->value;
|
||||
|
||||
if (is_deprecated(token, kw, conn_name))
|
||||
{
|
||||
cfg->non_fatal_err++;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!assign_arg(token, KW_END_FIRST, kw, (char *)end, &assigned))
|
||||
goto err;
|
||||
|
||||
@@ -446,6 +484,12 @@ static void load_conn(starter_conn_t *conn, kw_list_t *kw, starter_config_t *cfg
|
||||
continue;
|
||||
}
|
||||
|
||||
if (is_deprecated(token, kw, conn_name))
|
||||
{
|
||||
cfg->non_fatal_err++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!assign_arg(token, KW_CONN_FIRST, kw, (char *)conn, &assigned))
|
||||
{
|
||||
DBG1(DBG_APP, " bad argument value in conn '%s'", conn_name);
|
||||
@@ -631,6 +675,12 @@ static void load_ca(starter_ca_t *ca, kw_list_t *kw, starter_config_t *cfg)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (is_deprecated(token, kw, ca_name))
|
||||
{
|
||||
cfg->non_fatal_err++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!assign_arg(token, KW_CA_FIRST, kw, (char *)ca, &assigned))
|
||||
{
|
||||
DBG1(DBG_APP, " bad argument value in ca '%s'", ca_name);
|
||||
|
||||
Reference in New Issue
Block a user