Browse Source

[plugin_core] fix docroot pattern error handling (fixes #2362)

personal/stbuehler/wip
Stefan Bühler 10 years ago
parent
commit
eaf460e3d0
  1. 8
      src/main/pattern.c
  2. 5
      src/main/plugin_core.c

8
src/main/pattern.c

@ -155,7 +155,7 @@ liPattern *li_pattern_new(liServer *srv, const gchar* str) {
if (key_len == 0 || *key_c != ']' || *(key_c+1) != '}') {
/* parse error */
ERROR(srv, "could not parse pattern: \"%s\"", str);
ERROR(srv, "could not parse pattern (invalid key): \"%s\"", str);
li_pattern_free((liPattern*)pattern);
return NULL;
}
@ -172,7 +172,7 @@ liPattern *li_pattern_new(liServer *srv, const gchar* str) {
if (*c != '}') {
/* parse error */
ERROR(srv, "could not parse pattern: \"%s\"", str);
ERROR(srv, "could not parse pattern (missing '}'): \"%s\"", str);
if (key)
g_string_free(key, TRUE);
li_pattern_free((liPattern*)pattern);
@ -186,13 +186,13 @@ liPattern *li_pattern_new(liServer *srv, const gchar* str) {
if (part.data.lvalue->type == LI_COMP_UNKNOWN) {
/* parse error */
ERROR(srv, "could not parse pattern: \"%s\"", str);
ERROR(srv, "could not parse pattern (unknown condition lvalue): \"%s\"", str);
li_pattern_free((liPattern*)pattern);
return NULL;
}
} else {
/* parse error */
ERROR(srv, "could not parse pattern: \"%s\"", str);
ERROR(srv, "could not parse pattern (unepexcted character after '%%'): \"%s\"", str);
li_pattern_free((liPattern*)pattern);
return NULL;
}

5
src/main/plugin_core.c

@ -306,6 +306,7 @@ static liAction* core_docroot(liServer *srv, liWorker *wrk, liPlugin* p, liValue
if (val->type == LI_VALUE_STRING) {
pattern = li_pattern_new(srv, val->data.string->str);
if (NULL == pattern) return FALSE;
g_array_append_val(arr, pattern);
} else {
for (i = 0; i < val->data.list->len; i++) {
@ -317,6 +318,10 @@ static liAction* core_docroot(liServer *srv, liWorker *wrk, liPlugin* p, liValue
}
pattern = li_pattern_new(srv, v->data.string->str);
if (NULL == pattern) {
core_docroot_free(srv, arr);
return FALSE;
}
g_array_append_val(arr, pattern);
}
}

Loading…
Cancel
Save