Commit 2d533416 authored by Matthieu Tanon's avatar Matthieu Tanon

First corrections based on merge review

parent 5bf36458
......@@ -866,7 +866,7 @@ LinphoneAccountCreatorStatus linphone_account_creator_create_account_linphone(Li
return LinphoneAccountCreatorStatusRequestFailed;
}
static void _delete_account_cb_custom(LinphoneXmlRpcRequest *request) {
static void _delete_linphone_account_response_cb(LinphoneXmlRpcRequest *request) {
LinphoneAccountCreator *creator = (LinphoneAccountCreator *)linphone_xml_rpc_request_get_user_data(request);
if (creator->cbs->delete_account_response_cb != NULL) {
LinphoneAccountCreatorStatus status = LinphoneAccountCreatorStatusRequestFailed;
......@@ -883,7 +883,6 @@ static void _delete_account_cb_custom(LinphoneXmlRpcRequest *request) {
}
LinphoneAccountCreatorStatus linphone_account_creator_delete_account_linphone(LinphoneAccountCreator *creator) {
LinphoneXmlRpcRequest *request;
if ((!creator->username && !creator->phone_number) || !creator->password) {
return LinphoneAccountCreatorStatusMissingArguments;
}
......@@ -893,12 +892,12 @@ LinphoneAccountCreatorStatus linphone_account_creator_delete_account_linphone(Li
creator->password,
linphone_proxy_config_get_domain(creator->proxy_cfg));
request = linphone_xml_rpc_request_new(LinphoneXmlRpcArgString, "delete_account");
LinphoneXmlRpcRequest *request = linphone_xml_rpc_request_new(LinphoneXmlRpcArgString, "delete_account");
linphone_xml_rpc_request_add_string_arg(request, creator->username ? creator->username : creator->phone_number);
linphone_xml_rpc_request_add_string_arg(request, creator->password);
linphone_xml_rpc_request_add_string_arg(request, linphone_proxy_config_get_domain(creator->proxy_cfg));
linphone_xml_rpc_request_set_user_data(request, creator);
linphone_xml_rpc_request_cbs_set_response(linphone_xml_rpc_request_get_callbacks(request), _delete_account_cb_custom);
linphone_xml_rpc_request_cbs_set_response(linphone_xml_rpc_request_get_callbacks(request), _delete_linphone_account_response_cb);
linphone_xml_rpc_session_send_request(creator->xmlrpc_session, request);
linphone_xml_rpc_request_unref(request);
......@@ -986,7 +985,7 @@ LinphoneAccountCreatorStatus linphone_account_creator_activate_email_account_lin
return LinphoneAccountCreatorStatusRequestFailed;
}
static void _get_confirmation_key_cb_custom(LinphoneXmlRpcRequest *request) {
static void get_linphone_confirmation_key_response_cb(LinphoneXmlRpcRequest *request) {
LinphoneAccountCreator *creator = (LinphoneAccountCreator *)linphone_xml_rpc_request_get_user_data(request);
if (creator->cbs->get_confirmation_key_response_cb != NULL) {
LinphoneAccountCreatorStatus status = LinphoneAccountCreatorStatusRequestFailed;
......@@ -1002,15 +1001,12 @@ static void _get_confirmation_key_cb_custom(LinphoneXmlRpcRequest *request) {
status = LinphoneAccountCreatorStatusRequestOk;
set_string(&creator->activation_code, resp, FALSE);
}
} else {
}
creator->cbs->get_confirmation_key_response_cb(creator, status, resp);
} else {
}
}
LinphoneAccountCreatorStatus linphone_account_creator_get_confirmation_key_linphone(LinphoneAccountCreator *creator) {
LinphoneXmlRpcRequest *request;
if (!creator->username || !creator->password) {
if (creator->cbs->get_confirmation_key_response_cb != NULL) {
creator->cbs->get_confirmation_key_response_cb(creator, LinphoneAccountCreatorStatusMissingArguments, "Missing required parameters");
......@@ -1023,13 +1019,13 @@ LinphoneAccountCreatorStatus linphone_account_creator_get_confirmation_key_linph
creator->password,
linphone_proxy_config_get_domain(creator->proxy_cfg));
request = linphone_xml_rpc_request_new(LinphoneXmlRpcArgString, "get_confirmation_key");
LinphoneXmlRpcRequest *request = linphone_xml_rpc_request_new(LinphoneXmlRpcArgString, "get_confirmation_key");
linphone_xml_rpc_request_add_string_arg(request, creator->username);
linphone_xml_rpc_request_add_string_arg(request, ha1_for_passwd(creator->username, linphone_proxy_config_get_domain(creator->proxy_cfg), creator->password, creator->algorithm));
linphone_xml_rpc_request_add_string_arg(request, linphone_proxy_config_get_domain(creator->proxy_cfg));
linphone_xml_rpc_request_add_string_arg(request, creator->algorithm);
linphone_xml_rpc_request_set_user_data(request, creator);
linphone_xml_rpc_request_cbs_set_response(linphone_xml_rpc_request_get_callbacks(request), _get_confirmation_key_cb_custom);
linphone_xml_rpc_request_cbs_set_response(linphone_xml_rpc_request_get_callbacks(request), get_linphone_confirmation_key_response_cb);
linphone_xml_rpc_session_send_request(creator->xmlrpc_session, request);
linphone_xml_rpc_request_unref(request);
return LinphoneAccountCreatorStatusRequestOk;
......@@ -1339,7 +1335,7 @@ LinphoneAccountCreatorStatus linphone_account_creator_update_password_linphone(L
if (creator->xmlrpc_session) {
const char *username = creator->username ? creator->username : creator->phone_number;
char *ha1 = bctbx_strdup(creator->ha1 ? creator->ha1 : ha1_for_passwd(username, _get_domain(creator), creator->password, creator->algorithm) );
char *ha1 = bctbx_strdup(creator->ha1 ? creator->ha1 : ha1_for_passwd(username, _get_domain(creator), creator->password, creator->algorithm));
char *new_ha1 = bctbx_strdup(ha1_for_passwd(username, _get_domain(creator), new_pwd, creator->algorithm));
ms_debug("Account creator: update_password (username=%s, domain=%s)",
......
......@@ -93,8 +93,8 @@ static void call_received(SalCallOp *h) {
linphone_address_unref(toAddr);
linphone_address_unref(fromAddr);
if (sal_address_has_param(h->getRemoteContactAddress(), "text")) {
const char *oneToOneChatRoomStr = sal_custom_header_find(h->getRecvCustomHeaders(), "One-To-One-Chat-Room");
if (oneToOneChatRoomStr && (strcmp(oneToOneChatRoomStr, "true") == 0)) {
string oneToOneChatRoom = L_C_TO_STRING(sal_custom_header_find(h->getRecvCustomHeaders(), "One-To-One-Chat-Room"));
if (oneToOneChatRoom == "true") {
bool_t oneToOneChatRoomEnabled = linphone_config_get_bool(linphone_core_get_config(lc), "misc", "enable_one_to_one_chat_room", TRUE);
if (!oneToOneChatRoomEnabled) {
h->decline(SalReasonNotAcceptable);
......@@ -108,10 +108,8 @@ static void call_received(SalCallOp *h) {
h->release();
return;
}
bool encrypted = false;
const char *endToEndEncryptedStr = sal_custom_header_find(h->getRecvCustomHeaders(), "End-To-End-Encrypted");
if (endToEndEncryptedStr && (strcmp(endToEndEncryptedStr, "true") == 0))
encrypted = true;
string endToEndEncrypted = L_C_TO_STRING(sal_custom_header_find(h->getRecvCustomHeaders(), "End-To-End-Encrypted"));
bool encrypted = (endToEndEncrypted == "true");
IdentityAddress confAddr = L_GET_PRIVATE_FROM_C_OBJECT(lc)->mainDb->findOneToOneConferenceChatRoomAddress(from, identAddresses.front(), encrypted);
if (confAddr.isValid()) {
shared_ptr<AbstractChatRoom> chatRoom = L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findChatRoom(ConferenceId(confAddr, confAddr));
......@@ -147,11 +145,8 @@ static void call_received(SalCallOp *h) {
chatRoom.reset();
}
if (!chatRoom) {
bool encrypted = false;
const char *endToEndEncryptedStr = sal_custom_header_find(h->getRecvCustomHeaders(), "End-To-End-Encrypted");
if (endToEndEncryptedStr && (strcmp(endToEndEncryptedStr, "true") == 0)) {
encrypted = true;
}
string endToEndEncrypted = L_C_TO_STRING(sal_custom_header_find(h->getRecvCustomHeaders(), "End-To-End-Encrypted"));
bool encrypted = (endToEndEncrypted == "true");
chatRoom = L_GET_PRIVATE_FROM_C_OBJECT(lc)->createClientGroupChatRoom(
h->getSubject(), h->getRemoteContact(), h->getRemoteBody(), false, encrypted
);
......@@ -858,7 +853,7 @@ static void refer_received(SalOp *op, const SalAddress *refer_to){
ConferenceId(addr, IdentityAddress(op->getTo()))
);
if (!chatRoom) {
bool encrypted = false; // TODO get encryption information from INVITE
bool encrypted = false;
chatRoom = L_GET_PRIVATE_FROM_C_OBJECT(lc)->createClientGroupChatRoom("", addr.asString(), Content(), false, encrypted);
}
chatRoom->join();
......
......@@ -147,7 +147,7 @@ LinphoneChatRoom *linphone_core_find_one_to_one_chat_room_2 (
return L_GET_C_BACK_PTR(L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findOneToOneChatRoom(
LinphonePrivate::IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(local_addr)),
LinphonePrivate::IdentityAddress(*L_GET_CPP_PTR_FROM_C_OBJECT(participant_addr)),
encrypted)
!!encrypted)
);
}
......
......@@ -866,12 +866,12 @@ LinphoneFriend * linphone_core_create_friend_with_address(LinphoneCore *lc, cons
#endif
void linphone_core_add_friend(LinphoneCore *lc, LinphoneFriend *lf) {
LinphoneFriendList *fl = linphone_core_get_default_friend_list(lc);
if (fl == NULL) {
fl = linphone_core_create_friend_list(lc);
linphone_core_add_friend_list(lc, fl);
LinphoneFriendList *friendList = linphone_core_get_default_friend_list(lc);
if (!friendList) {
friendList = linphone_core_create_friend_list(lc);
linphone_core_add_friend_list(lc, friendList);
}
if (linphone_friend_list_add_friend(fl, lf) != LinphoneFriendListOK) return;
if (linphone_friend_list_add_friend(friendList, lf) != LinphoneFriendListOK) return;
if (bctbx_list_find(lc->subscribers, lf)) {
/*if this friend was in the pending subscriber list, now remove it from this list*/
lc->subscribers = bctbx_list_remove(lc->subscribers, lf);
......
......@@ -1343,11 +1343,13 @@ static void bodyless_config_read(LinphoneCore *lc) {
bctbx_list_t *bodyless_lists = linphone_config_get_string_list(lc->config, "sip", "bodyless_lists", NULL);
while (bodyless_lists) {
char *name = (char *)bodyless_lists->data;
bodyless_lists = bodyless_lists->next;
char *name = (char *)bctbx_list_get_data(bodyless_lists);
bodyless_lists = bctbx_list_next(bodyless_lists);
LinphoneAddress *addr = linphone_address_new(name);
if(!addr)
if(!addr) {
bctbx_free(name);
continue;
}
ms_message("Found bodyless friendlist %s", name);
bctbx_free(name);
......@@ -2756,12 +2758,11 @@ void linphone_core_remove_friend_list(LinphoneCore *lc, LinphoneFriendList *list
}
void linphone_core_clear_bodyless_friend_lists(LinphoneCore *lc) {
bctbx_list_t* list = bctbx_list_copy(linphone_core_get_friends_lists((const LinphoneCore *)lc));
bctbx_list_t* copy = list;
for (; list != NULL; list = list->next) {
LinphoneFriendList *friends = (LinphoneFriendList *)list->data;
bctbx_list_t *copy = bctbx_list_copy(linphone_core_get_friends_lists((const LinphoneCore *)lc));
for (auto it = copy; it; it = bctbx_list_next(it)) {
LinphoneFriendList *friends = (LinphoneFriendList *)bctbx_list_get_data(copy);
if (linphone_friend_list_is_subscription_bodyless(friends))
linphone_core_remove_friend_list(lc, (LinphoneFriendList *)list->data);
linphone_core_remove_friend_list(lc, (LinphoneFriendList *)bctbx_list_get_data(copy));
}
bctbx_list_free(copy);
}
......
This diff is collapsed.
......@@ -184,13 +184,11 @@ static void process_auth_requested_from_post_xml_rpc_request(void *data, belle_s
LinphoneXmlRpcRequest *request = (LinphoneXmlRpcRequest *)data;
LinphoneAccountCreator *creator = (LinphoneAccountCreator *)linphone_xml_rpc_request_get_user_data(request);
LinphoneCore *lc = creator->core;
const char *realm = belle_sip_auth_event_get_realm(event);
const char *username = belle_sip_auth_event_get_username(event);
const char *domain = belle_sip_auth_event_get_domain(event);
const LinphoneAuthInfo *auth_info = linphone_core_find_auth_info(lc, realm, username, domain);
const LinphoneAuthInfo *auth_info = linphone_core_find_auth_info(creator->core, realm, username, domain);
if (auth_info) {
const char *auth_username = linphone_auth_info_get_username(auth_info);
......
......@@ -260,9 +260,9 @@ LINPHONE_PUBLIC const char * linphone_account_creator_get_activation_code(const
LINPHONE_PUBLIC LinphoneAccountCreatorLanguageStatus linphone_account_creator_set_language(LinphoneAccountCreator *creator, const char *lang);
/**
* Set the algorithm supported.
* Set the supported algorithm.
* @param[in] creator LinphoneAccountCreator object
* @param[in] lang The algorithm to use
* @param[in] algorithm The algorithm to use
* @return LinphoneAccountCreatorAlgoStatusOk if everything is OK, or a specific error otherwise.
**/
LINPHONE_PUBLIC LinphoneAccountCreatorAlgoStatus linphone_account_creator_set_algorithm(LinphoneAccountCreator *creator, const char *algorithm);
......
......@@ -183,7 +183,7 @@ LINPHONE_PUBLIC LinphoneChatRoomCbsSecurityEventCb linphone_chat_room_cbs_get_se
/**
* Set the security event callback.
* @param[in] cbs #LinphoneChatRoomCbs object.
* @param[in] cb The current security event callback to be used.
* @param[in] cb The security event callback to be used.
*/
LINPHONE_PUBLIC void linphone_chat_room_cbs_set_security_event (LinphoneChatRoomCbs *cbs, LinphoneChatRoomCbsSecurityEventCb cb);
......
......@@ -1538,20 +1538,13 @@ LINPHONE_PUBLIC bool_t linphone_core_lime_available(const LinphoneCore *lc);
/**
* Tells to LinphoneCore to use LIME X3DH
* @param[in] lc LinphoneCore object
* @param[in] val The new lime state
* @param[in] enable A boolean value telling whether to enable or disable LIME X3DH
* @ingroup network_parameters
*/
LINPHONE_PUBLIC void linphone_core_enable_lime_x3dh(LinphoneCore *lc, bool_t enable);
/**
* Tells to LinphoneCore to update LIME X3DH
* @param[in] lc LinphoneCore object
* @ingroup network_parameters
*/
LINPHONE_PUBLIC void linphone_core_update_lime_x3dh(const LinphoneCore *lc);
/**
* Returns the LIME X3DH state
* Tells wether LIME X3DH is enabled or not
* @param[in] lc LinphoneCore object
* @return The current lime state
* @ingroup network_parameters
......
......@@ -26,7 +26,7 @@
F(None /**< Event is not a security event */) \
F(SecurityLevelDowngraded /**< Chatroom security level downgraded event */) \
F(ParticipantMaxDeviceCountExceeded /**< Participant has exceeded the maximum number of device event */) \
F(LimeIdentityKeyChanged /**< Peer device lime identity key has changed event */) \
F(EncryptionIdentityKeyChanged /**< Peer device instant messaging encryption identity key has changed event */) \
F(ManInTheMiddleDetected /**< Man in the middle detected event */) \
#endif // ifndef _L_SECURITY_EVENT_ENUMS_H_
......@@ -372,7 +372,7 @@ LINPHONE_PUBLIC bool_t linphone_proxy_config_lime_x3dh_enabled(const LinphonePro
/**
* @param[in] cfg #LinphoneProxyConfig object.
* @param val if TRUE LIME X3DH will be enabled for this user
* @param val if TRUE LIME X3DH will be enabled for this proxy config
**/
LINPHONE_PUBLIC void linphone_proxy_config_enable_lime_x3dh(LinphoneProxyConfig *cfg, const bool_t val);
......
......@@ -65,21 +65,12 @@ void linphone_core_set_im_encryption_engine (LinphoneCore *lc, LinphoneImEncrypt
}
void linphone_core_enable_lime_x3dh (LinphoneCore *lc, bool_t enable) {
// if (L_GET_CPP_PTR_FROM_C_OBJECT(lc)->limeX3dhAvailable()) {
// cout << "LIMEv2 is available, enabling" << endl;
// } else {
// cout << "LIMEv2 is unavailable, not enabling" << endl;
// }
L_GET_CPP_PTR_FROM_C_OBJECT(lc)->enableLimeX3dh(enable);
}
void linphone_core_update_lime_x3dh (const LinphoneCore *lc) {
L_GET_CPP_PTR_FROM_C_OBJECT(lc)->updateLimeX3dh();
}
bool_t linphone_core_lime_x3dh_enabled (const LinphoneCore *lc) {
bool isEnabled = L_GET_CPP_PTR_FROM_C_OBJECT(lc)->limeX3dhEnabled();
return isEnabled?TRUE:FALSE;
return isEnabled ? TRUE : FALSE;
}
bool_t linphone_core_lime_x3dh_available (const LinphoneCore *lc) {
......@@ -90,6 +81,6 @@ void linphone_core_delete_local_lime_x3dh_db (const LinphoneCore *lc) {
if (L_GET_CPP_PTR_FROM_C_OBJECT(lc)->limeX3dhEnabled()) {
L_GET_CPP_PTR_FROM_C_OBJECT(lc)->getEncryptionEngine()->cleanDb();
} else {
lWarning() << "Trying to clean local LIMEv2 databases but LIMEv2 is disabled";
lWarning() << "Trying to clean local LIME X3DH databases but LIME X3DH is disabled";
}
}
......@@ -168,15 +168,7 @@ static bool isConferenceSubjectType (LinphoneEventLogType type) {
}
static bool isConferenceSecurityType (LinphoneEventLogType type) {
switch (type) {
case LinphoneEventLogTypeConferenceSecurityEvent:
return true;
default:
break;
}
return false;
return (type == LinphoneEventLogTypeConferenceSecurityEvent);
}
// -----------------------------------------------------------------------------
......@@ -328,8 +320,7 @@ LINPHONE_PUBLIC LinphoneSecurityEventType linphone_event_log_get_security_event_
const auto securityEvent = static_pointer_cast<const LinphonePrivate::ConferenceSecurityEvent>(
L_GET_CPP_PTR_FROM_C_OBJECT(event_log)
);
LinphoneSecurityEventType eventType = static_cast<LinphoneSecurityEventType>(securityEvent->getSecurityEventType());
return eventType;
return static_cast<LinphoneSecurityEventType>(securityEvent->getSecurityEventType());
}
LINPHONE_PUBLIC LinphoneAddress *linphone_event_log_get_security_event_faulty_device_address (const LinphoneEventLog *event_log) {
......
......@@ -560,7 +560,7 @@ LinphoneReason ChatMessagePrivate::receive () {
// Message Authorization
if (getAuthorizationWarning()) {
lWarning() << "Message authorization warning raised by LIMEv2";
lWarning() << "Message authorization warning raised by encryption engine";
// Allow error IMDN exclusively
if (q->getSharedFromThis()->getInternalContent().getContentType() != ContentType::Imdn && !Imdn::isError(q->getSharedFromThis())) {
......
......@@ -78,7 +78,7 @@ public:
}
migrationRealTime = currentRealTime;
clientGroupChatRoom = static_pointer_cast<ClientGroupChatRoom>(
chatRoom->getCore()->getPrivate()->createClientGroupChatRoom(chatRoom->getSubject(), "", Content(), false, false) // TODO encrypted = false because chatroom migration
chatRoom->getCore()->getPrivate()->createClientGroupChatRoom(chatRoom->getSubject(), "", Content(), false, false)
);
clientGroupChatRoom->getPrivate()->setCallSessionListener(this);
clientGroupChatRoom->getPrivate()->setChatRoomListener(this);
......
......@@ -469,11 +469,11 @@ void ClientGroupChatRoom::addParticipants (
"misc", "one_to_one_chat_room_enabled", TRUE))
) {
d->capabilities |= ClientGroupChatRoom::Capabilities::OneToOne;
const IdentityAddress &me = getMe()->getAddress();
const IdentityAddress &participant = addresses.front();
bool encrypted = getCapabilities() & ClientGroupChatRoom::Capabilities::Encrypted;
auto existingChatRoom = getCore()->findOneToOneChatRoom(getLocalAddress(), participant, encrypted);
if (existingChatRoom) {
const IdentityAddress &me = getMe()->getAddress();
lError() << "Trying to create already existing " << (encrypted ? "" : "non-") << "encrypted one-to-one chatroom with participants: " <<
me << ", " << participant;
return;
......
......@@ -485,9 +485,7 @@ void ServerGroupChatRoomPrivate::addCompatibleParticipants (const IdentityAddres
q->addParticipants(compatibleParticipants, nullptr, false);
if ((capabilities & ServerGroupChatRoom::Capabilities::OneToOne) && (q->getParticipantCount() == 2)) {
// Insert the one-to-one chat room in Db if participants count is 2.
bool encrypted = false;
if ((capabilities & ServerGroupChatRoom::Capabilities::Encrypted))
encrypted = true;
bool encrypted = (capabilities & ServerGroupChatRoom::Capabilities::Encrypted);
q->getCore()->getPrivate()->mainDb->insertOneToOneConferenceChatRoom(q->getSharedFromThis(), encrypted);
}
}
......@@ -822,8 +820,8 @@ LocalConference(getCore(), IdentityAddress(linphone_proxy_config_get_conference_
if (oneToOneChatRoomStr && (strcmp(oneToOneChatRoomStr, "true") == 0))
d->capabilities |= ServerGroupChatRoom::Capabilities::OneToOne;
const char *endToEndEncryptedStr = sal_custom_header_find(op->getRecvCustomHeaders(), "End-To-End-Encrypted");
if (endToEndEncryptedStr && (strcmp(endToEndEncryptedStr, "true") == 0))
string endToEndEncrypted = L_C_TO_STRING(sal_custom_header_find(op->getRecvCustomHeaders(), "End-To-End-Encrypted"));
if (endToEndEncrypted == "true")
d->capabilities |= ServerGroupChatRoom::Capabilities::Encrypted;
shared_ptr<CallSession> session = getMe()->getPrivate()->createSession(*this, nullptr, false, d);
......
......@@ -316,7 +316,7 @@ ChatMessageModifier::Result LimeX3DHEncryptionEngine::processIncomingMessage (
if (incomingContentType != expectedContentType) {
lError() << "LIMEv2 unexpected content-type: " << incomingContentType;
// Set authorisation warning flag because incoming message type is unexpected
// Set authorization warning flag because incoming message type is unexpected
message->getPrivate()->setAuthorizationWarning(true);
// Disable sender authentication otherwise the unexpected message will always be discarded
message->getPrivate()->enableSenderAuthentication(false);
......@@ -634,7 +634,7 @@ void LimeX3DHEncryptionEngine::authenticationVerified (
case lime::PeerDeviceStatus::untrusted:
lWarning() << "LIMEv2 peer device " << peerDeviceId << " is untrusted and its lime identity key has changed";
// TODO specific alert to warn the user that previous messages are compromised
addSecurityEventInChatrooms(peerDeviceAddr, ConferenceSecurityEvent::SecurityEventType::LimeIdentityKeyChanged);
addSecurityEventInChatrooms(peerDeviceAddr, ConferenceSecurityEvent::SecurityEventType::EncryptionIdentityKeyChanged);
break;
case lime::PeerDeviceStatus::trusted:
lError() << "LIMEv2 peer device " << peerDeviceId << " is already trusted but its lime identity key has changed";
......
......@@ -192,6 +192,8 @@ void Imdn::parse (const shared_ptr<ChatMessage> &chatMessage) {
bool Imdn::isError (const shared_ptr<ChatMessage> &chatMessage) {
for (const auto &content : chatMessage->getPrivate()->getContents()) {
if (!content->getContentType().weakEqual(ContentType::Imdn))
continue;
istringstream data(content->getBodyAsString());
unique_ptr<Xsd::Imdn::Imdn> imdn(Xsd::Imdn::parseImdn(data, Xsd::XmlSchema::Flags::dont_validate));
if (!imdn)
......
......@@ -2852,10 +2852,15 @@ void MediaSessionPrivate::startAudioStream (CallSession::State targetState, bool
if (linphone_core_media_encryption_supported(q->getCore()->getCCore(), LinphoneMediaEncryptionZRTP)
&& ((getParams()->getMediaEncryption() == LinphoneMediaEncryptionZRTP) || (remoteStream->haveZrtpHash == 1))) {
// Perform LIMEv2 mutual authentication if LIMEv2 enabled
// Perform mutual authentication if instant messaging encryption is enabled
auto encryptionEngine = q->getCore()->getEncryptionEngine();
if (encryptionEngine)
encryptionEngine->mutualAuthentication(audioStream->ms.sessions.zrtp_context, op->getLocalMediaDescription(), op->getRemoteMediaDescription(), this->getPublic()->CallSession::getDirection());
encryptionEngine->mutualAuthentication(
audioStream->ms.sessions.zrtp_context,
op->getLocalMediaDescription(),
op->getRemoteMediaDescription(),
this->getPublic()->CallSession::getDirection()
);
audio_stream_start_zrtp(audioStream);
if (remoteStream->haveZrtpHash == 1) {
......
......@@ -135,8 +135,8 @@ void CorePrivate::notifyEnteringForeground () {
// =============================================================================
Core::Core () : Object(*new CorePrivate) {
L_D();
d->imee.reset();
L_D();
d->imee.reset();
xercesc::XMLPlatformUtils::Initialize();
}
......@@ -212,8 +212,8 @@ void Core::enableLimeX3dh (bool enable) {
if (d->imee != nullptr)
d->imee.release();
LimeX3DHEncryptionEngine *engine;
if (d->imee == nullptr) {
LimeX3DHEncryptionEngine *engine;
LinphoneConfig *lpconfig = linphone_core_get_config(getCCore());
string filename = lp_config_get_string(lpconfig, "lime", "x3dh_db_path", "x3dh.c25519.sqlite3");
string dbAccess = getDataPath() + filename;
......@@ -226,17 +226,9 @@ void Core::enableLimeX3dh (bool enable) {
}
}
void Core::updateLimeX3dh () const {
L_D();
if (linphone_core_lime_x3dh_enabled(getCCore())) {
d->imee->update();
}
}
bool Core::limeX3dhEnabled () const {
L_D();
if (d->imee != nullptr && d->imee->getEngineType() == EncryptionEngine::EngineType::LimeX3DH)
if (d->imee && d->imee->getEngineType() == EncryptionEngine::EngineType::LimeX3DH)
return true;
return false;
}
......
......@@ -137,7 +137,6 @@ public:
EncryptionEngine *getEncryptionEngine () const;
void setEncryptionEngine (EncryptionEngine *imee);
void enableLimeX3dh (bool enable);
void updateLimeX3dh () const;
bool limeX3dhEnabled () const;
bool limeX3dhAvailable () const;
......
......@@ -1259,7 +1259,6 @@ static void test_subscribe_on_wrong_dialog(void) {
}
#endif
#if 0
static void test_list_subscribe_wrong_body(void) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
......@@ -1283,7 +1282,6 @@ static void test_list_subscribe_wrong_body(void) {
linphone_core_manager_destroy(marie);
linphone_address_unref(sub_addr);
}
#endif
static void redis_publish_subscribe(void) {
......@@ -2064,7 +2062,7 @@ test_t flexisip_tests[] = {
#endif
TEST_NO_TAG("Publish/unpublish", test_publish_unpublish),
TEST_NO_TAG("List subscribe", test_list_subscribe),
//TEST_NO_TAG("List subscribe without body", test_list_subscribe_wrong_body),
TEST_NO_TAG("List subscribe without body", test_list_subscribe_wrong_body),
TEST_NO_TAG("File transfer message rcs to external body client", file_transfer_message_rcs_to_external_body_client),
TEST_NO_TAG("DoS module trigger by sending a lot of chat messages", dos_module_trigger),
#if HAVE_SIPP
......
......@@ -117,8 +117,8 @@ static void chat_room_security_event (LinphoneChatRoom *cr, const LinphoneEventL
case LinphoneSecurityEventTypeParticipantMaxDeviceCountExceeded:
manager->stat.number_of_ParticipantMaxDeviceCountExceeded++;
break;
case LinphoneSecurityEventTypeLimeIdentityKeyChanged:
manager->stat.number_of_LimeIdentityKeyChanged++;
case LinphoneSecurityEventTypeEncryptionIdentityKeyChanged:
manager->stat.number_of_EncryptionIdentityKeyChanged++;
break;
case LinphoneSecurityEventTypeManInTheMiddleDetected:
manager->stat.number_of_ManInTheMiddleDetected++;
......
......@@ -308,7 +308,7 @@ typedef struct _stats {
int number_of_SecurityLevelDowngraded;
int number_of_ParticipantMaxDeviceCountExceeded;
int number_of_LimeIdentityKeyChanged;
int number_of_EncryptionIdentityKeyChanged;
int number_of_ManInTheMiddleDetected;
int number_of_snapshot_taken;
......
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