X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=postlicyd%2Ffilter.h;h=c50169d9c4e99fe76d0a8fc3d114da4cf8aeb665;hb=5c6356faa58d3109101e88ecfce207326d89ceab;hp=c2c7a4f0a57614e0280f52ab56dff09f756fbb53;hpb=785558696ffa16453be0b5b565c46b6426126d1e;p=apps%2Fpfixtools.git diff --git a/postlicyd/filter.h b/postlicyd/filter.h index c2c7a4f..c50169d 100644 --- a/postlicyd/filter.h +++ b/postlicyd/filter.h @@ -242,9 +242,9 @@ bool filter_test(const filter_t *filter, const query_t *query, /* Parsing Helpers */ -#define FILTER_PARAM_PARSE_STRING(Param, Dest) \ +#define FILTER_PARAM_PARSE_STRING(Param, Dest, Copy) \ case ATK_ ## Param: { \ - (Dest) = param->value; \ + (Dest) = (Copy) ? m_strdup(param->value) : param->value; \ } break #define FILTER_PARAM_PARSE_INT(Param, Dest) \ @@ -262,16 +262,18 @@ bool filter_test(const filter_t *filter, const query_t *query, } else if (param->value_len == 1 && param->value[0] == '0') { \ (Dest) = false; \ } else if (param->value_len == 4 \ - && ascii_tolower(param->value[0]) == 't') { \ - (Dest) = ascii_tolower(param->value[1]) == 'r' \ - && ascii_tolower(param->value[2]) == 'u' \ - && ascii_tolower(param->value[3]) == 'e'; \ + && ascii_tolower(param->value[0]) == 't' \ + && ascii_tolower(param->value[1]) == 'r' \ + && ascii_tolower(param->value[2]) == 'u' \ + && ascii_tolower(param->value[3]) == 'e') { \ + (Dest) = true; \ } else if (param->value_len == 5 \ - && ascii_tolower(param->value[0]) == 'f') { \ - (Dest) = ascii_tolower(param->value[1]) == 'a' \ - && ascii_tolower(param->value[2]) == 'l' \ - && ascii_tolower(param->value[3]) == 's' \ - && ascii_tolower(param->value[4]) == 'e'; \ + && ascii_tolower(param->value[0]) == 'f' \ + && ascii_tolower(param->value[1]) == 'a' \ + && ascii_tolower(param->value[2]) == 'l' \ + && ascii_tolower(param->value[3]) == 's' \ + && ascii_tolower(param->value[4]) == 'e') { \ + (Dest) = false; \ } else { \ PARSE_CHECK(false, "invalid %s value %.*s", atokens[ATK_ ## Param],\ param->value_len, param->value); \