From 43258541231afcaab0de05bad259c4ace4b2ce11 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 11 Feb 2014 11:28:07 +0100 Subject: [PATCH] fix double notification of auth_info_requested() --- coreapi/callbacks.c | 8 +++++--- tester/register_tester.c | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index ab1f5a720..f22d35f20 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -727,10 +727,12 @@ static void auth_failure(SalOp *op, SalAuthInfo* info) { LinphoneAuthInfo *ai=(LinphoneAuthInfo*)linphone_core_find_auth_info(lc,info->realm,info->username,info->domain); if (ai){ ms_message("%s/%s/%s authentication fails.",info->realm,info->username,info->domain); + /*ask again for password if auth info was already supplied but apparently not working*/ + if (lc->vtable.auth_info_requested) { + lc->vtable.auth_info_requested(lc,info->realm,info->username,info->domain); + } } - if (lc->vtable.auth_info_requested) { - lc->vtable.auth_info_requested(lc,info->realm,info->username,info->domain); - } + } static void register_success(SalOp *op, bool_t registered){ diff --git a/tester/register_tester.c b/tester/register_tester.c index b090c9d1b..4705ba13f 100644 --- a/tester/register_tester.c +++ b/tester/register_tester.c @@ -304,7 +304,7 @@ static void authenticated_register_with_late_credentials(){ counters = get_stats(mgr->lc); register_with_refresh_base_2(mgr->lc,FALSE,auth_domain,route,TRUE,transport); - CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,2); /*1 registration error = 2 auth requested*/ + CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,1); linphone_core_manager_destroy(mgr); } @@ -314,7 +314,7 @@ static void authenticated_register_with_wrong_late_credentials(){ LCSipTransports transport = {5070,5070,0,5071}; char route[256]; const char* saved_test_passwd=test_password; - char* wrong_passwd="mot de pass tout pourrit"; + char* wrong_passwd="mot de pass tout pourri"; test_password=wrong_passwd; @@ -324,7 +324,7 @@ static void authenticated_register_with_wrong_late_credentials(){ counters = get_stats(mgr->lc); register_with_refresh_base_3(mgr->lc,FALSE,auth_domain,route,TRUE,transport,LinphoneRegistrationFailed); - CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,3); + CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,2); CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,2); CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationProgress,2); test_password=saved_test_passwd;