Commit 767a8589 authored by smorlat's avatar smorlat

fix crash and improve authentication failure processing

git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@345 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
parent 9df7cb68
......@@ -888,7 +888,6 @@ void linphone_call_message_new(LinphoneCore *lc, eXosip_event_t *ev){
#endif
}
void linphone_registration_faillure(LinphoneCore *lc, eXosip_event_t *ev){
int status_code=0;
char *msg;
......@@ -907,6 +906,8 @@ void linphone_registration_faillure(LinphoneCore *lc, eXosip_event_t *ev){
case 407:
linphone_process_authentication(lc,ev);
break;
case 403:
linphone_proxy_config_process_authentication_failure(lc,ev);
default:
msg=ortp_strdup_printf(_("Registration on %s failed: %s"),ru,(reason!=NULL) ? reason : _("no response timeout"));
lc->vtable.display_status(lc,msg);
......@@ -929,7 +930,6 @@ void linphone_registration_success(LinphoneCore *lc,eXosip_event_t *ev){
osip_free(ru);
cfg=linphone_core_get_proxy_config_from_rid(lc,ev->rid);
ms_return_if_fail(cfg!=NULL);
cfg->auth_pending=FALSE;
gstate_new_state(lc, GSTATE_REG_OK, NULL);
osip_message_get_expires(ev->request,0,&h);
if (h!=NULL && atoi(h->hvalue)!=0){
......
......@@ -294,9 +294,9 @@ typedef struct _LinphoneProxyConfig
int rid;
char *type;
struct _SipSetupContext *ssctx;
int auth_failures;
bool_t frozen;
bool_t reg_sendregister;
bool_t auth_pending;
bool_t registered;
bool_t publish;
} LinphoneProxyConfig;
......
......@@ -106,6 +106,7 @@ void linphone_authentication_ok(LinphoneCore *lc, eXosip_event_t *ev);
void linphone_subscription_new(LinphoneCore *lc, eXosip_event_t *ev);
void linphone_notify_recv(LinphoneCore *lc,eXosip_event_t *ev);
LinphoneProxyConfig *linphone_core_get_proxy_config_from_rid(LinphoneCore *lc, int rid);
void linphone_proxy_config_process_authentication_failure(LinphoneCore *lc, eXosip_event_t *ev);
void linphone_subscription_answered(LinphoneCore *lc, eXosip_event_t *ev);
void linphone_subscription_closed(LinphoneCore *lc, eXosip_event_t *ev);
......
......@@ -211,6 +211,7 @@ void linphone_proxy_config_enable_publish(LinphoneProxyConfig *obj, bool_t val){
void linphone_proxy_config_edit(LinphoneProxyConfig *obj){
obj->frozen=TRUE;
obj->auth_failures=0;
if (obj->reg_sendregister){
/* unregister */
if (obj->registered) {
......@@ -498,6 +499,18 @@ const MSList *linphone_core_get_proxy_config_list(const LinphoneCore *lc){
}
void linphone_proxy_config_process_authentication_failure(LinphoneCore *lc, eXosip_event_t *ev){
LinphoneProxyConfig *cfg=linphone_core_get_proxy_config_from_rid(lc, ev->rid);
if (cfg){
cfg->auth_failures++;
/*restart a new register */
if (cfg->auth_failures==1){
linphone_proxy_config_done(cfg);
}
}
}
void linphone_proxy_config_write_to_config_file(LpConfig *config, LinphoneProxyConfig *obj, int index)
{
char key[50];
......
......@@ -32,12 +32,13 @@ static void linphone_gtk_fill_combo_box(GtkWidget *combo, const char **devices,
unless we fill it with a dummy text.
This dummy text needs to be removed first*/
gtk_combo_box_remove_text(GTK_COMBO_BOX(combo),0);
for(;*p!=NULL;++p,++i){
for(;*p!=NULL;++p){
if ( cap==CAP_IGNORE
|| (cap==CAP_CAPTURE && linphone_core_sound_device_can_capture(linphone_gtk_get_core(),*p))
|| (cap==CAP_PLAYBACK && linphone_core_sound_device_can_playback(linphone_gtk_get_core(),*p)) ){
gtk_combo_box_append_text(GTK_COMBO_BOX(combo),*p);
if (strcmp(selected,*p)==0) active=i;
i++;
}
}
gtk_combo_box_set_active(GTK_COMBO_BOX(combo),active);
......
......@@ -119,8 +119,8 @@ const char *linphone_gtk_get_lang(const char *config_file){
break;
}
}
fclose(f);
}
fclose(f);
return linphone_lang;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment