[asterisk-bugs] [JIRA] (ASTERISK-23254) Bad ao2_find() usage in pjsip_options.c
Richard Mudgett (JIRA)
noreply at issues.asterisk.org
Tue Mar 25 11:46:18 CDT 2014
[ https://issues.asterisk.org/jira/browse/ASTERISK-23254?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=216756#comment-216756 ]
Richard Mudgett edited comment on ASTERISK-23254 at 3/25/14 11:46 AM:
----------------------------------------------------------------------
[^jira_asterisk_23254_v12_v3.patch] - Fixes updating the authenticate_qualify option on aor contacts when they are (re)scheduled after a (re)load.
See ASTERISK-23514
was (Author: rmudgett):
[^jira_asterisk_23254_v12_v3.patch] - Fixes updating the authenticate_qualify option on aor contacts when they are (re)scheduled after a (re)load.
> Bad ao2_find() usage in pjsip_options.c
> ---------------------------------------
>
> Key: ASTERISK-23254
> URL: https://issues.asterisk.org/jira/browse/ASTERISK-23254
> Project: Asterisk
> Issue Type: Bug
> Security Level: None
> Components: Resources/res_pjsip
> Affects Versions: 12.0.0
> Reporter: Richard Mudgett
> Assignee: Richard Mudgett
> Attachments: jira_asterisk_23254_v12.patch, jira_asterisk_23254_v12_v2.patch, jira_asterisk_23254_v12_v3.patch, jira_asterisk_23254_v12_v4.patch
>
>
> In the res/res_pjsip/pjsip_options.c:on_endpoint() function the ao2_find is useless because it will never match anything.
> {code}
> if (ao2_find(contacts, arg, OBJ_NODATA | OBJ_POINTER)) {
> return CMP_MATCH;
> }
> {code}
> As a result pjsip_options.c:find_endpoints() will never return any matching endpoints and the pjsip_options.c:qualify_contact() will not have an endpoint to qualify.
> pjsip_options.c:qualify_contact() needs to check if it actually finds an endpoint before sending the qualify. If it cannot find an endpoint it needs to generate an ERROR message and return. A crash is likely if an endpoint is not found and the qualify message is challenged for authentication. Alternatively, a configured default endpoint could be used as a final fallback before failing.
> {code}
> if (!endpoint_local) {
> struct ao2_iterator *endpoint_iterator = find_endpoints(contact);
> /* try to find endpoints that are associated with the contact */
> if (endpoint_iterator) {
> /* find "first" endpoint in order to authenticate - actually any
> endpoint should do that matched on the contact */
> endpoint_local = ao2_iterator_next(endpoint_iterator);
> ao2_iterator_destroy(endpoint_iterator);
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.2#6252)
More information about the asterisk-bugs
mailing list