Commit cd5be153 authored by Simon Morlat's avatar Simon Morlat

avoid prompting password for ping (OPTIONS) requests

parent 42267c4c
...@@ -602,6 +602,16 @@ static void call_released(SalOp *op){ ...@@ -602,6 +602,16 @@ static void call_released(SalOp *op){
static void auth_requested(SalOp *h, const char *realm, const char *username){ static void auth_requested(SalOp *h, const char *realm, const char *username){
LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(h)); LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(h));
LinphoneAuthInfo *ai=(LinphoneAuthInfo*)linphone_core_find_auth_info(lc,realm,username); 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); ms_message("auth_requested() for realm=%s, username=%s",realm,username);
if (ai && ai->works==FALSE && ai->usecount>=3){ if (ai && ai->works==FALSE && ai->usecount>=3){
......
...@@ -557,6 +557,19 @@ void linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){ ...@@ -557,6 +557,19 @@ void linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){
} }
} }
LinphoneCall * is_a_linphone_call(void *user_pointer){
LinphoneCall *call=(LinphoneCall*)user_pointer;
if (call==NULL) return NULL;
return call->magic==linphone_call_magic ? call : NULL;
}
LinphoneProxyConfig * is_a_linphone_proxy_config(void *user_pointer){
LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)user_pointer;
if (cfg==NULL) return NULL;
return cfg->magic==linphone_proxy_config_magic ? cfg : NULL;
}
#ifdef HAVE_GETIFADDRS #ifdef HAVE_GETIFADDRS
#include <ifaddrs.h> #include <ifaddrs.h>
......
...@@ -75,8 +75,11 @@ struct _LinphoneCallParams{ ...@@ -75,8 +75,11 @@ struct _LinphoneCallParams{
}; };
static const int linphone_call_magic=0x3343;
struct _LinphoneCall struct _LinphoneCall
{ {
int magic; /*used to distinguish from proxy config*/
struct _LinphoneCore *core; struct _LinphoneCore *core;
SalMediaDescription *localdesc; SalMediaDescription *localdesc;
SalMediaDescription *resultdesc; SalMediaDescription *resultdesc;
...@@ -238,9 +241,14 @@ extern SalCallbacks linphone_sal_callbacks; ...@@ -238,9 +241,14 @@ extern SalCallbacks linphone_sal_callbacks;
void linphone_proxy_config_set_error(LinphoneProxyConfig *cfg, LinphoneReason error); void linphone_proxy_config_set_error(LinphoneProxyConfig *cfg, LinphoneReason error);
bool_t linphone_core_rtcp_enabled(const LinphoneCore *lc); bool_t linphone_core_rtcp_enabled(const LinphoneCore *lc);
LinphoneCall * is_a_linphone_call(void *user_pointer);
LinphoneProxyConfig * is_a_linphone_proxy_config(void *user_pointer);
static const int linphone_proxy_config_magic=0x7979;
struct _LinphoneProxyConfig struct _LinphoneProxyConfig
{ {
int magic;
struct _LinphoneCore *lc; struct _LinphoneCore *lc;
char *reg_proxy; char *reg_proxy;
char *reg_identity; char *reg_identity;
......
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