Module: kamailio
Branch: 5.1
Commit: b11ff57c7bc2925003f86f925f6cff41cae4212f
URL: 
https://github.com/kamailio/kamailio/commit/b11ff57c7bc2925003f86f925f6cff41cae4212f

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2018-08-21T17:43:13+02:00

mtree: rpc reload without table name reloads all tables

- lost feature in rpc which was available in mi command

(cherry picked from commit c216abc532df9f22b023d26b46bd6322a217cdfe)

---

Modified: src/modules/mtree/mtree_mod.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/b11ff57c7bc2925003f86f925f6cff41cae4212f.diff
Patch: 
https://github.com/kamailio/kamailio/commit/b11ff57c7bc2925003f86f925f6cff41cae4212f.patch

---

diff --git a/src/modules/mtree/mtree_mod.c b/src/modules/mtree/mtree_mod.c
index 4ce2786afb..0710186869 100644
--- a/src/modules/mtree/mtree_mod.c
+++ b/src/modules/mtree/mtree_mod.c
@@ -930,7 +930,8 @@ static const char* rpc_mtree_summary_doc[2] = {
 void rpc_mtree_reload(rpc_t* rpc, void* c)
 {
        str tname = {0, 0};
-       m_tree_t *pt;
+       m_tree_t *pt = NULL;
+       int treloaded = 0;
 
        if(db_table.len>0)
        {
@@ -949,8 +950,13 @@ void rpc_mtree_reload(rpc_t* rpc, void* c)
 
                /* read tree name */
                if (rpc->scan(c, "S", &tname) != 1) {
-                       rpc->fault(c, 500, "Failed to get table name 
parameter");
-                       return;
+                       tname.s = 0;
+                       tname.len = 0;
+               } else {
+                       if(*tname.s=='.') {
+                               tname.s = 0;
+                               tname.len = 0;
+                       }
                }
 
                pt = mt_get_first_tree();
@@ -967,9 +973,13 @@ void rpc_mtree_reload(rpc_t* rpc, void* c)
                                        LM_ERR("cannot re-load mtree from 
database\n");
                                        goto error;
                                }
+                               treloaded = 1;
                        }
                        pt = pt->next;
                }
+               if(treloaded == 0) {
+                       rpc->fault(c, 500, "No Mtree Name Matching");
+               }
        }
 
        return;


_______________________________________________
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to