diff --git a/coreapi/authentication.c b/coreapi/authentication.c index 9c4b937494222ab1a8efa4563c51613b429f4bad..331b962606d1bf4817c926ea08d6a160440bdbb0 100644 --- a/coreapi/authentication.c +++ b/coreapi/authentication.c @@ -359,11 +359,15 @@ void linphone_auth_info_fill_belle_sip_event(const LinphoneAuthInfo *auth_info, * @param[in] username Used only when auth mode is TLS to get a matching client certificate. If empty, look for * any certificate matching domain nane * @param[in] domain Used only when auth mode is TLS to get a matching client certificate. + * @return true if authentication could be processed, false otherwise. + * @note It is not possible to know whether the TLS server requested a client certificate: true is always returned for + * TLS authentication. */ -void linphone_core_fill_belle_sip_auth_event(LinphoneCore *lc, +bool linphone_core_fill_belle_sip_auth_event(LinphoneCore *lc, belle_sip_auth_event *event, const char *username, const char *domain) { + bool done = false; switch (belle_sip_auth_event_get_mode(event)) { case BELLE_SIP_AUTH_MODE_HTTP_DIGEST: { const char *realm = belle_sip_auth_event_get_realm(event); @@ -373,7 +377,10 @@ void linphone_core_fill_belle_sip_auth_event(LinphoneCore *lc, const LinphoneAuthInfo *auth_info = _linphone_core_find_auth_info(lc, realm, username, domain, algorithm, TRUE); - linphone_auth_info_fill_belle_sip_event(auth_info, event); + if (auth_info) { + linphone_auth_info_fill_belle_sip_event(auth_info, event); + done = true; + } } break; case BELLE_SIP_AUTH_MODE_TLS: { /* extract username and domain from the GRUU stored in userData->username */ @@ -419,7 +426,7 @@ void linphone_core_fill_belle_sip_auth_event(LinphoneCore *lc, belle_sip_auth_event_set_client_certificates_chain(event, bs_cert_chain); } } else { - lInfo() << "Could not retrieve any client certificate upon server's request"; + lInfo() << "No TLS client certificate to propose."; // To enable callback: // - create an AuthInfo object with username and domain // - call linphone_core_notify_authentication_requested on it to give the app a chance to fill the @@ -427,13 +434,15 @@ void linphone_core_fill_belle_sip_auth_event(LinphoneCore *lc, // - call again _linphone_core_find_indexed_tls_auth_info to retrieve the auth_info set by the // callback. Not done as we assume that authentication on flexisip server was performed before so the // application layer already got a chance to set the correct auth_info in the core - return; } + done = true; // since we can't know if server requested a client certificate, assume all is good.' } break; default: lError() << "Connection gets an auth event of unexpected type"; + done = false; break; } + return done; } void linphone_core_set_digest_authentication_policy(LinphoneCore *core, LinphoneDigestAuthenticationPolicy *policy) { diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 45920df44cc70cbd411981abeda72a5333453e2d..091b9e127e7c980d7c59f2b53780a24b35c0f267 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -876,7 +876,7 @@ linphone_core_log_collection_handler(const char *domain, OrtpLogLevel level, con #endif } - ortp_gettimeofday(&tp, NULL); + bctbx_gettimeofday(&tp, NULL); tt = (time_t)tp.tv_sec; lt = localtime((const time_t *)&tt); diff --git a/coreapi/private_functions.h b/coreapi/private_functions.h index bd2d4489a2df7a82683df6431269c9192dfadf88..89e2d905b7ddc3b6441e747e743c243618875314 100644 --- a/coreapi/private_functions.h +++ b/coreapi/private_functions.h @@ -179,7 +179,7 @@ const LinphoneAuthInfo *_linphone_core_find_auth_info(LinphoneCore *lc, LinphoneAccount *linphone_core_find_account_by_identity_address(const LinphoneCore *core, const LinphoneAddress *identity_address); void linphone_auth_info_fill_belle_sip_event(const LinphoneAuthInfo *auth_info, belle_sip_auth_event *event); -void linphone_core_fill_belle_sip_auth_event(LinphoneCore *lc, +bool linphone_core_fill_belle_sip_auth_event(LinphoneCore *lc, belle_sip_auth_event *event, const char *username, const char *domain); diff --git a/coreapi/update_check.c b/coreapi/update_check.c index 8cdd5297ddfe404801b623c58b6595d149f53ac9..38620760586d210a50003110bbee564bb83e41bc 100644 --- a/coreapi/update_check.c +++ b/coreapi/update_check.c @@ -105,9 +105,11 @@ static void update_check_process_timeout(void *ctx, BCTBX_UNUSED(const belle_sip update_check_process_terminated(update, LinphoneVersionUpdateCheckError, NULL, NULL); } -static void update_check_process_auth_requested(void *ctx, BCTBX_UNUSED(belle_sip_auth_event_t *event)) { +static void update_check_process_auth_requested(void *ctx, belle_sip_auth_event_t *event) { LinphoneUpdateCheck *update = (LinphoneUpdateCheck *)ctx; - update_check_process_terminated(update, LinphoneVersionUpdateCheckError, NULL, NULL); + if (!linphone_core_fill_belle_sip_auth_event(update->lc, event, nullptr, nullptr)) { + update_check_process_terminated(update, LinphoneVersionUpdateCheckError, NULL, NULL); + } } void linphone_core_check_for_update(LinphoneCore *lc, const char *current_version) { diff --git a/src/nat/stun-client.cpp b/src/nat/stun-client.cpp index 9c6c08a22ff6e6134f77d40c168ef80eec8e20cc..b6af9217d37ff48bff795a84f08904b518fb0938 100644 --- a/src/nat/stun-client.cpp +++ b/src/nat/stun-client.cpp @@ -68,7 +68,7 @@ int StunClient::run(int audioPort, int videoPort, int textPort) { bool coneText = false; double elapsed; struct timeval init; - ortp_gettimeofday(&init, nullptr); + bctbx_gettimeofday(&init, nullptr); do { int id; @@ -106,7 +106,7 @@ int StunClient::run(int audioPort, int videoPort, int textPort) { gotText = true; } struct timeval cur; - ortp_gettimeofday(&cur, nullptr); + bctbx_gettimeofday(&cur, nullptr); elapsed = static_cast<double>(cur.tv_sec - init.tv_sec) * 1000 + static_cast<double>(cur.tv_usec - init.tv_usec) / 1000; if (elapsed > 2000.) { diff --git a/src/recorder/recorder.cpp b/src/recorder/recorder.cpp index 769ae9ef8dcfd326bf03aaf2fe5ef366c00f6518..4f80688a180dce4723733264ded9b4c1c21fcd21 100644 --- a/src/recorder/recorder.cpp +++ b/src/recorder/recorder.cpp @@ -82,7 +82,7 @@ const std::string &Recorder::getFile() const { } LinphoneStatus Recorder::start() { - ortp_gettimeofday(&mStartTime, nullptr); + bctbx_gettimeofday(&mStartTime, nullptr); getPlatformHelpers(getCore()->getCCore())->onRecordingStarted(); return ms_media_recorder_start(mRecorder) ? 0 : -1; } @@ -90,7 +90,7 @@ LinphoneStatus Recorder::start() { LinphoneStatus Recorder::pause() { if (getState() == LinphoneRecorderRunning) { ms_media_recorder_pause(mRecorder); - ortp_gettimeofday(&mEndTime, nullptr); + bctbx_gettimeofday(&mEndTime, nullptr); getPlatformHelpers(getCore()->getCCore())->onRecordingPaused(); return 0; } else return -1; @@ -111,7 +111,7 @@ LinphoneRecorderState Recorder::getState() const { int Recorder::getDuration() const { if (getState() == LinphoneRecorderRunning) { struct timeval cur; - ortp_gettimeofday(&cur, nullptr); + bctbx_gettimeofday(&cur, nullptr); double elapsed = static_cast<double>(cur.tv_sec - mStartTime.tv_sec) * 1000 + static_cast<double>(cur.tv_usec - mStartTime.tv_usec) / 1000; return (int)elapsed; diff --git a/tester/log_collection_tester.c b/tester/log_collection_tester.c index bac297e446cabbb70ee6248e9cb9f85cb95bc6d9..885dc091f399c039816b94fb11bc65b130856f2c 100644 --- a/tester/log_collection_tester.c +++ b/tester/log_collection_tester.c @@ -157,7 +157,7 @@ static time_t get_current_time(void) { struct tm tmbuf; #endif time_t tt; - ortp_gettimeofday(&tp, NULL); + bctbx_gettimeofday(&tp, NULL); tt = (time_t)tp.tv_sec; #ifdef _WIN32