fix crash in sal with authenticated requests

This commit is contained in:
Simon Morlat 2011-05-25 12:44:59 +02:00
parent 165a0584fe
commit 8e19b64c69
2 changed files with 10 additions and 4 deletions

View file

@ -246,6 +246,7 @@ void linphone_core_add_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info)
{
LinphoneAuthInfo *ai;
MSList *elem;
MSList *l;
/* find if we are attempting to modify an existing auth info */
ai=(LinphoneAuthInfo*)linphone_core_find_auth_info(lc,info->realm,info->username);
@ -255,7 +256,7 @@ void linphone_core_add_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info)
}
lc->auth_info=ms_list_append(lc->auth_info,linphone_auth_info_clone(info));
/* retry pending authentication operations */
for(elem=sal_get_pending_auths(lc->sal);elem!=NULL;elem=elem->next){
for(l=elem=sal_get_pending_auths(lc->sal);elem!=NULL;elem=elem->next){
const char *username,*realm;
SalOp *op=(SalOp*)elem->data;
LinphoneAuthInfo *ai;
@ -271,6 +272,7 @@ void linphone_core_add_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info)
ai->usecount++;
}
}
ms_list_free(l);
}

View file

@ -1177,10 +1177,14 @@ static bool_t process_authentication(Sal *sal, eXosip_event_t *ev){
return TRUE;
}
if (get_auth_data(ev,&realm,&username)==0){
if (op->pending_auth!=NULL)
if (op->pending_auth!=NULL){
eXosip_event_free(op->pending_auth);
op->pending_auth=ev;
sal_add_pending_auth (sal,op);
op->pending_auth=ev;
}else{
op->pending_auth=ev;
sal_add_pending_auth(sal,op);
}
sal->callbacks.auth_requested(op,realm,username);
return FALSE;
}