Commit aee423ed authored by smorlat's avatar smorlat

- 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
parent 54daa12c
......@@ -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)
......
......@@ -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;
......
......@@ -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)
......
......@@ -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
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.4.5 on Fri Oct 10 09:00:39 2008 -->
<!--Generated with glade3 3.4.5 on Sat Oct 11 20:34:33 2008 -->
<glade-interface>
<widget class="GtkDialog" id="password">
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
......@@ -34,21 +34,22 @@
<property name="n_rows">2</property>
<property name="n_columns">2</property>
<child>
<widget class="GtkEntry" id="username_entry">
<widget class="GtkEntry" id="password_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="is_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="visibility">False</property>
<signal name="activate" handler="linphone_gtk_password_ok"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="label" translatable="yes">Username</property>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
......@@ -60,18 +61,19 @@
</packing>
</child>
<child>
<widget class="GtkEntry" id="password_entry">
<widget class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="label" translatable="yes">Username</property>
</widget>
</child>
<child>
<widget class="GtkEntry" id="username_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="visibility">False</property>
<signal name="activate" handler="linphone_gtk_password_ok"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
</widget>
......
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