Module: kamailio
Branch: 4.2
Commit: 6f9168a7859edd260465253cbfa7b0ad4b04c19b
URL:
https://github.com/kamailio/kamailio/commit/6f9168a7859edd260465253cbfa7b0a…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2015-07-29T12:27:52+02:00
usrloc: use domain for testing db if use_domain parameter is set
- rework from the patch by Erik Davidson, GH#161
(cherry picked from commit 7afe76191e9757770d2933e8c26f305c6ed388a3)
---
Modified: modules/usrloc/udomain.c
---
Diff:
https://github.com/kamailio/kamailio/commit/6f9168a7859edd260465253cbfa7b0a…
Patch:
https://github.com/kamailio/kamailio/commit/6f9168a7859edd260465253cbfa7b0a…
---
diff --git a/modules/usrloc/udomain.c b/modules/usrloc/udomain.c
index dca72cd..fb165ac 100644
--- a/modules/usrloc/udomain.c
+++ b/modules/usrloc/udomain.c
@@ -887,23 +887,30 @@ int db_timer_udomain(udomain_t* _d)
*/
int testdb_udomain(db1_con_t* con, udomain_t* d)
{
- db_key_t key[1], col[1];
- db_val_t val[1];
+ db_key_t key[2], col[1];
+ db_val_t val[2];
db1_res_t* res = NULL;
- if (ul_dbf.use_table(con, d->name) < 0) {
+ if(ul_dbf.use_table(con, d->name) < 0) {
LM_ERR("failed to change table\n");
return -1;
}
key[0] = &user_col;
+ key[1] = &domain_col;
col[0] = &user_col;
+
VAL_TYPE(val) = DB1_STRING;
VAL_NULL(val) = 0;
VAL_STRING(val) = "dummy_user";
- if (ul_dbf.query( con, key, 0, val, col, 1, 1, 0, &res) < 0) {
+ VAL_TYPE(val+1) = DB1_STRING;
+ VAL_NULL(val+1) = 0;
+ VAL_STRING(val+1) = "dummy_domain";
+
+ if(ul_dbf.query(con, key, 0, val, col, (use_domain)?2:1, 1, 0, &res)<0) {
+ if(res) ul_dbf.free_result( con, res);
LM_ERR("failure in db_query\n");
return -1;
}