Module: kamailio
Branch: master
Commit: 0406cba7db628a757572968269fd5d2f4426472e
URL:
https://github.com/kamailio/kamailio/commit/0406cba7db628a757572968269fd5d2…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2022-09-14T18:31:59+02:00
core: ppcfg - remove enclosing quotes when exporting defined value to snexpr
---
Modified: src/core/ppcfg.c
---
Diff:
https://github.com/kamailio/kamailio/commit/0406cba7db628a757572968269fd5d2…
Patch:
https://github.com/kamailio/kamailio/commit/0406cba7db628a757572968269fd5d2…
---
diff --git a/src/core/ppcfg.c b/src/core/ppcfg.c
index 2af5347cea..49f16aaa6f 100644
--- a/src/core/ppcfg.c
+++ b/src/core/ppcfg.c
@@ -390,13 +390,18 @@ static struct snexpr* pp_snexpr_defval(char *vname)
if(pd->value.s != NULL) {
LM_DBG("define id [%s] at index [%d] found with value - return [%.*s]\n",
vname, idx, pd->value.len, pd->value.s);
- return snexpr_convert_stzl(pd->value.s, pd->value.len, SNE_OP_CONSTSTZ);
+ if(pd->value.len>=2 && (pd->value.s[0]=='"' ||
pd->value.s[0]=='\'')
+ && pd->value.s[0]==pd->value.s[pd->value.len-1]) {
+ /* strip enclosing quotes for string value */
+ return snexpr_convert_stzl(pd->value.s+1, pd->value.len-1, SNE_OP_CONSTSTZ);
+ } else {
+ return snexpr_convert_stzl(pd->value.s, pd->value.len, SNE_OP_CONSTSTZ);
+ }
} else {
LM_DBG("define id [%s] at index [%d] found without value - return 1\n",
vname, idx);
return snexpr_convert_num(1, SNE_OP_CONSTNUM);
}
-
}
void pp_ifexp_eval(char *exval, int exlen)