X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=postlicyd%2Ffilter.c;h=ab608d8223ae27d249c3f4da96922918eeaf05c9;hb=39e8c944acc71c4e3deaa48d55c09279fd80d81f;hp=14bfc9b3f22311fc62b90391c15aaba718a0196f;hpb=81227d766b6cd49042c042ac18c66bd9ec661d47;p=apps%2Fpfixtools.git diff --git a/postlicyd/filter.c b/postlicyd/filter.c index 14bfc9b..ab608d8 100644 --- a/postlicyd/filter.c +++ b/postlicyd/filter.c @@ -281,6 +281,7 @@ bool filter_add_hook(filter_t *filter, const char *name, int name_len, const char *value, int value_len) { filter_hook_t hook; + hook.filter_id = -1; hook.type = hook_tokenize(name, name_len); if (hook.type == HTK_UNKNOWN) { err("unknown hook type %.*s", name_len, name); @@ -295,6 +296,7 @@ bool filter_add_hook(filter_t *filter, const char *name, int name_len, /* Value format is (counter:id:incr)?(postfix:reply|filter_name) */ + hook.value = NULL; if (strncmp(value, "counter:", 8) == 0) { char *end = NULL; value += 8; @@ -322,12 +324,11 @@ bool filter_add_hook(filter_t *filter, const char *name, int name_len, hook.cost = 0; } hook.postfix = (strncmp(value, "postfix:", 8) == 0); - if (hook.postfix && query_format(NULL, 0, value + 8, NULL) == -1) { + if (hook.postfix && !query_format_check(value + 8)) { err("invalid formatted text \"%s\"", value + 8); return false; } hook.value = m_strdup(hook.postfix ? value + 8 : value); - hook.filter_id = -1; array_add(filter->hooks, hook); return true; }