Browse code

permissions: safety check if hash tables exist for rpc dump commands

- reported by Olle E. Johansson, GH#248

Daniel-Constantin Mierla authored on 28/07/2015 07:47:48
Showing 1 changed files
... ...
@@ -92,7 +92,7 @@ struct mi_root* mi_trusted_dump(struct mi_root *cmd_tree, void *param)
92 92
 void rpc_trusted_dump(rpc_t* rpc, void* c) {
93 93
 
94 94
 	if (hash_table==NULL) {
95
-		rpc->fault(c, 500, "Reload failed. No trusted table");
95
+		rpc->fault(c, 500, "No trusted table");
96 96
 		return;
97 97
 	}
98 98
 
... ...
@@ -154,6 +154,10 @@ struct mi_root* mi_address_dump(struct mi_root *cmd_tree, void *param)
154 154
  */
155 155
 void rpc_address_dump(rpc_t* rpc, void* c) {
156 156
 
157
+	if(addr_hash_table==NULL) {
158
+		rpc->fault(c, 500, "No address table");
159
+		return;
160
+	}
157 161
 	if(addr_hash_table_rpc_print(*addr_hash_table, rpc, c) < 0 ) {
158 162
 		LM_DBG("failed to print a subnet_table dump\n");
159 163
 	}
... ...
@@ -185,6 +189,10 @@ struct mi_root* mi_subnet_dump(struct mi_root *cmd_tree, void *param)
185 185
  * RPC function to dump subnet table
186 186
  */
187 187
 void rpc_subnet_dump(rpc_t* rpc, void* c) {
188
+	if(subnet_table==NULL) {
189
+		rpc->fault(c, 500, "No subnet table");
190
+		return;
191
+	}
188 192
 	if(subnet_table_rpc_print(*subnet_table, rpc, c) < 0) {
189 193
 		LM_DBG("failed to print a subnet_table dump\n");
190 194
 	}
... ...
@@ -217,6 +225,10 @@ struct mi_root* mi_domain_name_dump(struct mi_root *cmd_tree, void *param)
217 217
  */
218 218
 void rpc_domain_name_dump(rpc_t* rpc, void* c) {
219 219
 
220
+	if(domain_list_table==NULL) {
221
+		rpc->fault(c, 500, "No domain list table");
222
+		return;
223
+	}
220 224
 	if ( domain_name_table_rpc_print(*domain_list_table, rpc, c) < 0 ) {
221 225
 		LM_DBG("failed to print a subnet_table dump\n");
222 226
 	}