Skip to content

Commit

Permalink
Cache CONF_ITEM in the condition
Browse files Browse the repository at this point in the history
  • Loading branch information
alandekok committed Mar 21, 2014
1 parent c1f6e8e commit 107504a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/include/parser.h
Expand Up @@ -66,6 +66,7 @@ typedef enum fr_cond_type_t {
struct fr_cond_t {
fr_cond_type_t type;

CONF_ITEM const *ci;
union {
value_pair_map_t *map;
value_pair_tmpl_t *vpt;
Expand Down
4 changes: 4 additions & 0 deletions src/main/parser.c
Expand Up @@ -403,6 +403,7 @@ static ssize_t condition_tokenize(TALLOC_CTX *ctx, CONF_ITEM *ci, char const *st
* brackets. Go recurse to get more.
*/
c->type = COND_TYPE_CHILD;
c->ci = ci;
slen = condition_tokenize(c, ci, p, true, &c->data.child, error, flags);
if (slen <= 0) {
return_SLEN;
Expand Down Expand Up @@ -481,6 +482,7 @@ static ssize_t condition_tokenize(TALLOC_CTX *ctx, CONF_ITEM *ci, char const *st
}

c->type = COND_TYPE_EXISTS;
c->ci = ci;

c->data.vpt = radius_str2tmpl(c, lhs, lhs_type, REQUEST_CURRENT, PAIR_LIST_REQUEST);
if (!c->data.vpt) {
Expand All @@ -497,6 +499,8 @@ static ssize_t condition_tokenize(TALLOC_CTX *ctx, CONF_ITEM *ci, char const *st
*/
regex = false;
c->type = COND_TYPE_MAP;
c->ci = ci;

switch (*p) {
default:
return_P("Invalid text. Expected comparison operator");
Expand Down

0 comments on commit 107504a

Please sign in to comment.