Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
BC
public
liblinphone
Commits
a857bb7c
Commit
a857bb7c
authored
Aug 30, 2018
by
Matthieu Tanon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename security alert to security event and update tester
parent
cf5bfcdd
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
87 additions
and
75 deletions
+87
-75
coreapi/private_functions.h
coreapi/private_functions.h
+1
-1
include/linphone/api/c-callbacks.h
include/linphone/api/c-callbacks.h
+3
-3
include/linphone/api/c-chat-room-cbs.h
include/linphone/api/c-chat-room-cbs.h
+6
-6
include/linphone/api/c-event-log.h
include/linphone/api/c-event-log.h
+1
-1
include/linphone/enums/event-log-enums.h
include/linphone/enums/event-log-enums.h
+1
-1
src/c-wrapper/api/c-chat-room-cbs.cpp
src/c-wrapper/api/c-chat-room-cbs.cpp
+5
-5
src/c-wrapper/api/c-chat-room.cpp
src/c-wrapper/api/c-chat-room.cpp
+2
-2
src/c-wrapper/api/c-event-log.cpp
src/c-wrapper/api/c-event-log.cpp
+2
-2
src/chat/chat-room/client-group-chat-room.cpp
src/chat/chat-room/client-group-chat-room.cpp
+2
-2
src/chat/chat-room/client-group-chat-room.h
src/chat/chat-room/client-group-chat-room.h
+1
-1
src/chat/encryption/lime-v2.cpp
src/chat/encryption/lime-v2.cpp
+3
-3
src/conference/conference-listener.h
src/conference/conference-listener.h
+1
-1
src/conference/session/media-session.cpp
src/conference/session/media-session.cpp
+3
-3
src/db/main-db.cpp
src/db/main-db.cpp
+8
-8
src/event-log/conference/conference-security-event.cpp
src/event-log/conference/conference-security-event.cpp
+9
-9
src/event-log/conference/conference-security-event.h
src/event-log/conference/conference-security-event.h
+5
-13
tester/group_chat_tester.c
tester/group_chat_tester.c
+29
-13
tester/liblinphone_tester.h
tester/liblinphone_tester.h
+5
-1
No files found.
coreapi/private_functions.h
View file @
a857bb7c
...
...
@@ -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_
aler
t
(
LinphoneChatRoom
*
cr
,
LinphoneEventLog
*
event_log
);
void
_linphone_chat_room_notify_security_
even
t
(
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
);
...
...
include/linphone/api/c-callbacks.h
View file @
a857bb7c
...
...
@@ -228,11 +228,11 @@ typedef void (*LinphoneChatRoomCbsParticipantAdminStatusChangedCb) (LinphoneChat
typedef
void
(
*
LinphoneChatRoomCbsStateChangedCb
)
(
LinphoneChatRoom
*
cr
,
LinphoneChatRoomState
newState
);
/**
* Callback used to notify a security
aler
t in the chat room.
* Callback used to notify a security
even
t in the chat room.
* @param[in] cr #LinphoneChatRoom object
* @param[in] security
Aler
tType the security
aler
t type
* @param[in] security
Even
tType the security
even
t type
*/
typedef
void
(
*
LinphoneChatRoomCbsSecurity
Aler
tCb
)
(
LinphoneChatRoom
*
cr
,
const
LinphoneEventLog
*
event_log
);
typedef
void
(
*
LinphoneChatRoomCbsSecurity
Even
tCb
)
(
LinphoneChatRoom
*
cr
,
const
LinphoneEventLog
*
event_log
);
/**
* Callback used to notify that the subject of a chat room has changed.
...
...
include/linphone/api/c-chat-room-cbs.h
View file @
a857bb7c
...
...
@@ -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
aler
t callback.
* Get the security
even
t callback.
* @param[in] cbs #LinphoneChatRoomCbs object.
* @return The security
aler
t callback to be used.
* @return The security
even
t callback to be used.
*/
LINPHONE_PUBLIC
LinphoneChatRoomCbsSecurity
Aler
tCb
linphone_chat_room_cbs_get_security_
aler
t
(
const
LinphoneChatRoomCbs
*
cbs
);
LINPHONE_PUBLIC
LinphoneChatRoomCbsSecurity
Even
tCb
linphone_chat_room_cbs_get_security_
even
t
(
const
LinphoneChatRoomCbs
*
cbs
);
/**
* Set the security
aler
t callback.
* Set the security
even
t callback.
* @param[in] cbs #LinphoneChatRoomCbs object.
* @param[in] cb The current security
aler
t callback to be used.
* @param[in] cb The current security
even
t callback to be used.
*/
LINPHONE_PUBLIC
void
linphone_chat_room_cbs_set_security_
aler
t
(
LinphoneChatRoomCbs
*
cbs
,
LinphoneChatRoomCbsSecurity
Aler
tCb
cb
);
LINPHONE_PUBLIC
void
linphone_chat_room_cbs_set_security_
even
t
(
LinphoneChatRoomCbs
*
cbs
,
LinphoneChatRoomCbsSecurity
Even
tCb
cb
);
/**
* Get the subject changed callback.
...
...
include/linphone/api/c-event-log.h
View file @
a857bb7c
...
...
@@ -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_
aler
t_faulty_device
(
const
LinphoneEventLog
*
event_log
);
LINPHONE_PUBLIC
LinphoneAddress
*
linphone_event_log_get_security_
even
t_faulty_device
(
const
LinphoneEventLog
*
event_log
);
// -----------------------------------------------------------------------------
// ConferenceSubjectEvent.
...
...
include/linphone/enums/event-log-enums.h
View file @
a857bb7c
...
...
@@ -36,6 +36,6 @@
F(ConferenceParticipantDeviceAdded
/**< Conference participant device (added) event */
) \
F(ConferenceParticipantDeviceRemoved
/**< Conference participant device (removed) event */
) \
F(ConferenceSubjectChanged
/**< Conference subject event */
) \
F(ConferenceSecurity
Aler
t
/**< Conference security
alert
event*/
) \
F(ConferenceSecurity
Even
t
/**< Conference
encryption
security event*/
) \
#endif // ifndef _L_EVENT_LOG_ENUMS_H_
src/c-wrapper/api/c-chat-room-cbs.cpp
View file @
a857bb7c
...
...
@@ -34,7 +34,7 @@ struct _LinphoneChatRoomCbs {
LinphoneChatRoomCbsParticipantDeviceRemovedCb
participantDeviceRemovedCb
;
LinphoneChatRoomCbsParticipantAdminStatusChangedCb
participantAdminStatusChangedCb
;
LinphoneChatRoomCbsStateChangedCb
stateChangedCb
;
LinphoneChatRoomCbsSecurity
Aler
tCb
security
Aler
tCb
;
LinphoneChatRoomCbsSecurity
Even
tCb
security
Even
tCb
;
LinphoneChatRoomCbsSubjectChangedCb
subjectChangedCb
;
LinphoneChatRoomCbsConferenceJoinedCb
conferenceJoinedCb
;
LinphoneChatRoomCbsConferenceLeftCb
conferenceLeftCb
;
...
...
@@ -147,12 +147,12 @@ void linphone_chat_room_cbs_set_state_changed (LinphoneChatRoomCbs *cbs, Linphon
cbs
->
stateChangedCb
=
cb
;
}
LinphoneChatRoomCbsSecurity
Aler
tCb
linphone_chat_room_cbs_get_security_
aler
t
(
const
LinphoneChatRoomCbs
*
cbs
)
{
return
cbs
->
security
Aler
tCb
;
LinphoneChatRoomCbsSecurity
Even
tCb
linphone_chat_room_cbs_get_security_
even
t
(
const
LinphoneChatRoomCbs
*
cbs
)
{
return
cbs
->
security
Even
tCb
;
}
void
linphone_chat_room_cbs_set_security_
aler
t
(
LinphoneChatRoomCbs
*
cbs
,
LinphoneChatRoomCbsSecurity
Aler
tCb
cb
)
{
cbs
->
security
Aler
tCb
=
cb
;
void
linphone_chat_room_cbs_set_security_
even
t
(
LinphoneChatRoomCbs
*
cbs
,
LinphoneChatRoomCbsSecurity
Even
tCb
cb
)
{
cbs
->
security
Even
tCb
=
cb
;
}
LinphoneChatRoomCbsSubjectChangedCb
linphone_chat_room_cbs_get_subject_changed
(
const
LinphoneChatRoomCbs
*
cbs
)
{
...
...
src/c-wrapper/api/c-chat-room.cpp
View file @
a857bb7c
...
...
@@ -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_
aler
t
(
LinphoneChatRoom
*
cr
,
LinphoneEventLog
*
event_log
)
{
NOTIFY_IF_EXIST
(
Security
Aler
t
,
security_
aler
t
,
cr
,
event_log
)
void
_linphone_chat_room_notify_security_
even
t
(
LinphoneChatRoom
*
cr
,
LinphoneEventLog
*
event_log
)
{
NOTIFY_IF_EXIST
(
Security
Even
t
,
security_
even
t
,
cr
,
event_log
)
}
void
_linphone_chat_room_notify_subject_changed
(
LinphoneChatRoom
*
cr
,
const
LinphoneEventLog
*
event_log
)
{
...
...
src/c-wrapper/api/c-event-log.cpp
View file @
a857bb7c
...
...
@@ -169,7 +169,7 @@ static bool isConferenceSubjectType (LinphoneEventLogType type) {
static
bool
isConferenceSecurityType
(
LinphoneEventLogType
type
)
{
switch
(
type
)
{
case
LinphoneEventLogTypeConferenceSecurity
Aler
t
:
case
LinphoneEventLogTypeConferenceSecurity
Even
t
:
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_
aler
t_faulty_device
(
const
LinphoneEventLog
*
event_log
)
{
LINPHONE_PUBLIC
LinphoneAddress
*
linphone_event_log_get_security_
even
t_faulty_device
(
const
LinphoneEventLog
*
event_log
)
{
if
(
!
isConferenceSecurityType
(
linphone_event_log_get_type
(
event_log
)))
return
nullptr
;
...
...
src/chat/chat-room/client-group-chat-room.cpp
View file @
a857bb7c
...
...
@@ -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
::
onSecurity
Aler
t
(
const
shared_ptr
<
ConferenceSecurityEvent
>
&
event
)
{
void
ClientGroupChatRoom
::
onSecurity
Even
t
(
const
shared_ptr
<
ConferenceSecurityEvent
>
&
event
)
{
L_D
();
d
->
addEvent
(
event
);
LinphoneChatRoom
*
cr
=
d
->
getCChatRoom
();
_linphone_chat_room_notify_security_
aler
t
(
cr
,
L_GET_C_BACK_PTR
(
event
));
_linphone_chat_room_notify_security_
even
t
(
cr
,
L_GET_C_BACK_PTR
(
event
));
// Try to set the faulty device PeerDeviceStatus to unsafe
if
(
getCore
()
->
limeV2Enabled
()
&&
event
->
getFaultyDevice
().
isValid
())
{
...
...
src/chat/chat-room/client-group-chat-room.h
View file @
a857bb7c
...
...
@@ -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
onSecurity
Aler
t
(
const
std
::
shared_ptr
<
ConferenceSecurityEvent
>
&
event
)
override
;
void
onSecurity
Even
t
(
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
;
...
...
src/chat/encryption/lime-v2.cpp
View file @
a857bb7c
...
...
@@ -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
::
Security
Aler
tType
security
Aler
tType
=
ConferenceSecurityEvent
::
Security
Aler
tType
::
MultideviceParticipant
;
shared_ptr
<
ConferenceSecurityEvent
>
securityEvent
=
make_shared
<
ConferenceSecurityEvent
>
(
time
(
nullptr
),
chatRoom
->
getConferenceId
(),
security
Aler
tType
);
confListener
->
onSecurity
Aler
t
(
securityEvent
);
ConferenceSecurityEvent
::
Security
Even
tType
security
Even
tType
=
ConferenceSecurityEvent
::
Security
Even
tType
::
MultideviceParticipant
Detected
;
shared_ptr
<
ConferenceSecurityEvent
>
securityEvent
=
make_shared
<
ConferenceSecurityEvent
>
(
time
(
nullptr
),
chatRoom
->
getConferenceId
(),
security
Even
tType
);
confListener
->
onSecurity
Even
t
(
securityEvent
);
}
return
ChatMessageModifier
::
Result
::
Error
;
}
...
...
src/conference/conference-listener.h
View file @
a857bb7c
...
...
@@ -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
onSecurity
Aler
t
(
const
std
::
shared_ptr
<
ConferenceSecurityEvent
>
&
event
)
{}
virtual
void
onSecurity
Even
t
(
const
std
::
shared_ptr
<
ConferenceSecurityEvent
>
&
event
)
{}
virtual
void
onFirstNotifyReceived
(
const
IdentityAddress
&
addr
)
{}
virtual
void
onParticipantAdded
(
const
std
::
shared_ptr
<
ConferenceParticipantEvent
>
&
event
,
bool
isFullState
)
{}
...
...
src/conference/session/media-session.cpp
View file @
a857bb7c
...
...
@@ -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
()
<<
")"
;
}
...
...
src/db/main-db.cpp
View file @
a857bb7c
...
...
@@ -175,7 +175,7 @@ namespace {
EventLog
::
Type
::
ConferenceParticipantSetAdmin
,
EventLog
::
Type
::
ConferenceParticipantUnsetAdmin
,
EventLog
::
Type
::
ConferenceSubjectChanged
,
EventLog
::
Type
::
ConferenceSecurity
Aler
t
EventLog
::
Type
::
ConferenceSecurity
Even
t
>::
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
::
ConferenceSecurity
Aler
t
:
case
EventLog
::
Type
::
ConferenceSecurity
Even
t
:
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
::
ConferenceSecurity
Aler
t
:
case
EventLog
::
Type
::
ConferenceSecurity
Even
t
:
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
::
Security
Aler
tType
>
(
row
.
get
<
int
>
(
16
)),
static_cast
<
ConferenceSecurityEvent
::
Security
Even
tType
>
(
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
&
security
Aler
tType
=
int
(
static_pointer_cast
<
ConferenceSecurityEvent
>
(
eventLog
)
->
getSecurity
Aler
tType
());
const
int
&
security
Even
tType
=
int
(
static_pointer_cast
<
ConferenceSecurityEvent
>
(
eventLog
)
->
getSecurity
Even
tType
());
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, :security
Aler
tType, :faultyDevice)"
,
soci
::
use
(
eventId
),
soci
::
use
(
security
Aler
tType
),
soci
::
use
(
faultyDevice
);
" VALUES (:eventId, :security
Even
tType, :faultyDevice)"
,
soci
::
use
(
eventId
),
soci
::
use
(
security
Even
tType
),
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
::
ConferenceSecurity
Aler
t
:
case
EventLog
::
Type
::
ConferenceSecurity
Even
t
:
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
::
ConferenceSecurity
Aler
t
:
case
EventLog
::
Type
::
ConferenceSecurity
Even
t
:
case
EventLog
::
Type
::
ConferenceSubjectChanged
:
return
false
;
}
...
...
src/event-log/conference/conference-security-event.cpp
View file @
a857bb7c
...
...
@@ -30,7 +30,7 @@ LINPHONE_BEGIN_NAMESPACE
class
ConferenceSecurityEventPrivate
:
public
ConferenceEventPrivate
{
public:
ConferenceSecurityEvent
::
Security
Aler
tType
security
Aler
tType
;
ConferenceSecurityEvent
::
Security
Even
tType
security
Even
tType
;
IdentityAddress
faultyDevice
;
};
...
...
@@ -39,36 +39,36 @@ public:
ConferenceSecurityEvent
::
ConferenceSecurityEvent
(
time_t
creationTime
,
const
ConferenceId
&
conferenceId
,
Security
Aler
tType
security
Aler
tType
,
Security
Even
tType
security
Even
tType
,
const
IdentityAddress
&
faultyDevice
)
:
ConferenceEvent
(
*
new
ConferenceSecurityEventPrivate
,
Type
::
ConferenceSecurity
Aler
t
,
Type
::
ConferenceSecurity
Even
t
,
creationTime
,
conferenceId
)
{
L_D
();
d
->
security
Aler
tType
=
security
Aler
tType
;
d
->
security
Even
tType
=
security
Even
tType
;
d
->
faultyDevice
=
faultyDevice
;
}
ConferenceSecurityEvent
::
ConferenceSecurityEvent
(
time_t
creationTime
,
const
ConferenceId
&
conferenceId
,
Security
Aler
tType
security
Aler
tType
Security
Even
tType
security
Even
tType
)
:
ConferenceEvent
(
*
new
ConferenceSecurityEventPrivate
,
Type
::
ConferenceSecurity
Aler
t
,
Type
::
ConferenceSecurity
Even
t
,
creationTime
,
conferenceId
)
{
L_D
();
d
->
security
Aler
tType
=
security
Aler
tType
;
d
->
security
Even
tType
=
security
Even
tType
;
}
ConferenceSecurityEvent
::
Security
Aler
tType
ConferenceSecurityEvent
::
getSecurity
Aler
tType
()
const
{
ConferenceSecurityEvent
::
Security
Even
tType
ConferenceSecurityEvent
::
getSecurity
Even
tType
()
const
{
L_D
();
return
d
->
security
Aler
tType
;
return
d
->
security
Even
tType
;
}
const
IdentityAddress
&
ConferenceSecurityEvent
::
getFaultyDevice
()
const
{
...
...
src/event-log/conference/conference-security-event.h
View file @
a857bb7c
...
...
@@ -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
,
Security
Aler
tType
security
Aler
tType
,
Security
Even
tType
security
Even
tType
,
const
IdentityAddress
&
faultyDevice
);
ConferenceSecurityEvent
(
time_t
creationTime
,
const
ConferenceId
&
conferenceId
,
Security
Aler
tType
security
Aler
tType
Security
Even
tType
security
Even
tType
);
Security
Aler
tType
getSecurity
Aler
tType
()
const
;
Security
Even
tType
getSecurity
Even
tType
()
const
;
const
IdentityAddress
&
getFaultyDevice
()
const
;
private:
...
...
tester/group_chat_tester.c
View file @
a857bb7c
...
...
@@ -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_
aler
t
(
cbs
,
chat_room_security_
aler
t
);
linphone_chat_room_cbs_set_security_
even
t
(
cbs
,
chat_room_security_
even
t
);
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
...
...
tester/liblinphone_tester.h
View file @
a857bb7c
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment