Skip to content

Commit

Permalink
Add tag support to decoding in rlm_rest Fixes #2848
Browse files Browse the repository at this point in the history
  • Loading branch information
arr2036 committed Aug 6, 2019
1 parent fde485e commit ebff415
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/modules/rlm_rest/rest.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -244,7 +244,9 @@ typedef struct json_flags {
int is_json; //!< If true value will be inserted as raw JSON int is_json; //!< If true value will be inserted as raw JSON
// (multiple values not supported). // (multiple values not supported).
FR_TOKEN op; //!< The operator that determines how the new VP 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; } json_flags_t;
#endif #endif


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


vp->op = flags->op;

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


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

return vp; return vp;
} }


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


flags.tag = dst->tmpl_tag;

/* /*
* A JSON 'value' key, may have multiple elements, iterate * A JSON 'value' key, may have multiple elements, iterate
* over each of them, creating a new VALUE_PAIR. * over each of them, creating a new VALUE_PAIR.
Expand Down Expand Up @@ -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 const *p = ptr, *q;
char *tmp; char *tmp;

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


Expand Down

0 comments on commit ebff415

Please sign in to comment.