[sr-dev] git:master:68db2457: core: clone modparamx evaluated values
Daniel-Constantin Mierla
miconda at gmail.com
Tue Jun 29 09:29:31 CEST 2021
Module: kamailio
Branch: master
Commit: 68db24577dae35de1e9045f994d9a751b50ad14d
URL: https://github.com/kamailio/kamailio/commit/68db24577dae35de1e9045f994d9a751b50ad14d
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-06-29T09:18:05+02:00
core: clone modparamx evaluated values
---
Modified: src/core/modparam.c
---
Diff: https://github.com/kamailio/kamailio/commit/68db24577dae35de1e9045f994d9a751b50ad14d.diff
Patch: https://github.com/kamailio/kamailio/commit/68db24577dae35de1e9045f994d9a751b50ad14d.patch
---
diff --git a/src/core/modparam.c b/src/core/modparam.c
index 041ce841c4..361536691d 100644
--- a/src/core/modparam.c
+++ b/src/core/modparam.c
@@ -31,11 +31,14 @@
#include "dprint.h"
#include "fmsg.h"
#include "pvar.h"
+#include "str_list.h"
#include "mem/mem.h"
#include <sys/types.h>
#include <regex.h>
#include <string.h>
+static str_list_t *_ksr_modparam_strlist = NULL;
+
static char *get_mod_param_type_str(int ptype)
{
if(ptype & PARAM_USE_FUNC) {
@@ -190,6 +193,7 @@ int modparamx_set(char* mname, char* pname, modparam_t ptype, void* pval)
char* epname;
pv_spec_t *pvs;
pv_value_t pvv;
+ str_list_t *sb;
emname = mname;
if(strchr(mname, '$') != NULL) {
@@ -197,7 +201,12 @@ int modparamx_set(char* mname, char* pname, modparam_t ptype, void* pval)
sfmt.s = mname;
sfmt.len = strlen(sfmt.s);
if(pv_eval_str(fmsg, &seval, &sfmt)>=0) {
- emname = seval.s;
+ sb = str_list_block_add(&_ksr_modparam_strlist, seval.s, seval.len);
+ if(sb==NULL) {
+ LM_ERR("failed to handle parameter type: %d\n", ptype);
+ return -1;
+ }
+ emname = sb->s.s;
}
}
@@ -207,7 +216,12 @@ int modparamx_set(char* mname, char* pname, modparam_t ptype, void* pval)
sfmt.s = pname;
sfmt.len = strlen(sfmt.s);
if(pv_eval_str(fmsg, &seval, &sfmt)>=0) {
- epname = seval.s;
+ sb = str_list_block_add(&_ksr_modparam_strlist, seval.s, seval.len);
+ if(sb==NULL) {
+ LM_ERR("failed to handle parameter type: %d\n", ptype);
+ return -1;
+ }
+ epname = sb->s.s;
}
}
@@ -218,8 +232,13 @@ int modparamx_set(char* mname, char* pname, modparam_t ptype, void* pval)
sfmt.s = (char*)pval;
sfmt.len = strlen(sfmt.s);
if(pv_eval_str(fmsg, &seval, &sfmt)>=0) {
+ sb = str_list_block_add(&_ksr_modparam_strlist, seval.s, seval.len);
+ if(sb==NULL) {
+ LM_ERR("failed to handle parameter type: %d\n", ptype);
+ return -1;
+ }
return set_mod_param_regex(emname, epname, PARAM_STRING,
- (void*)seval.s);
+ (void*)sb->s.s);
} else {
LM_ERR("failed to evaluate parameter [%s]\n", (char*)pval);
return -1;
@@ -267,8 +286,14 @@ int modparamx_set(char* mname, char* pname, modparam_t ptype, void* pval)
sfmt.len, sfmt.s);
return -1;
}
+ sb = str_list_block_add(&_ksr_modparam_strlist, pvv.rs.s, pvv.rs.len);
+ if(sb==NULL) {
+ LM_ERR("failed to handle parameter type: %d\n", ptype);
+ return -1;
+ }
+
return set_mod_param_regex(emname, epname, PARAM_STRING,
- (void*)pvv.rs.s);
+ (void*)sb->s.s);
default:
LM_ERR("invalid parameter type: %d\n", ptype);
return -1;
More information about the sr-dev
mailing list