Commit 811b453d authored by Simon Morlat's avatar Simon Morlat

add a domain parameter in LinphoneAuthInfo, to workaround non-unicity of realm in real world.

parent 2c087aa8
......@@ -117,8 +117,7 @@ static char **linephonec_readline_completion(const char *text,
#endif
/* These are callback for linphone core */
static void linphonec_prompt_for_auth(LinphoneCore *lc, const char *realm,
const char *username);
static void linphonec_prompt_for_auth(LinphoneCore *lc, const char *realm, const char *username, const char *domain);
static void linphonec_display_refer (LinphoneCore * lc, const char *refer_to);
static void linphonec_display_something (LinphoneCore * lc, const char *something);
static void linphonec_display_url (LinphoneCore * lc, const char *something, const char *url);
......@@ -256,7 +255,7 @@ linphonec_display_url (LinphoneCore * lc, const char *something, const char *url
* Linphone core callback
*/
static void
linphonec_prompt_for_auth(LinphoneCore *lc, const char *realm, const char *username)
linphonec_prompt_for_auth(LinphoneCore *lc, const char *realm, const char *username, const char *domain)
{
/* no prompt possible when using pipes or tcp mode*/
if (unix_socket){
......
......@@ -37,9 +37,7 @@
* The object can be created empty, that is with all arguments set to NULL.
* Username, userid, password and realm can be set later using specific methods.
**/
LinphoneAuthInfo *linphone_auth_info_new(const char *username, const char *userid,
const char *passwd, const char *ha1,const char *realm)
{
LinphoneAuthInfo *linphone_auth_info_new(const char *username, const char *userid, const char *passwd, const char *ha1,const char *realm){
LinphoneAuthInfo *obj=ms_new0(LinphoneAuthInfo,1);
if (username!=NULL && (strlen(username)>0) ) obj->username=ms_strdup(username);
if (userid!=NULL && (strlen(userid)>0)) obj->userid=ms_strdup(userid);
......@@ -57,6 +55,7 @@ static LinphoneAuthInfo *linphone_auth_info_clone(const LinphoneAuthInfo *ai){
if (ai->passwd) obj->passwd=ms_strdup(ai->passwd);
if (ai->ha1) obj->ha1=ms_strdup(ai->ha1);
if (ai->realm) obj->realm=ms_strdup(ai->realm);
if (ai->domain) obj->domain=ms_strdup(ai->domain);
obj->works=FALSE;
obj->usecount=0;
return obj;
......@@ -83,6 +82,11 @@ const char *linphone_auth_info_get_userid(const LinphoneAuthInfo *i){
const char *linphone_auth_info_get_realm(const LinphoneAuthInfo *i){
return i->realm;
}
const char *linphone_auth_info_get_domain(const LinphoneAuthInfo *i){
return i->domain;
}
const char *linphone_auth_info_get_ha1(const LinphoneAuthInfo *i){
return i->ha1;
}
......@@ -121,7 +125,7 @@ void linphone_auth_info_set_userid(LinphoneAuthInfo *info, const char *userid){
}
/**
* Sets realm.
* Set realm.
**/
void linphone_auth_info_set_realm(LinphoneAuthInfo *info, const char *realm){
if (info->realm){
......@@ -130,6 +134,19 @@ void linphone_auth_info_set_realm(LinphoneAuthInfo *info, const char *realm){
}
if (realm && strlen(realm)>0) info->realm=ms_strdup(realm);
}
/**
* Set domain for which this authentication is valid. This should not be necessary because realm is supposed to be unique and sufficient.
* However, many SIP servers don't set realm correctly, then domain has to be used to distinguish between several SIP account bearing the same username.
**/
void linphone_auth_info_set_domain(LinphoneAuthInfo *info, const char *domain){
if (info->domain){
ms_free(info->domain);
info->domain=NULL;
}
if (domain && strlen(domain)>0) info->domain=ms_strdup(domain);
}
/**
* Sets ha1.
**/
......@@ -150,6 +167,7 @@ void linphone_auth_info_destroy(LinphoneAuthInfo *obj){
if (obj->passwd!=NULL) ms_free(obj->passwd);
if (obj->ha1!=NULL) ms_free(obj->ha1);
if (obj->realm!=NULL) ms_free(obj->realm);
if (obj->domain!=NULL) ms_free(obj->domain);
ms_free(obj);
}
......@@ -181,12 +199,16 @@ void linphone_auth_info_write_config(LpConfig *config, LinphoneAuthInfo *obj, in
if (obj->realm!=NULL){
lp_config_set_string(config,key,"realm",obj->realm);
}
if (obj->domain!=NULL){
lp_config_set_string(config,key,"domain",obj->domain);
}
}
LinphoneAuthInfo *linphone_auth_info_new_from_config_file(LpConfig * config, int pos)
{
char key[50];
const char *username,*userid,*passwd,*ha1,*realm;
const char *username,*userid,*passwd,*ha1,*realm,*domain;
LinphoneAuthInfo *ret;
sprintf(key,"auth_info_%i",pos);
if (!lp_config_has_section(config,key)){
......@@ -198,14 +220,10 @@ LinphoneAuthInfo *linphone_auth_info_new_from_config_file(LpConfig * config, int
passwd=lp_config_get_string(config,key,"passwd",NULL);
ha1=lp_config_get_string(config,key,"ha1",NULL);
realm=lp_config_get_string(config,key,"realm",NULL);
return linphone_auth_info_new(username,userid,passwd,ha1,realm);
}
static bool_t key_match(const char *tmp1, const char *tmp2){
if (tmp1==NULL && tmp2==NULL) return TRUE;
if (tmp1!=NULL && tmp2!=NULL && strcmp(tmp1,tmp2)==0) return TRUE;
return FALSE;
domain=lp_config_get_string(config,key,"domain",NULL);
ret=linphone_auth_info_new(username,userid,passwd,ha1,realm);
linphone_auth_info_set_domain(ret,domain);
return ret;
}
static char * remove_quotes(char * input){
......@@ -234,41 +252,56 @@ static int realm_match(const char *realm1, const char *realm2){
return FALSE;
}
/**
* Retrieves a LinphoneAuthInfo previously entered into the LinphoneCore.
**/
const LinphoneAuthInfo *linphone_core_find_auth_info(LinphoneCore *lc, const char *realm, const char *username)
{
static const LinphoneAuthInfo *find_auth_info(LinphoneCore *lc, const char *username, const char *realm, const char *domain){
MSList *elem;
LinphoneAuthInfo *ret=NULL,*candidate=NULL;
const LinphoneAuthInfo *ret=NULL;
for (elem=lc->auth_info;elem!=NULL;elem=elem->next){
LinphoneAuthInfo *pinfo=(LinphoneAuthInfo*)elem->data;
if (realm==NULL){
/*return the authinfo for any realm provided that there is only one for that username*/
if (key_match(pinfo->username,username)){
if (ret!=NULL){
ms_warning("There are several auth info for username '%s'",username);
return NULL;
if (username && pinfo->username && strcmp(username,pinfo->username)==0){
if (realm && domain){
if (pinfo->realm && strcmp(realm,pinfo->realm)==0
&& pinfo->domain && strcmp(domain,pinfo->domain)==0){
return pinfo;
}
ret=pinfo;
}
}else{
/*return the exact authinfo, or an authinfo for which realm was not supplied yet*/
if (pinfo->realm!=NULL){
if (realm_match(pinfo->realm,realm)
&& key_match(pinfo->username,username))
}else if (realm){
if (pinfo->realm && realm_match(realm,pinfo->realm)){
if (ret!=NULL){
ms_warning("Non unique realm found for %s",username);
return NULL;
}
ret=pinfo;
}else{
if (key_match(pinfo->username,username))
candidate=pinfo;
}
}
}else return pinfo;
}
}
if (ret==NULL && candidate!=NULL)
ret=candidate;
return ret;
}
/**
* Find authentication info matching realm, username, domain criterias.
* First of all, (realm,username) pair are searched. If multiple results (which should not happen because realm are supposed to be unique), then domain is added to the search.
* @param lc the LinphoneCore
* @param realm the authentication 'realm' (optional)
* @param username the SIP username to be authenticated (mandatory)
* @param domain the SIP domain name (optional)
* @return a #LinphoneAuthInfo
**/
const LinphoneAuthInfo *linphone_core_find_auth_info(LinphoneCore *lc, const char *realm, const char *username, const char *domain){
const LinphoneAuthInfo *ai=NULL;
if (realm){
ai=find_auth_info(lc,username,realm,NULL);
if (ai==NULL && domain){
ai=find_auth_info(lc,username,realm,domain);
}
}
if (ai==NULL){
ai=find_auth_info(lc,username,NULL,NULL);
}
return ai;
}
static void write_auth_infos(LinphoneCore *lc){
MSList *elem;
int i;
......@@ -297,7 +330,7 @@ void linphone_core_add_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info)
MSList *l;
/* find if we are attempting to modify an existing auth info */
ai=(LinphoneAuthInfo*)linphone_core_find_auth_info(lc,info->realm,info->username);
ai=(LinphoneAuthInfo*)linphone_core_find_auth_info(lc,info->realm,info->username,info->domain);
if (ai!=NULL){
lc->auth_info=ms_list_remove(lc->auth_info,ai);
linphone_auth_info_destroy(ai);
......@@ -309,7 +342,7 @@ void linphone_core_add_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info)
SalOp *op=(SalOp*)elem->data;
LinphoneAuthInfo *ai;
sal_op_get_auth_requested(op,&realm,&username);
ai=(LinphoneAuthInfo*)linphone_core_find_auth_info(lc,realm,username);
ai=(LinphoneAuthInfo*)linphone_core_find_auth_info(lc,realm,username,info->domain);
if (ai){
SalAuthInfo sai;
MSList* proxy;
......@@ -346,7 +379,7 @@ void linphone_core_abort_authentication(LinphoneCore *lc, LinphoneAuthInfo *inf
**/
void linphone_core_remove_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info){
LinphoneAuthInfo *r;
r=(LinphoneAuthInfo*)linphone_core_find_auth_info(lc,info->realm,info->username);
r=(LinphoneAuthInfo*)linphone_core_find_auth_info(lc,info->realm,info->username,info->domain);
if (r){
lc->auth_info=ms_list_remove(lc->auth_info,r);
/*printf("len=%i newlen=%i\n",len,newlen);*/
......
......@@ -433,15 +433,8 @@ void sal_set_callbacks(Sal *ctx, const SalCallbacks *cbs){
ctx->callbacks.call_released=(SalOnCallReleased)unimplemented_stub;
if (ctx->callbacks.call_updating==NULL)
ctx->callbacks.call_updating=(SalOnCallUpdating)unimplemented_stub;
if (ctx->callbacks.auth_requested_legacy==NULL)
ctx->callbacks.auth_requested_legacy=(SalOnAuthRequestedLegacy)unimplemented_stub;
#ifdef USE_BELLESIP
if (ctx->callbacks.auth_failure==NULL)
ctx->callbacks.auth_failure=(SalOnAuthFailure)unimplemented_stub;
#else
if (ctx->callbacks.auth_success==NULL)
ctx->callbacks.auth_success=(SalOnAuthSuccess)unimplemented_stub;
#endif
if (ctx->callbacks.register_success==NULL)
ctx->callbacks.register_success=(SalOnRegisterSuccess)unimplemented_stub;
if (ctx->callbacks.register_failure==NULL)
......@@ -702,8 +695,9 @@ const char * sal_get_dns_user_hosts_file(const Sal *sal) {
SalAuthInfo* sal_auth_info_create(belle_sip_auth_event_t* event) {
SalAuthInfo* auth_info = sal_auth_info_new();
auth_info->realm = ms_strdup(belle_sip_auth_event_get_realm(event)) ;
auth_info->username = ms_strdup(belle_sip_auth_event_get_username(event)) ;
auth_info->realm = ms_strdup(belle_sip_auth_event_get_realm(event));
auth_info->username = ms_strdup(belle_sip_auth_event_get_username(event));
auth_info->domain = ms_strdup(belle_sip_auth_event_get_domain(event));
return auth_info;
}
......
......@@ -718,68 +718,17 @@ static void call_released(SalOp *op){
}else ms_error("call_released() for already destroyed call ?");
}
static void auth_requested_legacy(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);
LinphoneCall *call=is_a_linphone_call(sal_op_get_user_pointer(h));
if (call && call->ping_op==h){
/*don't request authentication for ping requests. Their purpose is just to get any
* answer to get the Via's received and rport parameters.
*/
ms_message("auth_requested(): ignored for ping request.");
return;
}
ms_message("auth_requested() for realm=%s, username=%s",realm,username);
if (ai && ai->works==FALSE && ai->usecount>=3){
/*case we tried 3 times to authenticate, without success */
/*Better is to stop (implemeted below in else statement), and retry later*/
if (ms_time(NULL)-ai->last_use_time>30){
ai->usecount=0; /*so that we can allow to retry */
}
}
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++;
ai->last_use_time=ms_time(NULL);
}else{
if (ai && ai->works==FALSE) {
sal_op_cancel_authentication(h);
}
if (lc->vtable.auth_info_requested)
lc->vtable.auth_info_requested(lc,realm,username);
}
}
#ifdef USE_BELLESIP
static void auth_failure(SalOp *op, SalAuthInfo* info) {
LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op));
LinphoneAuthInfo *ai=(LinphoneAuthInfo*)linphone_core_find_auth_info(lc,info->realm,info->username);
LinphoneAuthInfo *ai=(LinphoneAuthInfo*)linphone_core_find_auth_info(lc,info->realm,info->username,info->domain);
if (ai){
ms_message("%s/%s authentication fails.",info->realm,info->username);
ms_message("%s/%s/%s authentication fails.",info->realm,info->username,info->domain);
}
if (lc->vtable.auth_info_requested) {
lc->vtable.auth_info_requested(lc,info->realm,info->username);
}
}
#else
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){
ms_message("%s/%s authentication works.",realm,username);
ai->works=TRUE;
lc->vtable.auth_info_requested(lc,info->realm,info->username,info->domain);
}
}
#endif
static void register_success(SalOp *op, bool_t registered){
LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op));
LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)sal_op_get_user_pointer(op);
......@@ -837,13 +786,6 @@ static void register_failure(SalOp *op, SalError error, SalReason reason, const
cfg->publish_op=NULL;
cfg->send_publish=cfg->publish;
}
if (error== SalErrorFailure && reason == SalReasonForbidden) {
const char *realm=NULL,*username=NULL;
if (sal_op_get_auth_requested(op,&realm,&username)==0){
if (lc->vtable.auth_info_requested)
lc->vtable.auth_info_requested(lc,realm,username);
}
}
}
static void vfu_request(SalOp *op){
......@@ -961,7 +903,7 @@ static void ping_reply(SalOp *op){
}
static bool_t fill_auth_info(LinphoneCore *lc, SalAuthInfo* sai) {
LinphoneAuthInfo *ai=(LinphoneAuthInfo*)linphone_core_find_auth_info(lc,sai->realm,sai->username);
LinphoneAuthInfo *ai=(LinphoneAuthInfo*)linphone_core_find_auth_info(lc,sai->realm,sai->username,sai->domain);
if (ai) {
sai->userid=ms_strdup(ai->userid?ai->userid:ai->username);
sai->password=ai->passwd?ms_strdup(ai->passwd):NULL;
......@@ -979,7 +921,7 @@ static bool_t auth_requested(Sal* sal, SalAuthInfo* sai) {
return TRUE;
} else {
if (lc->vtable.auth_info_requested) {
lc->vtable.auth_info_requested(lc,sai->realm,sai->username);
lc->vtable.auth_info_requested(lc,sai->realm,sai->username,sai->domain);
if (fill_auth_info(lc,sai)) {
return TRUE;
}
......@@ -1145,12 +1087,7 @@ SalCallbacks linphone_sal_callbacks={
call_terminated,
call_failure,
call_released,
auth_requested_legacy,
#ifdef USE_BELLESIP
auth_failure,
#else
auth_success,
#endif
register_success,
register_failure,
vfu_request,
......
......@@ -856,12 +856,14 @@ LINPHONE_PUBLIC void linphone_auth_info_set_passwd(LinphoneAuthInfo *info, const
LINPHONE_PUBLIC void linphone_auth_info_set_username(LinphoneAuthInfo *info, const char *username);
LINPHONE_PUBLIC void linphone_auth_info_set_userid(LinphoneAuthInfo *info, const char *userid);
LINPHONE_PUBLIC void linphone_auth_info_set_realm(LinphoneAuthInfo *info, const char *realm);
LINPHONE_PUBLIC void linphone_auth_info_set_domain(LinphoneAuthInfo *info, const char *domain);
LINPHONE_PUBLIC void linphone_auth_info_set_ha1(LinphoneAuthInfo *info, const char *ha1);
LINPHONE_PUBLIC const char *linphone_auth_info_get_username(const LinphoneAuthInfo *i);
LINPHONE_PUBLIC const char *linphone_auth_info_get_passwd(const LinphoneAuthInfo *i);
LINPHONE_PUBLIC const char *linphone_auth_info_get_userid(const LinphoneAuthInfo *i);
LINPHONE_PUBLIC const char *linphone_auth_info_get_realm(const LinphoneAuthInfo *i);
LINPHONE_PUBLIC const char *linphone_auth_info_get_domain(const LinphoneAuthInfo *i);
LINPHONE_PUBLIC const char *linphone_auth_info_get_ha1(const LinphoneAuthInfo *i);
/* you don't need those function*/
......@@ -1043,7 +1045,7 @@ typedef void (*LinphoneCoreNewSubscriptionRequestedCb)(LinphoneCore *lc, Linphon
* @param username the username that needs to be authenticated.
* Application shall reply to this callback using linphone_core_add_auth_info().
*/
typedef void (*LinphoneCoreAuthInfoRequestedCb)(LinphoneCore *lc, const char *realm, const char *username);
typedef void (*LinphoneCoreAuthInfoRequestedCb)(LinphoneCore *lc, const char *realm, const char *username, const char *domain);
/**
* Callback to notify a new call-log entry has been added.
......@@ -1427,10 +1429,10 @@ LINPHONE_PUBLIC int linphone_core_get_default_proxy(LinphoneCore *lc, LinphonePr
* Create an authentication information with default values from Linphone core.
* @param[in] lc #LinphoneCore object
* @param[in] username String containing the username part of the authentication credentials
* @param[in] userid String containing the username to use to calculate the authentication digest
* @param[in] passwd String containing the password part of the authentication credentials
* @param[in] ha1 String containing a hash of the password
* @param[in] realm String used to discriminate different SIP domains
* @param[in] userid String containing the username to use to calculate the authentication digest (optional)
* @param[in] passwd String containing the password of the authentication credentials (optional, either passwd or ha1 must be set)
* @param[in] ha1 String containing a ha1 hash of the password (optional, either passwd or ha1 must be set)
* @param[in] realm String used to discriminate different SIP authentication domains (optional)
* @return #LinphoneAuthInfo with default values set
* @ingroup authentication
*/
......@@ -1438,13 +1440,13 @@ LINPHONE_PUBLIC LinphoneAuthInfo * linphone_core_create_auth_info(LinphoneCore *
LINPHONE_PUBLIC void linphone_core_add_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info);
void linphone_core_remove_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info);
LINPHONE_PUBLIC void linphone_core_remove_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info);
LINPHONE_PUBLIC const MSList *linphone_core_get_auth_info_list(const LinphoneCore *lc);
const LinphoneAuthInfo *linphone_core_find_auth_info(LinphoneCore *lc, const char *realm, const char *username);
LINPHONE_PUBLIC const LinphoneAuthInfo *linphone_core_find_auth_info(LinphoneCore *lc, const char *realm, const char *username, const char *sip_domain);
void linphone_core_abort_authentication(LinphoneCore *lc, LinphoneAuthInfo *info);
LINPHONE_PUBLIC void linphone_core_abort_authentication(LinphoneCore *lc, LinphoneAuthInfo *info);
LINPHONE_PUBLIC void linphone_core_clear_all_auth_info(LinphoneCore *lc);
......
......@@ -417,6 +417,7 @@ struct _LinphoneAuthInfo
char *userid;
char *passwd;
char *ha1;
char *domain;
int usecount;
time_t last_use_time;
bool_t works;
......
......@@ -472,16 +472,18 @@ SalAuthInfo* sal_auth_info_clone(const SalAuthInfo* auth_info) {
new_auth_info->username=auth_info->username?ms_strdup(auth_info->username):NULL;
new_auth_info->userid=auth_info->userid?ms_strdup(auth_info->userid):NULL;
new_auth_info->realm=auth_info->realm?ms_strdup(auth_info->realm):NULL;
new_auth_info->domain=auth_info->realm?ms_strdup(auth_info->domain):NULL;
new_auth_info->password=auth_info->password?ms_strdup(auth_info->password):NULL;
return new_auth_info;
}
void sal_auth_info_delete(const SalAuthInfo* auth_info) {
void sal_auth_info_delete(SalAuthInfo* auth_info) {
if (auth_info->username) ms_free(auth_info->username);
if (auth_info->userid) ms_free(auth_info->userid);
if (auth_info->realm) ms_free(auth_info->realm);
if (auth_info->domain) ms_free(auth_info->domain);
if (auth_info->password) ms_free(auth_info->password);
ms_free((void*)auth_info);
ms_free(auth_info);
}
......
......@@ -102,7 +102,7 @@ void linphone_gtk_show_login_frame(LinphoneProxyConfig *cfg){
linphone_address_set_username(from,username);
}
ai=linphone_core_find_auth_info(lc,linphone_proxy_config_get_domain(cfg),linphone_address_get_username(from));
ai=linphone_core_find_auth_info(lc,linphone_proxy_config_get_domain(cfg),linphone_address_get_username(from),NULL);
/*display the last entered username, if not '?????'*/
if (linphone_address_get_username(from)[0]!='?')
gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(mw,"login_username")),
......
......@@ -55,7 +55,7 @@ static GtkWidget *the_ui=NULL;
static void linphone_gtk_registration_state_changed(LinphoneCore *lc, LinphoneProxyConfig *cfg, LinphoneRegistrationState rs, const char *msg);
static void linphone_gtk_notify_recv(LinphoneCore *lc, LinphoneFriend * fid);
static void linphone_gtk_new_unknown_subscriber(LinphoneCore *lc, LinphoneFriend *lf, const char *url);
static void linphone_gtk_auth_info_requested(LinphoneCore *lc, const char *realm, const char *username);
static void linphone_gtk_auth_info_requested(LinphoneCore *lc, const char *realm, const char *username, const char *domain);
static void linphone_gtk_display_status(LinphoneCore *lc, const char *status);
static void linphone_gtk_display_message(LinphoneCore *lc, const char *msg);
static void linphone_gtk_display_warning(LinphoneCore *lc, const char *warning);
......@@ -1021,7 +1021,7 @@ void linphone_gtk_password_ok(GtkWidget *w){
gtk_widget_destroy(window);
}
static void linphone_gtk_auth_info_requested(LinphoneCore *lc, const char *realm, const char *username){
static void linphone_gtk_auth_info_requested(LinphoneCore *lc, const char *realm, const char *username, const char *domain){
GtkWidget *w=linphone_gtk_create_window("password");
GtkWidget *label=linphone_gtk_get_widget(w,"message");
LinphoneAuthInfo *info;
......@@ -1034,12 +1034,13 @@ static void linphone_gtk_auth_info_requested(LinphoneCore *lc, const char *realm
return;
}
msg=g_strdup_printf(_("Please enter your password for username <i>%s</i>\n at domain <i>%s</i>:"),
msg=g_strdup_printf(_("Please enter your password for username <i>%s</i>\n at realm <i>%s</i>:"),
username,realm);
gtk_label_set_markup(GTK_LABEL(label),msg);
g_free(msg);
gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(w,"userid_entry")),username);
info=linphone_auth_info_new(username, NULL, NULL, NULL,realm);
linphone_auth_info_set_domain(info,domain);
g_object_set_data(G_OBJECT(w),"auth_info",info);
g_object_weak_ref(G_OBJECT(w),(GWeakNotify)linphone_auth_info_destroy,info);
gtk_widget_show(w);
......
......@@ -336,6 +336,7 @@ typedef struct SalAuthInfo{
char *userid;
char *password;
char *realm;
char *domain;
char *ha1;
}SalAuthInfo;
......@@ -356,11 +357,7 @@ typedef void (*SalOnCallFailure)(SalOp *op, SalError error, SalReason reason, co
typedef void (*SalOnCallReleased)(SalOp *salop);
typedef void (*SalOnAuthRequestedLegacy)(SalOp *op, const char *realm, const char *username);
typedef bool_t (*SalOnAuthRequested)(Sal *sal,SalAuthInfo* info);
#ifndef USE_BELLESIP
typedef void (*SalOnAuthSuccess)(SalOp *op, const char *realm, const char *username);
#else
typedef void (*SalOnAuthFailure)(SalOp *op, SalAuthInfo* info);
#endif
typedef void (*SalOnRegisterSuccess)(SalOp *op, bool_t registered);
typedef void (*SalOnRegisterFailure)(SalOp *op, SalError error, SalReason reason, const char *details);
typedef void (*SalOnVfuRequest)(SalOp *op);
......@@ -395,12 +392,7 @@ typedef struct SalCallbacks{
SalOnCallTerminated call_terminated;
SalOnCallFailure call_failure;
SalOnCallReleased call_released;
SalOnAuthRequestedLegacy auth_requested_legacy;
#ifdef USE_BELLESIP
SalOnAuthFailure auth_failure;
#else
SalOnAuthSuccess auth_success;
#endif
SalOnRegisterSuccess register_success;
SalOnRegisterFailure register_failure;
SalOnVfuRequest vfu_request;
......@@ -429,7 +421,7 @@ typedef struct SalCallbacks{
SalAuthInfo* sal_auth_info_new();
SalAuthInfo* sal_auth_info_clone(const SalAuthInfo* auth_info);
void sal_auth_info_delete(const SalAuthInfo* auth_info);
void sal_auth_info_delete(SalAuthInfo* auth_info);
LINPHONE_PUBLIC int sal_auth_compute_ha1(const char* userid,const char* realm,const char* password, char ha1[33]);
void sal_set_callbacks(Sal *ctx, const SalCallbacks *cbs);
......
......@@ -70,7 +70,7 @@ LinphoneAddress * create_linphone_address(const char * domain) {
return addr;
}
void auth_info_requested(LinphoneCore *lc, const char *realm, const char *username) {
void auth_info_requested(LinphoneCore *lc, const char *realm, const char *username, const char *domain) {
stats* counters;
LinphoneAuthInfo *info;
ms_message("Auth info requested for user id [%s] at realm [%s]\n"
......
......@@ -195,7 +195,7 @@ void text_message_received(LinphoneCore *lc, LinphoneChatRoom *room, const Linph
void message_received(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage* message);
void info_message_received(LinphoneCore *lc, LinphoneCall *call, const LinphoneInfoMessage *msg);
void new_subscription_requested(LinphoneCore *lc, LinphoneFriend *lf, const char *url);
void auth_info_requested(LinphoneCore *lc, const char *realm, const char *username);
void auth_info_requested(LinphoneCore *lc, const char *realm, const char *username, const char *domain);
void linphone_subscription_state_change(LinphoneCore *lc, LinphoneEvent *ev, LinphoneSubscriptionState state);
void linphone_publish_state_changed(LinphoneCore *lc, LinphoneEvent *ev, LinphonePublishState state);
void linphone_notify_received(LinphoneCore *lc, LinphoneEvent *lev, const char *eventname, const LinphoneContent *content);
......
......@@ -268,7 +268,7 @@ static void authenticated_register_with_no_initial_credentials(){
linphone_core_manager_destroy(mgr);
}
static void auth_info_requested2(LinphoneCore *lc, const char *realm, const char *username) {
static void auth_info_requested2(LinphoneCore *lc, const char *realm, const char *username, const char *domain) {
stats* counters;
ms_message("Auth info requested for user id [%s] at realm [%s]\n"
,username
......
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