[sr-dev] git:5.5:9dc2e9b4: core: clone modparamx evaluated values
Daniel-Constantin Mierla
miconda at gmail.com
Tue Jun 29 14:53:29 CEST 2021
Module: kamailio
Branch: 5.5
Commit: 9dc2e9b4e723f865fa92ed03f9c9b90473c83e94
URL: https://github.com/kamailio/kamailio/commit/9dc2e9b4e723f865fa92ed03f9c9b90473c83e94
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-06-29T14:42:24+02:00
core: clone modparamx evaluated values
(cherry picked from commit 68db24577dae35de1e9045f994d9a751b50ad14d)
---
Modified: src/core/modparam.c
---
Diff: https://github.com/kamailio/kamailio/commit/9dc2e9b4e723f865fa92ed03f9c9b90473c83e94.diff
Patch: https://github.com/kamailio/kamailio/commit/9dc2e9b4e723f865fa92ed03f9c9b90473c83e94.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