Commit a857bb7c authored by Matthieu Tanon's avatar Matthieu Tanon

Rename security alert to security event and update tester

parent cf5bfcdd
......@@ -311,7 +311,7 @@ void _linphone_chat_room_notify_participant_device_added(LinphoneChatRoom *cr, c
void _linphone_chat_room_notify_participant_device_removed(LinphoneChatRoom *cr, const LinphoneEventLog *event_log);
void _linphone_chat_room_notify_participant_admin_status_changed(LinphoneChatRoom *cr, const LinphoneEventLog *event_log);
void _linphone_chat_room_notify_state_changed(LinphoneChatRoom *cr, LinphoneChatRoomState newState);
void _linphone_chat_room_notify_security_alert(LinphoneChatRoom *cr, LinphoneEventLog *event_log);
void _linphone_chat_room_notify_security_event(LinphoneChatRoom *cr, LinphoneEventLog *event_log);
void _linphone_chat_room_notify_subject_changed(LinphoneChatRoom *cr, const LinphoneEventLog *event_log);
void _linphone_chat_room_notify_conference_joined(LinphoneChatRoom *cr, const LinphoneEventLog *event_log);
void _linphone_chat_room_notify_conference_left(LinphoneChatRoom *cr, const LinphoneEventLog *event_log);
......
......@@ -228,11 +228,11 @@ typedef void (*LinphoneChatRoomCbsParticipantAdminStatusChangedCb) (LinphoneChat
typedef void (*LinphoneChatRoomCbsStateChangedCb) (LinphoneChatRoom *cr, LinphoneChatRoomState newState);
/**
* Callback used to notify a security alert in the chat room.
* Callback used to notify a security event in the chat room.
* @param[in] cr #LinphoneChatRoom object
* @param[in] securityAlertType the security alert type
* @param[in] securityEventType the security event type
*/
typedef void (*LinphoneChatRoomCbsSecurityAlertCb) (LinphoneChatRoom *cr, const LinphoneEventLog *event_log);
typedef void (*LinphoneChatRoomCbsSecurityEventCb) (LinphoneChatRoom *cr, const LinphoneEventLog *event_log);
/**
* Callback used to notify that the subject of a chat room has changed.
......
......@@ -174,18 +174,18 @@ LINPHONE_PUBLIC LinphoneChatRoomCbsStateChangedCb linphone_chat_room_cbs_get_sta
LINPHONE_PUBLIC void linphone_chat_room_cbs_set_state_changed (LinphoneChatRoomCbs *cbs, LinphoneChatRoomCbsStateChangedCb cb);
/**
* Get the security alert callback.
* Get the security event callback.
* @param[in] cbs #LinphoneChatRoomCbs object.
* @return The security alert callback to be used.
* @return The security event callback to be used.
*/
LINPHONE_PUBLIC LinphoneChatRoomCbsSecurityAlertCb linphone_chat_room_cbs_get_security_alert (const LinphoneChatRoomCbs *cbs);
LINPHONE_PUBLIC LinphoneChatRoomCbsSecurityEventCb linphone_chat_room_cbs_get_security_event (const LinphoneChatRoomCbs *cbs);
/**
* Set the security alert callback.
* Set the security event callback.
* @param[in] cbs #LinphoneChatRoomCbs object.
* @param[in] cb The current security alert callback to be used.
* @param[in] cb The current security event callback to be used.
*/
LINPHONE_PUBLIC void linphone_chat_room_cbs_set_security_alert (LinphoneChatRoomCbs *cbs, LinphoneChatRoomCbsSecurityAlertCb cb);
LINPHONE_PUBLIC void linphone_chat_room_cbs_set_security_event (LinphoneChatRoomCbs *cbs, LinphoneChatRoomCbsSecurityEventCb cb);
/**
* Get the subject changed callback.
......
......@@ -149,7 +149,7 @@ LINPHONE_PUBLIC const LinphoneAddress *linphone_event_log_get_device_address (co
* @param[in] event_log A #LinphoneEventLog object.
* @return The address of the faulty device.
*/
LINPHONE_PUBLIC LinphoneAddress *linphone_event_log_get_security_alert_faulty_device (const LinphoneEventLog *event_log);
LINPHONE_PUBLIC LinphoneAddress *linphone_event_log_get_security_event_faulty_device (const LinphoneEventLog *event_log);
// -----------------------------------------------------------------------------
// ConferenceSubjectEvent.
......
......@@ -36,6 +36,6 @@
F(ConferenceParticipantDeviceAdded /**< Conference participant device (added) event */) \
F(ConferenceParticipantDeviceRemoved /**< Conference participant device (removed) event */) \
F(ConferenceSubjectChanged /**< Conference subject event */) \
F(ConferenceSecurityAlert /**< Conference security alert event*/) \
F(ConferenceSecurityEvent /**< Conference encryption security event*/) \
#endif // ifndef _L_EVENT_LOG_ENUMS_H_
......@@ -34,7 +34,7 @@ struct _LinphoneChatRoomCbs {
LinphoneChatRoomCbsParticipantDeviceRemovedCb participantDeviceRemovedCb;
LinphoneChatRoomCbsParticipantAdminStatusChangedCb participantAdminStatusChangedCb;
LinphoneChatRoomCbsStateChangedCb stateChangedCb;
LinphoneChatRoomCbsSecurityAlertCb securityAlertCb;
LinphoneChatRoomCbsSecurityEventCb securityEventCb;
LinphoneChatRoomCbsSubjectChangedCb subjectChangedCb;
LinphoneChatRoomCbsConferenceJoinedCb conferenceJoinedCb;
LinphoneChatRoomCbsConferenceLeftCb conferenceLeftCb;
......@@ -147,12 +147,12 @@ void linphone_chat_room_cbs_set_state_changed (LinphoneChatRoomCbs *cbs, Linphon
cbs->stateChangedCb = cb;
}
LinphoneChatRoomCbsSecurityAlertCb linphone_chat_room_cbs_get_security_alert (const LinphoneChatRoomCbs *cbs) {
return cbs->securityAlertCb;
LinphoneChatRoomCbsSecurityEventCb linphone_chat_room_cbs_get_security_event (const LinphoneChatRoomCbs *cbs) {
return cbs->securityEventCb;
}
void linphone_chat_room_cbs_set_security_alert (LinphoneChatRoomCbs *cbs, LinphoneChatRoomCbsSecurityAlertCb cb) {
cbs->securityAlertCb = cb;
void linphone_chat_room_cbs_set_security_event (LinphoneChatRoomCbs *cbs, LinphoneChatRoomCbsSecurityEventCb cb) {
cbs->securityEventCb = cb;
}
LinphoneChatRoomCbsSubjectChangedCb linphone_chat_room_cbs_get_subject_changed (const LinphoneChatRoomCbs *cbs) {
......
......@@ -487,8 +487,8 @@ void _linphone_chat_room_notify_state_changed(LinphoneChatRoom *cr, LinphoneChat
NOTIFY_IF_EXIST(StateChanged, state_changed, cr, newState)
}
void _linphone_chat_room_notify_security_alert(LinphoneChatRoom *cr, LinphoneEventLog *event_log) {
NOTIFY_IF_EXIST(SecurityAlert, security_alert, cr, event_log)
void _linphone_chat_room_notify_security_event(LinphoneChatRoom *cr, LinphoneEventLog *event_log) {
NOTIFY_IF_EXIST(SecurityEvent, security_event, cr, event_log)
}
void _linphone_chat_room_notify_subject_changed(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) {
......
......@@ -169,7 +169,7 @@ static bool isConferenceSubjectType (LinphoneEventLogType type) {
static bool isConferenceSecurityType (LinphoneEventLogType type) {
switch (type) {
case LinphoneEventLogTypeConferenceSecurityAlert:
case LinphoneEventLogTypeConferenceSecurityEvent:
return true;
default:
......@@ -321,7 +321,7 @@ const LinphoneAddress *linphone_event_log_get_device_address (const LinphoneEven
// ConferenceSecurityEvent.
// -----------------------------------------------------------------------------
LINPHONE_PUBLIC LinphoneAddress *linphone_event_log_get_security_alert_faulty_device (const LinphoneEventLog *event_log) {
LINPHONE_PUBLIC LinphoneAddress *linphone_event_log_get_security_event_faulty_device (const LinphoneEventLog *event_log) {
if (!isConferenceSecurityType(linphone_event_log_get_type(event_log)))
return nullptr;
......
......@@ -716,13 +716,13 @@ void ClientGroupChatRoom::onParticipantSetAdmin (const shared_ptr<ConferencePart
_linphone_chat_room_notify_participant_admin_status_changed(cr, L_GET_C_BACK_PTR(event));
}
void ClientGroupChatRoom::onSecurityAlert (const shared_ptr<ConferenceSecurityEvent> &event) {
void ClientGroupChatRoom::onSecurityEvent (const shared_ptr<ConferenceSecurityEvent> &event) {
L_D();
d->addEvent(event);
LinphoneChatRoom *cr = d->getCChatRoom();
_linphone_chat_room_notify_security_alert(cr, L_GET_C_BACK_PTR(event));
_linphone_chat_room_notify_security_event(cr, L_GET_C_BACK_PTR(event));
// Try to set the faulty device PeerDeviceStatus to unsafe
if (getCore()->limeV2Enabled() && event->getFaultyDevice().isValid()) {
......
......@@ -106,7 +106,7 @@ private:
void onConferenceCreated (const IdentityAddress &addr) override;
void onConferenceKeywordsChanged (const std::vector<std::string> &keywords) override;
void onConferenceTerminated (const IdentityAddress &addr) override;
void onSecurityAlert (const std::shared_ptr<ConferenceSecurityEvent> &event) override;
void onSecurityEvent (const std::shared_ptr<ConferenceSecurityEvent> &event) override;
void onFirstNotifyReceived (const IdentityAddress &addr) override;
void onParticipantAdded (const std::shared_ptr<ConferenceParticipantEvent> &event, bool isFullState) override;
void onParticipantDeviceAdded (const std::shared_ptr<ConferenceParticipantDeviceEvent> &event, bool isFullState) override;
......
......@@ -187,9 +187,9 @@ ChatMessageModifier::Result LimeV2::processOutgoingMessage (const shared_ptr<Cha
// If there is no recent security alert send a new one
if (!recentSecurityAlert) {
ConferenceSecurityEvent::SecurityAlertType securityAlertType = ConferenceSecurityEvent::SecurityAlertType::MultideviceParticipant;
shared_ptr<ConferenceSecurityEvent> securityEvent = make_shared<ConferenceSecurityEvent>(time(nullptr), chatRoom->getConferenceId(), securityAlertType);
confListener->onSecurityAlert(securityEvent);
ConferenceSecurityEvent::SecurityEventType securityEventType = ConferenceSecurityEvent::SecurityEventType::MultideviceParticipantDetected;
shared_ptr<ConferenceSecurityEvent> securityEvent = make_shared<ConferenceSecurityEvent>(time(nullptr), chatRoom->getConferenceId(), securityEventType);
confListener->onSecurityEvent(securityEvent);
}
return ChatMessageModifier::Result::Error;
}
......
......@@ -35,7 +35,7 @@ public:
virtual void onConferenceCreated (const IdentityAddress &addr) {}
virtual void onConferenceKeywordsChanged (const std::vector<std::string> &keywords) {}
virtual void onConferenceTerminated (const IdentityAddress &addr) {}
virtual void onSecurityAlert (const std::shared_ptr<ConferenceSecurityEvent> &event) {}
virtual void onSecurityEvent (const std::shared_ptr<ConferenceSecurityEvent> &event) {}
virtual void onFirstNotifyReceived (const IdentityAddress &addr) {}
virtual void onParticipantAdded (const std::shared_ptr<ConferenceParticipantEvent> &event, bool isFullState) {}
......
......@@ -3527,8 +3527,8 @@ void MediaSessionPrivate::propagateEncryptionChanged () {
const SalAddress *remoteAddress = getOp()->getRemoteContactAddress();
char *peerDeviceId = sal_address_as_string_uri_only(remoteAddress);
// TODO If mismatch = 0 set this peer as trusted with this Ik
// TODO If mismatch = 1 the Ik exchange went wrong (possible identity theft)
// If mismatch = 0 set this peer as trusted with this Ik
// If mismatch = 1 the Ik exchange went wrong (possible identity theft)
if (ms_zrtp_getAuxiliarySharedSecretMismatch(audioStream->ms.sessions.zrtp_context) == 0) {
if (limeV2Engine) {
try {
......@@ -3537,7 +3537,7 @@ void MediaSessionPrivate::propagateEncryptionChanged () {
limeV2Engine->getLimeManager()->set_peerDeviceStatus(peerDeviceId, remoteIk_vector, peerDeviceStatus);
lInfo() << "LIMEv2 peer device " << peerDeviceId << " is now trusted";
} catch (const exception &e) {
// The stored IK doesn't correspond to the Ik we are trying to use here
// The stored IK doesn't match with the Ik we are trying to use here
// TODO Report the security issue to application level (chatroom event)
lError() << "LIMEv2 identity theft detected from " << peerDeviceId << " (" << e.what() << ")";
}
......
......@@ -175,7 +175,7 @@ namespace {
EventLog::Type::ConferenceParticipantSetAdmin,
EventLog::Type::ConferenceParticipantUnsetAdmin,
EventLog::Type::ConferenceSubjectChanged,
EventLog::Type::ConferenceSecurityAlert
EventLog::Type::ConferenceSecurityEvent
>::get();
constexpr auto ConferenceInfoFilter = ConferenceInfoNoDeviceFilter + "," + SqlEventFilterBuilder<
......@@ -532,7 +532,7 @@ shared_ptr<EventLog> MainDbPrivate::selectGenericConferenceEvent (
case EventLog::Type::ConferenceChatMessage:
eventLog = selectConferenceChatMessageEvent(chatRoom, type, row);
break;
case EventLog::Type::ConferenceSecurityAlert:
case EventLog::Type::ConferenceSecurityEvent:
eventLog = selectConferenceSecurityEvent(chatRoom->getConferenceId(), type, row);
break;
default:
......@@ -585,7 +585,7 @@ shared_ptr<EventLog> MainDbPrivate::selectGenericConferenceNotifiedEvent (
eventLog = selectConferenceParticipantDeviceEvent(conferenceId, type, row);
break;
case EventLog::Type::ConferenceSecurityAlert:
case EventLog::Type::ConferenceSecurityEvent:
eventLog = selectConferenceSecurityEvent(conferenceId, type, row);
break;
......@@ -699,7 +699,7 @@ shared_ptr<EventLog> MainDbPrivate::selectConferenceSecurityEvent (
return make_shared<ConferenceSecurityEvent>(
getConferenceEventCreationTimeFromRow(row),
conferenceId,
static_cast<ConferenceSecurityEvent::SecurityAlertType>(row.get<int>(16)),
static_cast<ConferenceSecurityEvent::SecurityEventType>(row.get<int>(16)),
IdentityAddress(row.get<string>(17))
);
}
......@@ -943,13 +943,13 @@ long long MainDbPrivate::insertConferenceSecurityEvent (const shared_ptr<EventLo
if (eventId < 0)
return -1;
const int &securityAlertType = int(static_pointer_cast<ConferenceSecurityEvent>(eventLog)->getSecurityAlertType());
const int &securityEventType = int(static_pointer_cast<ConferenceSecurityEvent>(eventLog)->getSecurityEventType());
const string &faultyDevice = static_pointer_cast<ConferenceSecurityEvent>(eventLog)->getFaultyDevice().asString();
// insert security event into new table "conference_security_event"
soci::session *session = dbSession.getBackendSession();
*session << "INSERT INTO conference_security_event (event_id, security_alert, faulty_device)"
" VALUES (:eventId, :securityAlertType, :faultyDevice)", soci::use(eventId), soci::use(securityAlertType), soci::use(faultyDevice);
" VALUES (:eventId, :securityEventType, :faultyDevice)", soci::use(eventId), soci::use(securityEventType), soci::use(faultyDevice);
return eventId;
}
......@@ -1778,7 +1778,7 @@ bool MainDb::addEvent (const shared_ptr<EventLog> &eventLog) {
eventId = d->insertConferenceParticipantDeviceEvent(eventLog);
break;
case EventLog::Type::ConferenceSecurityAlert:
case EventLog::Type::ConferenceSecurityEvent:
eventId = d->insertConferenceSecurityEvent(eventLog);
break;
......@@ -1828,7 +1828,7 @@ bool MainDb::updateEvent (const shared_ptr<EventLog> &eventLog) {
case EventLog::Type::ConferenceParticipantUnsetAdmin:
case EventLog::Type::ConferenceParticipantDeviceAdded:
case EventLog::Type::ConferenceParticipantDeviceRemoved:
case EventLog::Type::ConferenceSecurityAlert:
case EventLog::Type::ConferenceSecurityEvent:
case EventLog::Type::ConferenceSubjectChanged:
return false;
}
......
......@@ -30,7 +30,7 @@ LINPHONE_BEGIN_NAMESPACE
class ConferenceSecurityEventPrivate : public ConferenceEventPrivate {
public:
ConferenceSecurityEvent::SecurityAlertType securityAlertType;
ConferenceSecurityEvent::SecurityEventType securityEventType;
IdentityAddress faultyDevice;
};
......@@ -39,36 +39,36 @@ public:
ConferenceSecurityEvent::ConferenceSecurityEvent (
time_t creationTime,
const ConferenceId &conferenceId,
SecurityAlertType securityAlertType,
SecurityEventType securityEventType,
const IdentityAddress &faultyDevice
) : ConferenceEvent(
*new ConferenceSecurityEventPrivate,
Type::ConferenceSecurityAlert,
Type::ConferenceSecurityEvent,
creationTime,
conferenceId
) {
L_D();
d->securityAlertType = securityAlertType;
d->securityEventType = securityEventType;
d->faultyDevice = faultyDevice;
}
ConferenceSecurityEvent::ConferenceSecurityEvent (
time_t creationTime,
const ConferenceId &conferenceId,
SecurityAlertType securityAlertType
SecurityEventType securityEventType
) : ConferenceEvent(
*new ConferenceSecurityEventPrivate,
Type::ConferenceSecurityAlert,
Type::ConferenceSecurityEvent,
creationTime,
conferenceId
) {
L_D();
d->securityAlertType = securityAlertType;
d->securityEventType = securityEventType;
}
ConferenceSecurityEvent::SecurityAlertType ConferenceSecurityEvent::getSecurityAlertType () const {
ConferenceSecurityEvent::SecurityEventType ConferenceSecurityEvent::getSecurityEventType () const {
L_D();
return d->securityAlertType;
return d->securityEventType;
}
const IdentityAddress &ConferenceSecurityEvent::getFaultyDevice () const {
......
......@@ -23,6 +23,7 @@
#include <string>
#include "conference-event.h"
#include "linphone/enums/security-event-enums.h"
// =============================================================================
......@@ -33,31 +34,22 @@ class ConferenceSecurityEventPrivate;
class LINPHONE_PUBLIC ConferenceSecurityEvent : public ConferenceEvent {
public:
enum SecurityAlertType {
/**
* Encrypting message to forbidden multidevice participant.
*/
MultideviceParticipant,
/**
* Trying to set lime PeerDeviceStatus using a new identity key.
*/
LimeIdentityKeyChanged
};
L_DECLARE_ENUM(SecurityEventType, L_ENUM_VALUES_SECURITY_EVENT_TYPE);
ConferenceSecurityEvent (
time_t creationTime,
const ConferenceId &conferenceId,
SecurityAlertType securityAlertType,
SecurityEventType securityEventType,
const IdentityAddress &faultyDevice
);
ConferenceSecurityEvent (
time_t creationTime,
const ConferenceId &conferenceId,
SecurityAlertType securityAlertType
SecurityEventType securityEventType
);
SecurityAlertType getSecurityAlertType () const;
SecurityEventType getSecurityEventType () const;
const IdentityAddress &getFaultyDevice () const;
private:
......
......@@ -104,12 +104,24 @@ static void chat_room_state_changed (LinphoneChatRoom *cr, LinphoneChatRoomState
}
}
static void chat_room_security_alert (LinphoneChatRoom *cr, const LinphoneEventLog *event_log) {
printf("[TEST] Chatroom security alert detected from %s\n", linphone_address_as_string(linphone_event_log_get_security_alert_faulty_device(event_log)));
static void chat_room_security_event (LinphoneChatRoom *cr, const LinphoneEventLog *event_log) {
LinphoneCore *core = linphone_chat_room_get_core(cr);
LinphoneCoreManager *manager = (LinphoneCoreManager *)linphone_core_get_user_data(core);
manager->stat.number_of_security_alerts++;
switch (linphone_event_log_get_security_event_type(event_log)) {
case LinphoneSecurityEventTypeSecurityLevelDowngraded:
manager->stat.number_of_SecurityLevelDowngraded++;
break;
case LinphoneSecurityEventTypeMultideviceParticipantDetected:
manager->stat.number_of_MultideviceParticipantDetected++;
break;
case LinphoneSecurityEventTypeLimeIdentityKeyChanged:
manager->stat.number_of_LimeIdentityKeyChanged++;
break;
case LinphoneSecurityEventTypeManInTheMiddleDetected:
manager->stat.number_of_ManInTheMiddleDetected++;
break;
}
}
static void chat_room_subject_changed (LinphoneChatRoom *cr, const LinphoneEventLog *event_log) {
......@@ -132,7 +144,7 @@ static void core_chat_room_state_changed (LinphoneCore *core, LinphoneChatRoom *
linphone_chat_room_cbs_set_participant_admin_status_changed(cbs, chat_room_participant_admin_status_changed);
linphone_chat_room_cbs_set_participant_removed(cbs, chat_room_participant_removed);
linphone_chat_room_cbs_set_state_changed(cbs, chat_room_state_changed);
linphone_chat_room_cbs_set_security_alert(cbs, chat_room_security_alert);
linphone_chat_room_cbs_set_security_event(cbs, chat_room_security_event);
linphone_chat_room_cbs_set_subject_changed(cbs, chat_room_subject_changed);
linphone_chat_room_cbs_set_participant_device_added(cbs, chat_room_participant_device_added);
linphone_chat_room_cbs_set_undecryptable_message_received(cbs, undecryptable_message_received);
......@@ -4412,6 +4424,11 @@ static void group_chat_lime_v2_chatroom_security_level_downgrade_adding_particip
BC_ASSERT_EQUAL(linphone_chat_room_get_security_level(laureCr), LinphoneChatRoomSecurityLevelEncrypted, int, "%d");
BC_ASSERT_EQUAL(linphone_chat_room_get_security_level(chloeCr), LinphoneChatRoomSecurityLevelEncrypted, int, "%d");
// Check that participants have received a SecurityLevelDowngraded event
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_SecurityLevelDowngraded, initialLaureStats.number_of_SecurityLevelDowngraded + 1, 3000));
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_SecurityLevelDowngraded, initialLaureStats.number_of_SecurityLevelDowngraded + 1, 3000));
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_SecurityLevelDowngraded, initialLaureStats.number_of_SecurityLevelDowngraded + 1, 3000));
end:
// Clean local LIMEv2 databases
linphone_core_delete_local_lime_v2_db(marie->lc);
......@@ -4522,6 +4539,7 @@ static void group_chat_lime_v2_chatroom_security_level_downgrade_resetting_zrtp
BC_ASSERT_TRUE((call_ok = simple_zrtp_call_with_sas_validation(pauline, marie, FALSE, TRUE)));
if (!call_ok) goto end;
// WARNING
// Marie's chatroom security level is expected to be downgraded too but we are in a state of ZRTP asynchronism
// There is no ZRTP exchange until next call, where SAS can be validated or invalidated again
// Until then Marie trusts Pauline but Pauline doesn't trust Marie so security levels correspond to this state
......@@ -4672,8 +4690,6 @@ static void group_chat_lime_v2_chatroom_security_alert (void) {
// Pauline2 is automatically added to the chatroom
// Marie adds Pauline2 to the chat room
// Check that the chat room is correctly created on Pauline2's side and that she was added everywhere
pauline2Cr = check_creation_chat_room_client_side(coresList, pauline2, &initialPauline2Stats, confAddr, initialSubject, 2, 0);
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_participant_devices_added, initialMarieStats.number_of_participant_devices_added + 1, 3000));
......@@ -4681,9 +4697,9 @@ static void group_chat_lime_v2_chatroom_security_alert (void) {
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_participant_devices_added, initialLaureStats.number_of_participant_devices_added + 1, 3000));
// Check that the participants have received a security alert because Pauline2 is forbidden
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_security_alerts, initialMarieStats.number_of_security_alerts + 1, 3000));
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline1->stat.number_of_security_alerts, initialPauline1Stats.number_of_security_alerts + 1, 3000));
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_security_alerts, initialLaureStats.number_of_security_alerts + 1, 3000));
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_MultideviceParticipantDetected, initialMarieStats.number_of_MultideviceParticipantDetected + 1, 3000));
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline1->stat.number_of_MultideviceParticipantDetected, initialPauline1Stats.number_of_MultideviceParticipantDetected + 1, 3000));
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_MultideviceParticipantDetected, initialLaureStats.number_of_MultideviceParticipantDetected + 1, 3000));
// Check the security level was downgraded for Marie and Laure
BC_ASSERT_EQUAL(linphone_chat_room_get_security_level(marieCr), LinphoneChatRoomSecurityLevelEncrypted, int, "%d");
......@@ -4694,18 +4710,18 @@ static void group_chat_lime_v2_chatroom_security_alert (void) {
linphone_chat_room_compose(laureCr);
// No new security alert sent because there is a recent one
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_security_alerts, initialLaureStats.number_of_security_alerts + 1, 3000));
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_MultideviceParticipantDetected, initialLaureStats.number_of_MultideviceParticipantDetected + 1, 3000));
const char *laureMessage = "I'm going to the cinema";
_send_message(laureCr, laureMessage);
// No new security alert sent because there is a recent one
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_security_alerts, initialLaureStats.number_of_security_alerts + 1, 3000));
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_MultideviceParticipantDetected, initialLaureStats.number_of_MultideviceParticipantDetected + 1, 3000));
_send_message(laureCr, laureMessage);
// Check that Laure received another security alert because a multidevice participant was detected during encryption
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_security_alerts, initialLaureStats.number_of_security_alerts + 2, 3000));
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_MultideviceParticipantDetected, initialLaureStats.number_of_MultideviceParticipantDetected + 2, 3000));
// Check that the message was not received by Pauline1 or Laure
// TODO optimize and choose wether we are still allowed to send message during a security alert or not
......
......@@ -303,7 +303,11 @@ typedef struct _stats {
int number_of_participants_removed;
int number_of_subject_changed;
int number_of_participant_devices_added;
int number_of_security_alerts;
int number_of_SecurityLevelDowngraded;
int number_of_MultideviceParticipantDetected;
int number_of_LimeIdentityKeyChanged;
int number_of_ManInTheMiddleDetected;
int number_of_snapshot_taken;
}stats;
......
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