Module: kamailio
Branch: master
Commit: 9c943031f29889c21b25b49b5dd267f4b2460bae
URL:
https://github.com/kamailio/kamailio/commit/9c943031f29889c21b25b49b5dd267f…
Author: Charles Chance <charles.chance(a)sipcentric.com>
Committer: Charles Chance <charles.chance(a)sipcentric.com>
Date: 2015-08-24T18:17:23+01:00
dmq_usrloc: check existence of usrloc domain before continuing.
- avoids crash caused by passing null pointer to get_urecord_by_ruid().
- eventually need to implement multi-domain replication but usrloc API needs enhancing
first.
---
Modified: modules/dmq_usrloc/usrloc_sync.c
---
Diff:
https://github.com/kamailio/kamailio/commit/9c943031f29889c21b25b49b5dd267f…
Patch:
https://github.com/kamailio/kamailio/commit/9c943031f29889c21b25b49b5dd267f…
---
diff --git a/modules/dmq_usrloc/usrloc_sync.c b/modules/dmq_usrloc/usrloc_sync.c
index dd87721..792f86e 100644
--- a/modules/dmq_usrloc/usrloc_sync.c
+++ b/modules/dmq_usrloc/usrloc_sync.c
@@ -140,6 +140,12 @@ void usrloc_get_all_ucontact(dmq_node_t* node)
LM_ERR("dmq_ul.get_all_ucontacts is NULL\n");
goto done;
}
+
+ if (dmq_ul.get_udomain("location", &_d) < 0) {
+ LM_ERR("Failed to get domain\n");
+ goto done;
+ }
+
rval = dmq_ul.get_all_ucontacts(buf, len, 0, 0, 1, 0);
if (rval<0) {
LM_ERR("failed to fetch contacts\n");
@@ -185,8 +191,6 @@ void usrloc_get_all_ucontact(dmq_node_t* node)
memcpy( &aorhash, cp, sizeof(aorhash));
cp = (char*)cp + sizeof(aorhash);
- dmq_ul.get_udomain("location", &_d);
-
res = dmq_ul.get_urecord_by_ruid(_d, aorhash, &ruid, &r, &ptr);
aor = r->aor;
if (res > 0) {