Skip to content
Permalink
Browse files

Add tag support to decoding in rlm_rest Fixes #2848

  • Loading branch information
arr2036 committed Aug 6, 2019
1 parent fde485e commit ebff4153de56d7313a9e80cac64376dc884dd096
Showing with 9 additions and 4 deletions.
  1. +9 −4 src/modules/rlm_rest/rest.c
@@ -244,7 +244,9 @@ typedef struct json_flags {
int is_json; //!< If true value will be inserted as raw JSON
// (multiple values not supported).
FR_TOKEN op; //!< The operator that determines how the new VP
// is processed. @see fr_tokens
// is processed. @see fr_tokens_table

int8_t tag; //!< Tag to assign to VP.
} json_flags_t;
#endif

@@ -1226,8 +1228,6 @@ static VALUE_PAIR *json_pair_make_leaf(UNUSED rlm_rest_t *instance, UNUSED rlm_r
return NULL;
}

vp->op = flags->op;

ret = fr_pair_value_from_str(vp, to_parse, -1);
talloc_free(expanded);
if (ret < 0) {
@@ -1237,6 +1237,9 @@ static VALUE_PAIR *json_pair_make_leaf(UNUSED rlm_rest_t *instance, UNUSED rlm_r
return NULL;
}

vp->op = flags->op;
vp->tag = flags->tag;

return vp;
}

@@ -1424,6 +1427,8 @@ static int json_pair_make(rlm_rest_t *instance, rlm_rest_section_t *section,
element = value;
}

flags.tag = dst->tmpl_tag;

/*
* A JSON 'value' key, may have multiple elements, iterate
* over each of them, creating a new VALUE_PAIR.
@@ -1741,7 +1746,7 @@ static size_t rest_response_body(void *ptr, size_t size, size_t nmemb, void *use

char const *p = ptr, *q;
char *tmp;

size_t const t = (size * nmemb);
size_t needed;

0 comments on commit ebff415

Please sign in to comment.
You can’t perform that action at this time.