From 5ef8d7a9f8e1120ea245084d91c00c64e836f97a Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Fri, 28 Jul 2017 10:29:33 +0200 Subject: [PATCH] registrar: restructured condition for clarity --- src/modules/registrar/lookup.c | 13 +++++++++---- src/modules/registrar/regpv.c | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/modules/registrar/lookup.c b/src/modules/registrar/lookup.c index 03be9482e5a..b18fe993aa0 100644 --- a/src/modules/registrar/lookup.c +++ b/src/modules/registrar/lookup.c @@ -277,10 +277,15 @@ int lookup_helper(struct sip_msg* _m, udomain_t* _d, str* _uri, int _mode) return -1; } aor = *ptr->aor; - /* test if un-expired and suported contact */ - if( (ptr) && !(VALID_CONTACT(ptr,act_time) - && (ret=-2) && allowed_method(_m,ptr))) - goto done; + /* test if not expired and contact with suported method */ + if(ptr) { + if(!(VALID_CONTACT(ptr,act_time))) { + goto done; + } else if(!allowed_method(_m,ptr)) { + ret=-2; + goto done; + } + } LM_DBG("contact for [%.*s] found by temp gruu [%.*s / %u]\n", aor.len, ZSW(aor.s), inst.len, inst.s, ahash); } diff --git a/src/modules/registrar/regpv.c b/src/modules/registrar/regpv.c index ad82262a049..e90625cdc48 100644 --- a/src/modules/registrar/regpv.c +++ b/src/modules/registrar/regpv.c @@ -538,6 +538,7 @@ int pv_fetch_contacts_helper(sip_msg_t* msg, udomain_t* dt, str* uri, c0->instance.len = ptr->instance.len; p += c0->instance.len; } + LM_DBG("memory block between %p - %p\n", c0, p); if ((ptr->sock) && (ptr->sock->proto == PROTO_TCP || ptr->sock->proto == PROTO_TLS || ptr->sock->proto == PROTO_WS || ptr->sock->proto == PROTO_WSS))