Module: kamailio
Branch: master
Commit: bcdfd563d4469761be29588c53d82bc150913ece
URL:
https://github.com/kamailio/kamailio/commit/bcdfd563d4469761be29588c53d82bc…
Author: Carsten Bock <carsten(a)ng-voice.com>
Committer: Carsten Bock <carsten(a)ng-voice.com>
Date: 2015-01-19T23:56:11+02:00
ims_usrloc_scscf: Properly parse params when loading from database (caused crash)
---
Modified: modules/ims_usrloc_scscf/usrloc_db.c
---
Diff:
https://github.com/kamailio/kamailio/commit/bcdfd563d4469761be29588c53d82bc…
Patch:
https://github.com/kamailio/kamailio/commit/bcdfd563d4469761be29588c53d82bc…
---
diff --git a/modules/ims_usrloc_scscf/usrloc_db.c b/modules/ims_usrloc_scscf/usrloc_db.c
index c5d569f..c639bd7 100644
--- a/modules/ims_usrloc_scscf/usrloc_db.c
+++ b/modules/ims_usrloc_scscf/usrloc_db.c
@@ -6,6 +6,7 @@
#include "math.h"
#include "subscribe.h"
#include "../../lib/ims/useful_defs.h"
+#include "../../parser/parse_param.h"
str id_col = str_init(ID_COL); /*!< Name of column containing ID (gen. auto_increment
field */
str impu_id_col = str_init(IMPU_ID_COL); /*!< Name of column containing impu ID in
mapping table */
@@ -507,17 +508,20 @@ int inline int_to_str_len(int i) {
}
static inline int dbrow2contact(db_val_t* val, ucontact_info_t* ci) {
- static str path, user_agent, callid;
-
+ static str path, user_agent, callid, params;
+ param_hooks_t hooks;
- //TODO FIX PARAMS
-// /* params */
-// if (!VAL_NULL(val + 1)) {
-// params.s = (char*)VAL_STRING(val + 1);
-// params.len = strlen(params.s);
-// }
-// ci->params = ¶ms;
-// LM_DBG("Loading contact params: [%.*s]", ci->params->len,
ci->params->s);
+ // Set ci to 0:
+ memset( ci, 0, sizeof(ucontact_info_t));
+
+ /* params */
+ if (!VAL_NULL(val + 1)) {
+ params.s = (char*)VAL_STRING(val + 1);
+ params.len = strlen(params.s);
+ if (parse_params(¶ms, CLASS_CONTACT, &hooks, &ci->params) < 0) {
+ LM_WARN("Error while parsing parameters: %.*s\n", params.len, params.s);
+ }
+ }
/* path */
if (!VAL_NULL(val + 2)) {