Module: kamailio
Branch: master
Commit: fd98d373882f5e48070db2a58a50a92b9a688c78
URL:
https://github.com/kamailio/kamailio/commit/fd98d373882f5e48070db2a58a50a92…
Author: Seudin Kasumovic <seudin.kasumovic(a)gmail.com>
Committer: Seudin Kasumovic <seudin.kasumovic(a)gmail.com>
Date: 2015-05-24T20:02:11+02:00
erlang: Fix parameter capabilities check
Fix check getters of erl_send parameters.
---
Modified: modules/erlang/mod_erlang.c
Modified: modules/erlang/pv_atom.c
Modified: modules/erlang/pv_atom.h
---
Diff:
https://github.com/kamailio/kamailio/commit/fd98d373882f5e48070db2a58a50a92…
Patch:
https://github.com/kamailio/kamailio/commit/fd98d373882f5e48070db2a58a50a92…
---
diff --git a/modules/erlang/mod_erlang.c b/modules/erlang/mod_erlang.c
index 9f5d768..bd811a0 100644
--- a/modules/erlang/mod_erlang.c
+++ b/modules/erlang/mod_erlang.c
@@ -1124,7 +1124,7 @@ static int erl_send_k(struct sip_msg *msg, char *_pid, char *_emsg)
if (sp.getf == pv_pid_get ) {
xmsg = pv_pid_get_pid(&pvn->u.isname.name.s);
- } else if (sp.setf == pv_xbuff_set) {
+ } else if (sp.getf == pv_xbuff_get) {
xmsg = pv_xbuff_get_xbuff(&pvn->u.isname.name.s);
} else {
LM_ERR("BUG: unexpected type for pid parameter\n");
@@ -1208,12 +1208,16 @@ static int erl_send_k(struct sip_msg *msg, char *_pid, char
*_emsg)
pvn = &pvp.pvn;
}
- if (sp.setf == pv_list_set ) {
+ if (sp.getf == pv_list_get ) {
xmsg = pv_list_get_list(&pvn->u.isname.name.s);
- } else if (sp.setf == pv_xbuff_set) {
+ } else if (sp.getf == pv_xbuff_get) {
xmsg = pv_xbuff_get_xbuff(&pvn->u.isname.name.s);
- } else if (sp.setf == pv_tuple_set) {
+ } else if (sp.getf == pv_tuple_get) {
xmsg = pv_tuple_get_tuple(&pvn->u.isname.name.s);
+ } else if (sp.getf == pv_atom_get) {
+ xmsg = pv_atom_get_atom(&pvn->u.isname.name.s);
+ } else if (sp.getf == pv_pid_get) {
+ xmsg = pv_pid_get_pid(&pvn->u.isname.name.s);
}
/* fix index */
@@ -1364,10 +1368,11 @@ static int fixup_send(void** param, int param_no)
return E_UNSPEC;
}
- if (erl_param->value.sp.setf == pv_list_set
- || erl_param->value.sp.setf == pv_xbuff_set
- || erl_param->value.sp.setf == pv_tuple_set
- || erl_param->value.sp.setf == pv_atom_set) {
+ if (erl_param->value.sp.getf == pv_list_get
+ || erl_param->value.sp.getf == pv_xbuff_get
+ || erl_param->value.sp.getf == pv_tuple_get
+ || erl_param->value.sp.getf == pv_atom_get
+ || erl_param->value.sp.getf == pv_pid_get) {
erl_param->type = ERL_PARAM_XBUFF_SPEC;
} else {
diff --git a/modules/erlang/pv_atom.c b/modules/erlang/pv_atom.c
index b0d38d4..15c31a1 100644
--- a/modules/erlang/pv_atom.c
+++ b/modules/erlang/pv_atom.c
@@ -146,6 +146,11 @@ sr_xavp_t *xavp_get_atoms()
return list;
}
+sr_xavp_t *pv_atom_get_atom(str *name)
+{
+ return xavp_get_child(&atom_list, name);
+}
+
int pv_atom_set(struct sip_msg* msg, pv_param_t* param, int op, pv_value_t* val)
{
str name;
diff --git a/modules/erlang/pv_atom.h b/modules/erlang/pv_atom.h
index 99f5edb..fdd30cf 100644
--- a/modules/erlang/pv_atom.h
+++ b/modules/erlang/pv_atom.h
@@ -32,4 +32,6 @@ int pv_atom_get(struct sip_msg*, pv_param_t*, pv_value_t*);
void free_atom_fmt_buff();
+sr_xavp_t *pv_atom_get_atom(str *name);
+
#endif /* PV_ATOM_H_ */