2
0
Fork 0

[config parser] don't allow setup blocks or includes in setup blocks

personal/stbuehler/wip
Thomas Porzelt 2011-08-28 15:07:23 +02:00
parent dbfca1b2cb
commit cc1c9a92e2
1 changed files with 21 additions and 0 deletions

View File

@ -552,6 +552,11 @@ static gboolean config_parser_include(liServer *srv, GList *ctx_stack, gchar *pa
if (g_str_equal(name->data.string->str, "include")) {
li_value_free(name);
if (ctx->in_setup_block) {
WARNING(srv, "%s", "include directives not supported in setup blocks");
return FALSE;
}
if (!val) {
WARNING(srv, "%s", "include directive takes a string as parameter");
return FALSE;
@ -566,6 +571,11 @@ static gboolean config_parser_include(liServer *srv, GList *ctx_stack, gchar *pa
} else if (g_str_equal(name->data.string->str, "include_shell")) {
li_value_free(name);
if (ctx->in_setup_block) {
WARNING(srv, "%s", "include directives not supported in setup blocks");
return FALSE;
}
if (!val) {
WARNING(srv, "%s", "include_shell directive takes a string as parameter");
return FALSE;
@ -588,6 +598,11 @@ static gboolean config_parser_include(liServer *srv, GList *ctx_stack, gchar *pa
else if (g_str_equal(name->data.string->str, "include_lua")) {
li_value_free(name);
if (ctx->in_setup_block) {
WARNING(srv, "%s", "include directives not supported in setup blocks");
return FALSE;
}
if (!val) {
WARNING(srv, "%s", "include_lua directive takes a string as parameter");
return FALSE;
@ -751,6 +766,12 @@ static gboolean config_parser_include(liServer *srv, GList *ctx_stack, gchar *pa
action setup_block_start {
_printf("setup block start in line %zd\n", ctx->line);
if (ctx->in_setup_block) {
WARNING(srv, "%s", "already in a setup block");
return FALSE;
}
ctx->in_setup_block = TRUE;
}