Module: sip-router
Branch: master
Commit: de2015d507cdd40502160070a096aa3fb6754f55
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=de2015d…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Tue Apr 12 10:19:38 2011 +0200
acc(k): safety check for empty db_url
- if db_url is provided as empty string, disable db accounting
- if db_url is not provided, db acc flags are set to -1 instead
of 0 to avoid conflict with usage in config of flag 0
- reported by Francesco Castellano
---
modules_k/acc/acc_mod.c | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/modules_k/acc/acc_mod.c b/modules_k/acc/acc_mod.c
index cf767cd..a652c28 100644
--- a/modules_k/acc/acc_mod.c
+++ b/modules_k/acc/acc_mod.c
@@ -403,8 +403,13 @@ static int mod_init( void )
return -1;
#ifdef SQL_ACC
- if (db_url.s)
+ if (db_url.s) {
db_url.len = strlen(db_url.s);
+ if(db_url.len<=0) {
+ db_url.s = NULL;
+ db_url.len = 0;
+ }
+ }
db_table_acc.len = strlen(db_table_acc.s);
db_table_mc.len = strlen(db_table_mc.s);
acc_method_col.len = strlen(acc_method_col.s);
@@ -523,8 +528,10 @@ static int mod_init( void )
return -1;
}
} else {
- db_flag = 0;
- db_missed_flag = 0;
+ db_url.s = NULL;
+ db_url.len = 0;
+ db_flag = -1;
+ db_missed_flag = -1;
}
#endif
@@ -555,8 +562,8 @@ static int mod_init( void )
}
} else {
radius_config = 0;
- radius_flag = 0;
- radius_missed_flag = 0;
+ radius_flag = -1;
+ radius_missed_flag = -1;
}
#endif