Browse code

Secfilter: Modify error messages to RPC error messages instead of printf

Olle E. Johansson authored on 04/01/2022 09:49:10
Showing 1 changed files
... ...
@@ -112,7 +112,7 @@ void secf_rpc_add_bl(rpc_t *rpc, void *ctx)
112 112
 		rpc->rpl_printf(ctx, "Values (%.*s, %.*s) inserted into blacklist",
113 113
 				ctype.len, ctype.s, data.len, data.s);
114 114
 	} else {
115
-		rpc->rpl_printf(ctx, "Error insert values in the blacklist");
115
+		rpc->fault(ctx, 500, "Error inserting values in the blacklist");
116 116
 	}
117 117
 	lock_release(&secf_data->lock);
118 118
 }
... ...
@@ -141,7 +141,7 @@ void secf_rpc_add_wl(rpc_t *rpc, void *ctx)
141 141
 		rpc->rpl_printf(ctx, "Values (%.*s, %.*s) inserted into whitelist",
142 142
 				ctype.len, ctype.s, data.len, data.s);
143 143
 	} else {
144
-		rpc->rpl_printf(ctx, "Error insert values in the whitelist");
144
+		rpc->fault(ctx, 500, "Error insert values in the whitelist");
145 145
 	}
146 146
 	lock_release(&secf_data->lock);
147 147
 }
... ...
@@ -154,7 +154,7 @@ void secf_rpc_reload(rpc_t *rpc, void *ctx)
154 154
 
155 155
 	if(secf_load_db() == -1) {
156 156
 		LM_ERR("Error loading data from database\n");
157
-		rpc->rpl_printf(ctx, "Error loading data from database");
157
+		rpc->fault(ctx, 500, "Error loading data from database");
158 158
 	} else {
159 159
 		rpc->rpl_printf(ctx, "Data reloaded");
160 160
 	}