[sr-dev] git:master:6ce9c3c8: Secfilter: Modify error messages to RPC error messages instead of printf

Olle E. Johansson oej at edvina.net
Tue Jan 4 10:49:59 CET 2022


Module: kamailio
Branch: master
Commit: 6ce9c3c897055ff9942634c493caf79780ccf71b
URL: https://github.com/kamailio/kamailio/commit/6ce9c3c897055ff9942634c493caf79780ccf71b

Author: Olle E. Johansson <oej at edvina.net>
Committer: Olle E. Johansson <oej at edvina.net>
Date: 2022-01-04T10:49:10+01:00

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

---

Modified: src/modules/secfilter/secfilter_rpc.c

---

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

---

diff --git a/src/modules/secfilter/secfilter_rpc.c b/src/modules/secfilter/secfilter_rpc.c
index 2f763e4732..72db9a599d 100644
--- a/src/modules/secfilter/secfilter_rpc.c
+++ b/src/modules/secfilter/secfilter_rpc.c
@@ -112,7 +112,7 @@ void secf_rpc_add_bl(rpc_t *rpc, void *ctx)
 		rpc->rpl_printf(ctx, "Values (%.*s, %.*s) inserted into blacklist",
 				ctype.len, ctype.s, data.len, data.s);
 	} else {
-		rpc->rpl_printf(ctx, "Error insert values in the blacklist");
+		rpc->fault(ctx, 500, "Error inserting values in the blacklist");
 	}
 	lock_release(&secf_data->lock);
 }
@@ -141,7 +141,7 @@ void secf_rpc_add_wl(rpc_t *rpc, void *ctx)
 		rpc->rpl_printf(ctx, "Values (%.*s, %.*s) inserted into whitelist",
 				ctype.len, ctype.s, data.len, data.s);
 	} else {
-		rpc->rpl_printf(ctx, "Error insert values in the whitelist");
+		rpc->fault(ctx, 500, "Error insert values in the whitelist");
 	}
 	lock_release(&secf_data->lock);
 }
@@ -154,7 +154,7 @@ void secf_rpc_reload(rpc_t *rpc, void *ctx)
 
 	if(secf_load_db() == -1) {
 		LM_ERR("Error loading data from database\n");
-		rpc->rpl_printf(ctx, "Error loading data from database");
+		rpc->fault(ctx, 500, "Error loading data from database");
 	} else {
 		rpc->rpl_printf(ctx, "Data reloaded");
 	}




More information about the sr-dev mailing list