From aee423ed037f1845c7afffabc2bacf611ea43089 Mon Sep 17 00:00:00 2001 From: smorlat Date: Sun, 12 Oct 2008 09:04:49 +0000 Subject: [PATCH] - improve authentication dialog - fix authentication logic when supplying a bad password git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@81 3f6dc0c8-ddfe-455d-9043-3cd528dc4637 --- linphone/coreapi/authentication.c | 9 ++++----- linphone/coreapi/exevents.c | 14 ++++++++++---- linphone/coreapi/linphonecore.c | 2 +- linphone/coreapi/linphonecore.h | 1 + linphone/gtk-glade/password.glade | 30 ++++++++++++++++-------------- 5 files changed, 32 insertions(+), 24 deletions(-) diff --git a/linphone/coreapi/authentication.c b/linphone/coreapi/authentication.c index cdbbe9c1b..3aded5752 100644 --- a/linphone/coreapi/authentication.c +++ b/linphone/coreapi/authentication.c @@ -248,15 +248,14 @@ void linphone_authentication_ok(LinphoneCore *lc, eXosip_event_t *ev){ void linphone_core_find_or_ask_for_auth_info(LinphoneCore *lc,const char *username,const char* realm, int tid) { - LinphoneAuthInfo *as; - if ((as=linphone_core_auth_info_find(lc,realm,username))==NULL || - (as->works==FALSE && as->first_time==FALSE) ) { - if (lc->vtable.auth_info_requested!=NULL) { + LinphoneAuthInfo *as=linphone_core_auth_info_find(lc,realm,username); + if ( as==NULL || (as!=NULL && as->works==FALSE && as->first_time==FALSE)){ + if (lc->vtable.auth_info_requested!=NULL){ lc->vtable.auth_info_requested(lc,realm,username); lc->automatic_action++;/*suspends eXosip_automatic_action until the user supplies a password */ } - if (as) as->first_time=FALSE; } + if (as) as->first_time=FALSE; } void linphone_process_authentication(LinphoneCore *lc, eXosip_event_t *ev) diff --git a/linphone/coreapi/exevents.c b/linphone/coreapi/exevents.c index fd7a5e064..7fce6f7e8 100644 --- a/linphone/coreapi/exevents.c +++ b/linphone/coreapi/exevents.c @@ -621,7 +621,8 @@ int linphone_accept_audio_offer(sdp_context_t *ctx,sdp_payload_t *payload) LinphoneCall *call=(LinphoneCall*)sdp_context_get_user_pointer(ctx); LinphoneCore *lc=call->core; PayloadType *lpt=NULL; - + + params=&call->audio_params; if (call->profile==NULL){ /* create a remote user agent profile */ call->profile=remote_profile=rtp_profile_new("remote"); @@ -633,8 +634,10 @@ int linphone_accept_audio_offer(sdp_context_t *ctx,sdp_payload_t *payload) ms_message("Refusing audio codec %i (%s)",payload->pt,payload->a_rtpmap); return -1; } - if (supported==SupportedAndValid) { - params=&call->audio_params; + if (lc->sip_conf.only_one_codec && params->initialized){ + return -1; + } + if (supported==SupportedAndValid) { if (params->initialized==0){ /* this is the first codec we accept, it is going to be used*/ params->localport=lc->rtp_conf.audio_rtp_port; @@ -678,6 +681,7 @@ int linphone_accept_video_offer(sdp_context_t *ctx,sdp_payload_t *payload) /* create a remote user agent profile */ call->profile=rtp_profile_new("remote"); } + params=&call->video_params; remote_profile=call->profile; /* see if this codec is supported in our local rtp profile*/ supported=linphone_payload_is_supported(lc,payload,lc->local_profile,remote_profile,TRUE,&lpt); @@ -685,8 +689,10 @@ int linphone_accept_video_offer(sdp_context_t *ctx,sdp_payload_t *payload) ms_message("Refusing video codec %i (%s)",payload->pt,payload->a_rtpmap); return -1; } + if (lc->sip_conf.only_one_codec && params->initialized){ + return -1; + } if (supported==SupportedAndValid){ - params=&call->video_params; if (params->initialized==0){ /* this is the first codec we may accept*/ params->localport=lc->rtp_conf.video_rtp_port; diff --git a/linphone/coreapi/linphonecore.c b/linphone/coreapi/linphonecore.c index 35d647f76..047c1876c 100644 --- a/linphone/coreapi/linphonecore.c +++ b/linphone/coreapi/linphonecore.c @@ -466,7 +466,7 @@ void sip_config_read(LinphoneCore *lc) } /*for test*/ lc->sip_conf.sdp_200_ack=lp_config_get_int(lc->config,"sip","sdp_200_ack",0); - + lc->sip_conf.only_one_codec=lp_config_get_int(lc->config,"sip","only_one_codec",0); } void rtp_config_read(LinphoneCore *lc) diff --git a/linphone/coreapi/linphonecore.h b/linphone/coreapi/linphonecore.h index 3a15beffe..2ced6a2f8 100644 --- a/linphone/coreapi/linphonecore.h +++ b/linphone/coreapi/linphonecore.h @@ -58,6 +58,7 @@ typedef struct sip_config bool_t loopback_only; bool_t ipv6_enabled; bool_t sdp_200_ack; + bool_t only_one_codec; /*in SDP answers*/ } sip_config_t; typedef struct rtp_config diff --git a/linphone/gtk-glade/password.glade b/linphone/gtk-glade/password.glade index e9ebda609..544ad9c08 100644 --- a/linphone/gtk-glade/password.glade +++ b/linphone/gtk-glade/password.glade @@ -1,6 +1,6 @@ - + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK @@ -34,21 +34,22 @@ 2 2 - + True True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + 1 2 + 1 + 2 - - - True - Username - - True @@ -60,18 +61,19 @@ - + + True + Username + + + + True True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - 1 2 - 1 - 2