]> sjero.net Git - linphone/commitdiff
fix crash in sal with authenticated requests
authorSimon Morlat <simon.morlat@linphone.org>
Wed, 25 May 2011 10:44:59 +0000 (12:44 +0200)
committerSimon Morlat <simon.morlat@linphone.org>
Wed, 25 May 2011 10:44:59 +0000 (12:44 +0200)
coreapi/authentication.c
coreapi/sal_eXosip2.c

index 24bed1c437dd22f3d9057d4c01e3879b97a6e949..b41b0d70bbdd16dff2d9aba6d282c5b7b548d82a 100644 (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);
 }
 
 
index a0622226c6458e43a61fead124e630124d853838..33ef079c9fd7d8d1478f18a1fd52fb7145f578e7 100644 (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;
        }