Module: kamailio Branch: master Commit: 49276a1f43b1a3bf4a8d681888df964000360c79 URL: https://github.com/kamailio/kamailio/commit/49276a1f43b1a3bf4a8d681888df964000360c79
Author: Rick Barenthin <r...@ng-voice.com> Committer: Henning Westerholt <h...@gilawa.com> Date: 2024-04-20T06:35:51+02:00 usrloc: check on db delete the return value of memchr When inserting into the database the AOR is split at the @ sign and if there is no @ sign in the AOR only the domain part is filled and the user part is left empty. But for deleting this is not done and the query failed to be executed and the AOR is not deleted. This PR add this behaviour of only comparing against the domain part if the AOR doesn't contain a @ sign. --- Modified: src/modules/usrloc/urecord.c --- Diff: https://github.com/kamailio/kamailio/commit/49276a1f43b1a3bf4a8d681888df964000360c79.diff Patch: https://github.com/kamailio/kamailio/commit/49276a1f43b1a3bf4a8d681888df964000360c79.patch --- diff --git a/src/modules/usrloc/urecord.c b/src/modules/usrloc/urecord.c index e027affc8aa..3c394a24a10 100644 --- a/src/modules/usrloc/urecord.c +++ b/src/modules/usrloc/urecord.c @@ -491,13 +491,17 @@ int db_delete_urecord(urecord_t *_r) vals[0].val.str_val.len = _r->aor.len; if(ul_use_domain) { - dom = memchr(_r->aor.s, '@', _r->aor.len); - vals[0].val.str_val.len = dom - _r->aor.s; - vals[1].type = DB1_STR; vals[1].nul = 0; - vals[1].val.str_val.s = dom + 1; - vals[1].val.str_val.len = _r->aor.s + _r->aor.len - dom - 1; + dom = memchr(_r->aor.s, '@', _r->aor.len); + if(dom == 0) { + vals[0].val.str_val.len = 0; + vals[1].val.str_val = _r->aor; + } else { + vals[0].val.str_val.len = dom - _r->aor.s; + vals[1].val.str_val.s = dom + 1; + vals[1].val.str_val.len = _r->aor.s + _r->aor.len - dom - 1; + } } if(ul_dbf.use_table(ul_dbh, _r->domain) < 0) { _______________________________________________ Kamailio (SER) - Development Mailing List To unsubscribe send an email to sr-dev-le...@lists.kamailio.org