[sr-dev] propose change strncmp to strncasecmp in presence module

Luis Azedo luis at 2600hz.com
Thu Feb 19 01:44:22 CET 2015


Hi,

sometimes UAs do subscriptions using mixed case uris which most of the times leads to NOTIFY messages not getting to the UA.

if used with subs_db_mode = 3 and a case insensitive dbengine it works.

however, if we use other value on subs_db_mode it doesn't work or behaves poorly (missing cache)

should we make string insensitive matches in presence module for uris ?
i marked the 10 occurrences with >>>

Thank You

[lazedo at dev-01 presence]# grep strncmp . -R
./subscribe.c: if(ev_param->name.len== 2 && strncmp(ev_param->name.s, "id", 2)== 0)
./utils_func.h: if(strncmp(ip.s, "sip:", 4)!=0)
./hash.c: strncmp(s->callid.s, callid.s, callid.len)==0 &&
./hash.c: strncmp(s->to_tag.s, to_tag.s, to_tag.len)==0 &&
./hash.c: strncmp(s->from_tag.s, from_tag.s, from_tag.len)== 0)
./hash.c: && strncmp(s->to_tag.s,subs->to_tag.s,subs->to_tag.len)==0)
./hash.c: && strncmp(s->callid.s,subs->callid.s,subs->callid.len)==0
./hash.c: && strncmp(s->to_tag.s,subs->to_tag.s,subs->to_tag.len)==0
./hash.c: && strncmp(s->from_tag.s,subs->from_tag.s,subs->from_tag.len)==0)
>>> ./hash.c: if(strncmp(s->contact.s, subs->contact.s, subs->contact.len))
>>>./hash.c: strncmp(p->pres_uri.s, pres_uri->s, pres_uri->len)== 0 )
./presence.c: (reason.s && subs.reason.s && strncmp(reason.s, subs.reason.s,
>>>./presence.c: strncmp(s->pres_uri.s, subs->pres_uri.s, subs->pres_uri.len)== 0 &&
>>>./presence.c: strncmp(s->watcher_user.s, subs->watcher_user.s, s->watcher_user.len)== 0 &&
>>>./presence.c: strncmp(s->watcher_domain.s,subs->watcher_domain.s,s->watcher_domain.len)==0)
./presence.c:    if ((subs.reason.len == 12) && (strncmp(subs.reason.s, "polite-block", 12) == 0))
>>>./presentity.c: strncmp(presentity->sender->s, sender.s, sender.len)== 0))
./event_list.c: if(sep && strncmp(sep+1, "winfo", 5)== 0)
./event_list.c: strncmp(p->name.s,ps->name.s, ps->name.len)== 0)
./event_list.c: strncmp(p->body.s,ps->body.s,ps->body.len)== 0))
>>>./notify.c: strncmp(s->pres_uri.s, subs->pres_uri.s,subs->pres_uri.len)== 0)
>>>./notify.c: strncmp(sender.s, contact->s, sender.len)== 0)
./notify.c: if( (etags.len == etag->len) && (strncmp(etags.s,
>>>./notify.c: strncmp(s->pres_uri.s, pres_uri->s, pres_uri->len)== 0)) ||
>>>./notify.c: strncmp(sender->s, s->contact.s, sender->len)== 0))
./notify.c: subs->reason.len== 12 && strncmp(subs->reason.s, "polite-block", 12)== 0)
./notify.c: if(w->uri.len == wuri.len && strncmp(w->uri.s, wuri.s, wuri.len)== 0)


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20150219/357fbb83/attachment.html>


More information about the sr-dev mailing list