Module: sip-router Branch: master Commit: f26601329fd510bff08f684b3e445cc0c4a9995b URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=f2660132...
Author: Juha Heinanen jh@tutpro.com Committer: Juha Heinanen jh@tutpro.com Date: Fri Oct 2 12:00:58 2009 +0300
modules_k/permissions: fixed handling of db connection
* Do not close db connection if query fails. * Check that db connection exists before making a query
---
modules_k/permissions/trusted.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/modules_k/permissions/trusted.c b/modules_k/permissions/trusted.c index 889a3d2..aba3822 100644 --- a/modules_k/permissions/trusted.c +++ b/modules_k/permissions/trusted.c @@ -404,9 +404,9 @@ int allow_trusted(struct sip_msg* msg, char *src_ip, int proto) db_val_t vals[1]; db_key_t cols[3]; - if (!db_url.s) { - LM_ERR("db_url parameter has not been set\n"); - return -1; + if (db_handle == 0) { + LM_ERR("no connection to database\n"); + return -1; }
if (db_mode == DISABLE_CACHE) { @@ -427,7 +427,6 @@ int allow_trusted(struct sip_msg* msg, char *src_ip, int proto) if (perm_dbf.query(db_handle, keys, 0, vals, cols, 1, 3, 0, &res) < 0){ LM_ERR("failed to query database\n"); - perm_dbf.close(db_handle); return -1; }