Skip to content

Commit

Permalink
permissions: safety check if hash tables exist for rpc dump commands
Browse files Browse the repository at this point in the history
- reported by Olle E. Johansson, GH#248

(cherry picked from commit 56e4153)
(cherry picked from commit 5db29ed)
(cherry picked from commit 9eaf2f8)
  • Loading branch information
miconda committed Dec 18, 2015
1 parent fb8a926 commit 36b8b61
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion modules/permissions/mi.c
Expand Up @@ -96,7 +96,7 @@ struct mi_root* mi_trusted_dump(struct mi_root *cmd_tree, void *param)
void rpc_trusted_dump(rpc_t* rpc, void* c) {

if (hash_table==NULL) {
rpc->fault(c, 500, "Reload failed. No trusted table");
rpc->fault(c, 500, "No trusted table");
return;
}

Expand Down Expand Up @@ -158,6 +158,10 @@ struct mi_root* mi_address_dump(struct mi_root *cmd_tree, void *param)
*/
void rpc_address_dump(rpc_t* rpc, void* c) {

if(addr_hash_table==NULL) {
rpc->fault(c, 500, "No address table");
return;
}
if(addr_hash_table_rpc_print(*addr_hash_table, rpc, c) < 0 ) {
LM_DBG("failed to print a subnet_table dump\n");
}
Expand Down Expand Up @@ -189,6 +193,10 @@ struct mi_root* mi_subnet_dump(struct mi_root *cmd_tree, void *param)
* RPC function to dump subnet table
*/
void rpc_subnet_dump(rpc_t* rpc, void* c) {
if(subnet_table==NULL) {
rpc->fault(c, 500, "No subnet table");
return;
}
if(subnet_table_rpc_print(*subnet_table, rpc, c) < 0) {
LM_DBG("failed to print a subnet_table dump\n");
}
Expand Down Expand Up @@ -221,6 +229,10 @@ struct mi_root* mi_domain_name_dump(struct mi_root *cmd_tree, void *param)
*/
void rpc_domain_name_dump(rpc_t* rpc, void* c) {

if(domain_list_table==NULL) {
rpc->fault(c, 500, "No domain list table");
return;
}
if ( domain_name_table_rpc_print(*domain_list_table, rpc, c) < 0 ) {
LM_DBG("failed to print a subnet_table dump\n");
}
Expand Down

0 comments on commit 36b8b61

Please sign in to comment.