Module: sip-router
Branch: 3.3
Commit: ccb3a52a11394dc88010aa41465d062e8490564a
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=ccb3a52…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Fri Dec 14 00:20:08 2012 +0100
dialog(k): fixed dlg.end_dlg rpc command
- missing of the optional paramter causes negative return code
(cherry picked from commit 840d23197e91c70f7b02072e144ec396f5f8f386)
---
modules_k/dialog/dialog.c | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/modules_k/dialog/dialog.c b/modules_k/dialog/dialog.c
index e25890d..2896343 100644
--- a/modules_k/dialog/dialog.c
+++ b/modules_k/dialog/dialog.c
@@ -1584,14 +1584,24 @@ static void rpc_end_dlg_entry_id(rpc_t *rpc, void *c) {
unsigned int h_entry, h_id;
dlg_cell_t * dlg = NULL;
str rpc_extra_hdrs = {NULL,0};
+ int n;
- if (rpc->scan(c, "dd*S", &h_entry, &h_id, &rpc_extra_hdrs) <
2) return;
+ n = rpc->scan(c, "dd", &h_entry, &h_id);
+ if (n < 2) {
+ LM_ERR("unable to read the parameters (%d)\n", n);
+ rpc->fault(c, 500, "Invalid parameters");
+ return;
+ }
+ rpc->scan(c, "*S", &rpc_extra_hdrs);
dlg = dlg_lookup(h_entry, h_id);
- if(dlg){
- dlg_bye_all(dlg, (rpc_extra_hdrs.len>0)?&rpc_extra_hdrs:NULL);
- dlg_release(dlg);
+ if(dlg==NULL) {
+ rpc->fault(c, 404, "Dialog not found");
+ return;
}
+
+ dlg_bye_all(dlg, (rpc_extra_hdrs.len>0)?&rpc_extra_hdrs:NULL);
+ dlg_release(dlg);
}
static void rpc_profile_get_size(rpc_t *rpc, void *c) {
str profile_name = {NULL,0};