Commit 8cdfef88 authored by Simon Morlat's avatar Simon Morlat
Browse files

fix authentication that wasn't marked as "working".

parent 8d5c47d4
linphone-3.3.0 -- ?????????
* liblinphone is ported to iphoneOS and Google Android
* Internal refactoring of liblinphone (code factorisation, encapsulation
of signaling)
* enhancements made to presence support (SIP/SIMPLE)
linphone-3.2.2 -- ?????????
* improve bitrate usage of speex codec
* allow speex to run with vbr (variable bit rate) mode
* add speex/32000 (ultra wide band speex codec)
* answer empty SIP INFO requests
* reverse order of call logs
* optimize video display
* manual or automatic network connectivity management (so that REGISTERs
are only sent when network is up or refreshed when it comes back)
linphone-3.2.1 -- October 5, 2009
* improve graphics and behaviour of mute button
......
......@@ -329,12 +329,14 @@ static void call_failure(SalOp *op, SalError error, SalReason sr, const char *de
static void auth_requested(SalOp *h, const char *realm, const char *username){
LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(h));
LinphoneAuthInfo *ai=(LinphoneAuthInfo*)linphone_core_find_auth_info(lc,realm,username);
ms_message("auth_requested() for realm=%s, username=%s",realm,username);
if (ai && (ai->works || ai->usecount<3)){
SalAuthInfo sai;
sai.username=ai->username;
sai.userid=ai->userid;
sai.realm=ai->realm;
sai.password=ai->passwd;
ms_message("auth_requested(): authenticating realm=%s, username=%s",realm,username);
sal_op_authenticate(h,&sai);
ai->usecount++;
}else{
......@@ -346,8 +348,10 @@ static void auth_requested(SalOp *h, const char *realm, const char *username){
static void auth_success(SalOp *h, const char *realm, const char *username){
LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(h));
LinphoneAuthInfo *ai=(LinphoneAuthInfo*)linphone_core_find_auth_info(lc,realm,username);
if (ai)
if (ai){
ms_message("%s/%s authentication works.",realm,username);
ai->works=TRUE;
}
}
static void register_success(SalOp *op, bool_t registered){
......
......@@ -1833,6 +1833,10 @@ int linphone_core_invite(LinphoneCore *lc, const char *url)
}
err=sal_call(call->op,from,real_url);
if (lc->sip_conf.sdp_200_ack){
call->media_pending=TRUE;
sal_call_set_local_media_description(call->op,call->localdesc);
}
barmsg=ortp_strdup_printf("%s %s", _("Contacting"), real_url);
lc->vtable.display_status(lc,barmsg);
ms_free(barmsg);
......@@ -1919,10 +1923,16 @@ void linphone_core_init_media_streams(LinphoneCore *lc, LinphoneCall *call){
#endif
}
static int dtmf_tab[16]={'0','1','2','3','4','5','6','7','8','9','*','#','A','B','C','D'};
static void linphone_core_dtmf_received(RtpSession* s, int dtmf, void* user_data){
LinphoneCore* lc = (LinphoneCore*)user_data;
if (dtmf<0 || dtmf>15){
ms_warning("Bad dtmf value %i",dtmf);
return;
}
if (lc->vtable.dtmf_received != NULL)
lc->vtable.dtmf_received(lc, dtmf);
lc->vtable.dtmf_received(lc, dtmf_tab[dtmf]);
}
static void parametrize_equalizer(LinphoneCore *lc, AudioStream *st){
......
......@@ -475,11 +475,13 @@ void sal_op_authenticate(SalOp *h, const SalAuthInfo *info){
const char *userid;
if (info->userid==NULL || info->userid[0]=='\0') userid=info->username;
else userid=info->userid;
ms_message("Authentication info for %s %s added to eXosip", info->username,info->realm);
eXosip_add_authentication_info (info->username,userid,
info->password, NULL,info->realm);
eXosip_lock();
eXosip_default_action(h->pending_auth);
eXosip_unlock();
ms_message("eXosip_default_action() done");
eXosip_clear_authentication_info();
eXosip_event_free(h->pending_auth);
sal_remove_pending_auth(sal_op_get_sal(h),h);
......@@ -660,11 +662,10 @@ static void call_released(Sal *sal, eXosip_event_t *ev){
sal->callbacks.call_failure(op,SalErrorNoResponse,SalReasonUnknown,NULL);
}
static int get_auth_data(eXosip_event_t *ev, const char **realm, const char **username){
static int get_auth_data_from_response(osip_message_t *resp, const char **realm, const char **username){
const char *prx_realm=NULL,*www_realm=NULL;
osip_proxy_authenticate_t *prx_auth;
osip_www_authenticate_t *www_auth;
osip_message_t *resp=ev->response;
*username=osip_uri_get_username(resp->from->url);
prx_auth=(osip_proxy_authenticate_t*)osip_list_get(&resp->proxy_authenticates,0);
......@@ -684,6 +685,30 @@ static int get_auth_data(eXosip_event_t *ev, const char **realm, const char **us
return 0;
}
static int get_auth_data_from_request(osip_message_t *msg, const char **realm, const char **username){
osip_authorization_t *auth=NULL;
osip_proxy_authorization_t *prx_auth=NULL;
*username=osip_uri_get_username(msg->from->url);
osip_message_get_authorization(msg, 0, &auth);
if (auth){
*realm=osip_authorization_get_realm(auth);
return 0;
}
osip_message_get_proxy_authorization(msg,0,&prx_auth);
if (prx_auth){
*realm=osip_proxy_authorization_get_realm(prx_auth);
return 0;
}
return -1;
}
static int get_auth_data(eXosip_event_t *ev, const char **realm, const char **username){
if (ev->response && get_auth_data_from_response(ev->response,realm,username)==0) return 0;
if (ev->request && get_auth_data_from_request(ev->request,realm,username)==0) return 0;
return -1;
}
int sal_op_get_auth_requested(SalOp *op, const char **realm, const char **username){
if (op->pending_auth){
return get_auth_data(op->pending_auth,realm,username);
......
......@@ -208,7 +208,7 @@ static const char *linphone_gtk_get_factory_config_file(){
}
static void linphone_gtk_init_liblinphone(const char *config_file,
const char *factory_config_file) {
const char *factory_config_file) {
linphone_core_set_user_agent("Linphone", LINPHONE_VERSION);
the_core=linphone_core_new(&vtable,config_file,factory_config_file,NULL);
linphone_core_set_waiting_callback(the_core,linphone_gtk_wait,NULL);
......@@ -763,6 +763,7 @@ static void linphone_gtk_bye_recv(LinphoneCore *lc, const char *from){
}
static void linphone_gtk_notify_recv(LinphoneCore *lc, LinphoneFriend * fid){
linphone_gtk_show_friends();
}
static void linphone_gtk_new_subscriber_response(GtkWidget *dialog, guint response_id, LinphoneFriend *lf){
......
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