Module: kamailio Branch: master Commit: 7b67ab4623f63cbf823be47a35135ba052278c9e URL: https://github.com/kamailio/kamailio/commit/7b67ab4623f63cbf823be47a35135ba0...
Author: Stefan Mititelu stefan.mititelu@1and1.ro Committer: Stefan Mititelu stefan.mititelu@1and1.ro Date: 2016-01-15T13:08:29+02:00
debugger: Restrict dbg_sip_msg() to REQUEST/ONSEND
Allow dbg_sip_msg only from REQUEST/ONSEND route in a similar way as for msg_apply_changes().
---
Modified: modules/debugger/debugger_mod.c
---
Diff: https://github.com/kamailio/kamailio/commit/7b67ab4623f63cbf823be47a35135ba0... Patch: https://github.com/kamailio/kamailio/commit/7b67ab4623f63cbf823be47a35135ba0...
---
diff --git a/modules/debugger/debugger_mod.c b/modules/debugger/debugger_mod.c index 9f8186d..7681586 100644 --- a/modules/debugger/debugger_mod.c +++ b/modules/debugger/debugger_mod.c @@ -99,11 +99,11 @@ static cmd_export_t cmds[]={ {"dbg_pv_dump", (cmd_function)w_dbg_dump, 2, fixup_dbg_pv_dump, 0, ANY_ROUTE}, {"dbg_sip_msg", (cmd_function)w_dbg_sip_msg, 0, - fixup_dbg_sip_msg, 0, REQUEST_ROUTE}, + fixup_dbg_sip_msg, 0, REQUEST_ROUTE|ONREPLY_ROUTE}, {"dbg_sip_msg", (cmd_function)w_dbg_sip_msg, 1, - fixup_dbg_sip_msg, 0, REQUEST_ROUTE}, + fixup_dbg_sip_msg, 0, REQUEST_ROUTE|ONREPLY_ROUTE}, {"dbg_sip_msg", (cmd_function)w_dbg_sip_msg, 2, - fixup_dbg_sip_msg, 0, REQUEST_ROUTE}, + fixup_dbg_sip_msg, 0, REQUEST_ROUTE|ONREPLY_ROUTE}, {0, 0, 0, 0, 0, 0} };
@@ -777,6 +777,11 @@ static int w_dbg_sip_msg(struct sip_msg* msg, char *level, char *facility) struct dest_info send_info; str obuf;
+ if (msg->first_line.type != SIP_REPLY && get_route_type() != REQUEST_ROUTE) { + LM_ERR("invalid usage - not in request route\n"); + return -1; + } + if (level != NULL) { /* substract L_OFFSET previously added */ ilevel = (int)(long)level - L_OFFSET;