Skip to content

Commit

Permalink
Merge pull request #326 from grumvalski/maa_missing_avps
Browse files Browse the repository at this point in the history
ims_auth: fixed crash when receiving a MAA without SIP-Number-Auth-Items
  • Loading branch information
carstenbock committed Sep 17, 2015
2 parents b4afd13 + 5aedfdf commit ef568ca
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions modules/ims_auth/cxdx_mar.c
Expand Up @@ -157,13 +157,18 @@ void async_cdp_callback(int is_timeout, void *param, AAAMessage *maa, long elaps
//get each individual element from the MAA
cxdx_get_result_code(maa, &rc);
cxdx_get_experimental_result_code(maa, &experimental_rc);
cxdx_get_sip_number_auth_items(maa, &sip_number_auth_items);

if (!cxdx_get_sip_number_auth_items(maa, &sip_number_auth_items)) {
sip_number_auth_items = 0;
goto success;
}

//now assign the auth_data_item elements
//there can be many of these in the MAA
struct auth_data_item *adi;
int adi_len;
char *p;
int items_found = 0;
while ((cxdx_get_auth_data_item_answer(maa, &auth_data, &item_number,
&algorithm, &authenticate, &authorization2,
&ck, &ik,
Expand Down Expand Up @@ -256,6 +261,8 @@ void async_cdp_callback(int is_timeout, void *param, AAAMessage *maa, long elaps
adi->previous = adi_list->last;
adi_list->last = adi;
}

items_found++;
}

if (!(rc) && !(experimental_rc)) {
Expand Down Expand Up @@ -304,7 +311,7 @@ void async_cdp_callback(int is_timeout, void *param, AAAMessage *maa, long elaps

success:

if (!sip_number_auth_items) {
if (!sip_number_auth_items || !items_found) {
stateful_request_reply_async(t, t->uas.request, 403, MSG_403_NO_AUTH_DATA);
result = CSCF_RETURN_FALSE;
goto done;
Expand Down

0 comments on commit ef568ca

Please sign in to comment.