[sr-dev] git:master: pipelimit: if db url or table name are empty, skip loading pipes from db

Daniel-Constantin Mierla miconda at gmail.com
Tue Apr 29 23:02:59 CEST 2014


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Tue Apr 29 23:02:08 2014 +0200

pipelimit: if db url or table name are empty, skip loading pipes from db

---

 modules/pipelimit/pl_db.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/modules/pipelimit/pl_db.c b/modules/pipelimit/pl_db.c
index 637c561..7800c76 100644
--- a/modules/pipelimit/pl_db.c
+++ b/modules/pipelimit/pl_db.c
@@ -106,18 +106,18 @@ int pl_init_db(void)
 	if(pl_db_url.s==NULL)
 		return 1;
 
-	if(rlp_table_name.s == 0)
-	{
-		LM_ERR("invalid database table name\n");
-		return -1;
-	}
-
 	pl_db_url.len         = strlen(pl_db_url.s);
 	rlp_table_name.len    = strlen(rlp_table_name.s);
 	rlp_pipeid_col.len    = strlen(rlp_pipeid_col.s);
 	rlp_limit_col.len     = strlen(rlp_limit_col.s);
 	rlp_algorithm_col.len = strlen(rlp_algorithm_col.s);
 
+	if(rlp_table_name.len <= 0 || pl_db_url.len<=0)
+	{
+		LM_INFO("no table name or db url - skipping loading from db\n");
+		return 0;
+	}
+
 	/* Find a database module */
 	if (db_bind_mod(&pl_db_url, &pl_dbf) < 0)
 	{




More information about the sr-dev mailing list