Module: kamailio Branch: master Commit: 56d41f6238f39d0046c97527abcb23b8dd7924be URL: https://github.com/kamailio/kamailio/commit/56d41f6238f39d0046c97527abcb23b8...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2021-07-01T10:19:08+02:00
core: ppcfg - clone value for substdef
- GH #2788
---
Modified: src/core/ppcfg.c
---
Diff: https://github.com/kamailio/kamailio/commit/56d41f6238f39d0046c97527abcb23b8... Patch: https://github.com/kamailio/kamailio/commit/56d41f6238f39d0046c97527abcb23b8...
---
diff --git a/src/core/ppcfg.c b/src/core/ppcfg.c index a5aa1d3e28..73c0a2ef3c 100644 --- a/src/core/ppcfg.c +++ b/src/core/ppcfg.c @@ -30,6 +30,7 @@ #include "ut.h" #include "re.h" #include "pvar.h" +#include "str_list.h" #include "dprint.h"
#include "ppcfg.h" @@ -44,6 +45,7 @@ typedef struct _pp_subst_rule { static pp_subst_rule_t *pp_subst_rules_head = NULL; static pp_subst_rule_t *pp_subst_rules_tail = NULL; static int _pp_ifdef_level = 0; +static str_list_t *_ksr_substdef_strlist = NULL;
int pp_subst_add(char *data) { @@ -94,6 +96,7 @@ int pp_substdef_add(char *data, int mode) str defvalue; str newval; sip_msg_t *fmsg; + str_list_t *sb;
if(pp_subst_add(data)<0) { LM_ERR("subst rule cannot be added\n"); @@ -146,7 +149,12 @@ int pp_substdef_add(char *data, int mode) if(memchr(defvalue.s, '$', defvalue.len) != NULL) { fmsg = faked_msg_get_next(); if(pv_eval_str(fmsg, &newval, &defvalue)>=0) { - defvalue = newval; + sb = str_list_block_add(&_ksr_substdef_strlist, newval.s, newval.len); + if(sb==NULL) { + LM_ERR("failed to handle substdef: [%s]\n", data); + return -1; + } + defvalue = sb->s; } } if(pp_define_set(defvalue.len, defvalue.s,