Module: kamailio
Branch: master
Commit: ef568ca288ec66f1d950b3d243c06bbe023323fe
URL:
https://github.com/kamailio/kamailio/commit/ef568ca288ec66f1d950b3d243c06bb…
Author: ng-voice GmbH <carsten(a)ng-voice.com>
Committer: ng-voice GmbH <carsten(a)ng-voice.com>
Date: 2015-09-17T19:41:42+02:00
Merge pull request #326 from grumvalski/maa_missing_avps
ims_auth: fixed crash when receiving a MAA without SIP-Number-Auth-Items
---
Modified: modules/ims_auth/cxdx_mar.c
---
Diff:
https://github.com/kamailio/kamailio/commit/ef568ca288ec66f1d950b3d243c06bb…
Patch:
https://github.com/kamailio/kamailio/commit/ef568ca288ec66f1d950b3d243c06bb…
---
diff --git a/modules/ims_auth/cxdx_mar.c b/modules/ims_auth/cxdx_mar.c
index f075821..2c0b0be 100644
--- a/modules/ims_auth/cxdx_mar.c
+++ b/modules/ims_auth/cxdx_mar.c
@@ -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,
@@ -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)) {
@@ -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;