Commit 01dee974 authored by smorlat's avatar smorlat
Browse files

fix bugs with login window and authentication faillure after several bad attempts from user.

git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@762 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
parent d1899c8b
......@@ -187,19 +187,26 @@ LinphoneAuthInfo *linphone_core_find_auth_info(LinphoneCore *lc, const char *rea
return ret;
}
void linphone_core_add_auth_info(LinphoneCore *lc, LinphoneAuthInfo *info)
{
static void refresh_exosip_auth_info(LinphoneCore *lc){
MSList *elem;
char *userid;
LinphoneAuthInfo *ai;
if (info->userid==NULL || info->userid[0]=='\0') userid=info->username;
else userid=info->userid;
eXosip_lock();
eXosip_add_authentication_info(info->username,userid,
eXosip_clear_authentication_info();
for (elem=lc->auth_info;elem!=NULL;elem=ms_list_next(elem)){
LinphoneAuthInfo *info=(LinphoneAuthInfo*)elem->data;
char *userid;
if (info->userid==NULL || info->userid[0]=='\0') userid=info->username;
else userid=info->userid;
eXosip_add_authentication_info(info->username,userid,
info->passwd,info->ha1,info->realm);
}
eXosip_unlock();
/* if the user was prompted, re-allow automatic_action */
if (lc->automatic_action>0) lc->automatic_action--;
}
void linphone_core_add_auth_info(LinphoneCore *lc, LinphoneAuthInfo *info)
{
MSList *elem;
LinphoneAuthInfo *ai;
/* find if we are attempting to modify an existing auth info */
ai=linphone_core_find_auth_info(lc,info->realm,info->username);
if (ai!=NULL){
......@@ -213,6 +220,9 @@ void linphone_core_add_auth_info(LinphoneCore *lc, LinphoneAuthInfo *info)
}else {
lc->auth_info=ms_list_append(lc->auth_info,(void *)info);
}
refresh_exosip_auth_info(lc);
/* if the user was prompted, re-allow automatic_action */
if (lc->automatic_action>0) lc->automatic_action--;
}
void linphone_core_abort_authentication(LinphoneCore *lc, LinphoneAuthInfo *info){
......@@ -234,6 +244,7 @@ void linphone_core_remove_auth_info(LinphoneCore *lc, LinphoneAuthInfo *info){
for (elem=lc->auth_info,i=0;elem!=NULL;elem=ms_list_next(elem),i++){
linphone_auth_info_write_config(lc->config,(LinphoneAuthInfo*)elem->data,i);
}
refresh_exosip_auth_info(lc);
}
......
......@@ -60,7 +60,10 @@ static int sip_login_do_login(SipSetupContext * ctx, const char *uri, const char
char *tmp;
osip_from_init(&parsed_uri);
osip_from_parse(parsed_uri,uri);
if (osip_from_parse(parsed_uri,uri)==-1){
osip_from_free(parsed_uri);
return -1;
}
if (parsed_uri->displayname==NULL || strlen(parsed_uri->displayname)==0){
guess_display_name(parsed_uri);
}
......
......@@ -136,6 +136,9 @@ void linphone_gtk_login_frame_connect_clicked(GtkWidget *button){
username=gtk_entry_get_text(GTK_ENTRY(linphone_gtk_get_widget(mw,"login_username")));
password=gtk_entry_get_text(GTK_ENTRY(linphone_gtk_get_widget(mw,"login_password")));
if (username==NULL || username[0]=='\0')
return;
autologin=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(mw,"automatic_login")));
linphone_gtk_set_ui_config_int("automatic_login",autologin);
......
......@@ -782,6 +782,14 @@ static void linphone_gtk_auth_info_requested(LinphoneCore *lc, const char *realm
GtkWidget *label=linphone_gtk_get_widget(w,"message");
LinphoneAuthInfo *info;
gchar *msg;
GtkWidget *mw=linphone_gtk_get_main_window();
if (mw && GTK_WIDGET_VISIBLE(linphone_gtk_get_widget(mw,"login_frame"))){
/*don't prompt for authentication when login frame is visible*/
linphone_core_abort_authentication(lc,NULL);
return;
}
msg=g_strdup_printf(_("Please enter your password for username <i>%s</i>\n at domain <i>%s</i>:"),
username,realm);
gtk_label_set_markup(GTK_LABEL(label),msg);
......
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