[sr-dev] git:master: cr: protect against user error when backup is the same as initial host, port from r5924

Henning Westerholt henning.westerholt at 1und1.de
Tue Sep 8 17:44:50 CEST 2009


Module: sip-router
Branch: master
Commit: cb632b338cad0e7229372bec7eb1cd0d97a63014
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=cb632b338cad0e7229372bec7eb1cd0d97a63014

Author: Henning Westerholt <henning.westerholt at 1und1.de>
Committer: Henning Westerholt <henning.westerholt at 1und1.de>
Date:   Tue Sep  8 17:42:14 2009 +0200

cr: protect against user error when backup is the same as initial host, port from r5924

---

 modules/carrierroute/cr_fifo.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/modules/carrierroute/cr_fifo.c b/modules/carrierroute/cr_fifo.c
index 6d1c271..073579d 100644
--- a/modules/carrierroute/cr_fifo.c
+++ b/modules/carrierroute/cr_fifo.c
@@ -781,6 +781,11 @@ static int update_route_data_recursor(struct dtrie_node_t *node, str * act_domai
 						}
 						if (opts->new_host.len > 0) {
 							LM_INFO("deactivating host %.*s\n", rr->host.len, rr->host.s);
+							if ( opts->new_host.s && (strcmp(opts->new_host.s, rr->host.s) == 0)){
+								LM_ERR("Backup host the same as initial host %.*s",rr->host.len, rr->host.s);
+								FIFO_ERR(E_WRONGOPT);
+								return -1;
+							}
 							if (opts->new_host.len == 1 && opts->new_host.s[0] == 'a') {
 								if ((backup = find_auto_backup(rf, rr)) == NULL) {
 									LM_ERR("didn't find auto backup route\n");




More information about the sr-dev mailing list