Răsfoiți Sursa

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.
Charles Chance 10 ani în urmă
părinte
comite
9c943031f2
1 a modificat fișierele cu 6 adăugiri și 2 ștergeri
  1. 6 2
      modules/dmq_usrloc/usrloc_sync.c

+ 6 - 2
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) {