From: Jenkins2 Date: Thu, 3 May 2018 17:11:00 +0000 (-0500) Subject: Merge "res_pjsip/pjsip_distributor.c: Add missing off-nominal request response."... X-Git-Tag: 13.22.0-rc1~70 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8966a39e9d8de7a8a7f51e3fd471014324baa5b8;p=thirdparty%2Fasterisk.git Merge "res_pjsip/pjsip_distributor.c: Add missing off-nominal request response." into 13 --- 8966a39e9d8de7a8a7f51e3fd471014324baa5b8 diff --cc res/res_pjsip/pjsip_distributor.c index 14e540dc16,8a45ddbf6a..0d3b12247a --- a/res/res_pjsip/pjsip_distributor.c +++ b/res/res_pjsip/pjsip_distributor.c @@@ -724,16 -721,15 +724,17 @@@ static pj_bool_t endpoint_lookup(pjsip_ ao2_ref(unid, -1); } else if (using_auth_username) { ao2_wrlock(unidentified_requests); - /* The check again with the write lock held allows us to eliminate the DUPS_REPLACE and sort_fn */ - if ((unid = ao2_find(unidentified_requests, rdata->pkt_info.src_name, OBJ_SEARCH_KEY | OBJ_NOLOCK))) { + /* Checking again with the write lock held allows us to eliminate the DUPS_REPLACE and sort_fn */ + unid = ao2_find(unidentified_requests, rdata->pkt_info.src_name, + OBJ_SEARCH_KEY | OBJ_NOLOCK); + if (unid) { check_endpoint(rdata, unid, name); } else { - unid = ao2_alloc_options(sizeof(*unid) + strlen(rdata->pkt_info.src_name) + 1, NULL, - AO2_ALLOC_OPT_LOCK_RWLOCK); + unid = ao2_alloc_options(sizeof(*unid) + strlen(rdata->pkt_info.src_name) + 1, + NULL, AO2_ALLOC_OPT_LOCK_RWLOCK); if (!unid) { ao2_unlock(unidentified_requests); + pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata, 500, NULL, NULL, NULL); return PJ_TRUE; } strcpy(unid->src_name, rdata->pkt_info.src_name); /* Safe */