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
982f665d
Commit
982f665d
authored
Sep 10, 2018
by
Matthieu Tanon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix crash when X3DH server url is empty and clean code
parent
dc894b7f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
6 deletions
+13
-6
src/chat/encryption/encryption-engine-listener.h
src/chat/encryption/encryption-engine-listener.h
+1
-1
src/chat/encryption/lime-v2.cpp
src/chat/encryption/lime-v2.cpp
+10
-3
src/chat/encryption/lime-v2.h
src/chat/encryption/lime-v2.h
+1
-1
src/conference/session/media-session.cpp
src/conference/session/media-session.cpp
+1
-1
No files found.
src/chat/encryption/encryption-engine-listener.h
View file @
982f665d
...
...
@@ -52,7 +52,7 @@ public:
virtual
int
downloadingFile
(
const
std
::
shared_ptr
<
ChatMessage
>
&
message
,
size_t
offset
,
const
uint8_t
*
buffer
,
size_t
size
,
uint8_t
*
decryptedBuffer
)
{
return
0
;
}
virtual
int
uploadingFile
(
const
std
::
shared_ptr
<
ChatMessage
>
&
message
,
size_t
offset
,
const
uint8_t
*
buffer
,
size_t
*
size
,
uint8_t
*
encryptedBuffer
)
{
return
0
;
}
virtual
EncryptionEngineListener
::
EngineType
getEngineType
()
{
return
EngineType
::
Undefined
;
}
virtual
AbstractChatRoom
::
SecurityLevel
getSecurityLevel
(
std
::
string
deviceId
)
const
{
return
AbstractChatRoom
::
SecurityLevel
::
Unsafe
;
}
virtual
AbstractChatRoom
::
SecurityLevel
getSecurityLevel
(
const
std
::
string
&
deviceId
)
const
{
return
AbstractChatRoom
::
SecurityLevel
::
Unsafe
;
}
virtual
void
cleanDb
()
{}
protected:
...
...
src/chat/encryption/lime-v2.cpp
View file @
982f665d
...
...
@@ -111,10 +111,12 @@ BelleSipLimeManager::BelleSipLimeManager (const string &dbAccess, belle_http_pro
LimeV2
::
LimeV2
(
const
std
::
string
&
dbAccess
,
belle_http_provider_t
*
prov
,
LinphoneCore
*
lc
)
{
engineType
=
EncryptionEngineListener
::
EngineType
::
LimeV2
;
curve
=
lime
::
CurveId
::
c25519
;
// c448
x3dhServerUrl
=
linphone_config_get_string
(
linphone_core_get_config
(
lc
),
"lime"
,
"x3dh_server_url"
,
""
);
_dbAccess
=
dbAccess
;
belleSipLimeManager
=
unique_ptr
<
BelleSipLimeManager
>
(
new
BelleSipLimeManager
(
dbAccess
,
prov
,
lc
));
lastLimeUpdate
=
linphone_config_get_int
(
lc
->
config
,
"lime"
,
"last_lime_update_time"
,
0
);
x3dhServerUrl
=
linphone_config_get_string
(
linphone_core_get_config
(
lc
),
"lime"
,
"x3dh_server_url"
,
""
);
if
(
x3dhServerUrl
.
empty
())
lError
()
<<
"LIMEv2 X3DH server URL unavailable for encryption engine"
;
}
string
LimeV2
::
getX3dhServerUrl
()
const
{
...
...
@@ -469,7 +471,7 @@ EncryptionEngineListener::EngineType LimeV2::getEngineType () {
return
engineType
;
}
AbstractChatRoom
::
SecurityLevel
LimeV2
::
getSecurityLevel
(
string
deviceId
)
const
{
AbstractChatRoom
::
SecurityLevel
LimeV2
::
getSecurityLevel
(
const
string
&
deviceId
)
const
{
lime
::
PeerDeviceStatus
status
=
belleSipLimeManager
->
get_peerDeviceStatus
(
deviceId
);
switch
(
status
)
{
case
lime
::
PeerDeviceStatus
::
unknown
:
...
...
@@ -509,6 +511,11 @@ lime::limeCallback LimeV2::setLimeCallback (string operation) {
void
LimeV2
::
onRegistrationStateChanged
(
LinphoneProxyConfig
*
cfg
,
LinphoneRegistrationState
state
,
const
string
&
message
)
{
if
(
state
==
LinphoneRegistrationState
::
LinphoneRegistrationOk
)
{
if
(
x3dhServerUrl
.
empty
())
{
lError
()
<<
"LIMEv2 X3DH server URL unavailable for encryption engine: can't create lime user"
;
return
;
}
char
*
contactAddress
=
linphone_address_as_string_uri_only
(
linphone_proxy_config_get_contact
(
cfg
));
IdentityAddress
identityAddress
=
IdentityAddress
(
contactAddress
);
string
localDeviceId
=
identityAddress
.
asString
();
...
...
@@ -520,7 +527,7 @@ void LimeV2::onRegistrationStateChanged (LinphoneProxyConfig *cfg, LinphoneRegis
lime
::
limeCallback
callback
=
setLimeCallback
(
operation
.
str
());
LinphoneConfig
*
lpconfig
=
linphone_core_get_config
(
linphone_proxy_config_get_core
(
cfg
));
lastLimeUpdate
=
linphone_config_get_int
(
lpconfig
,
"lime"
,
"last_lime_update_time"
,
-
1
);
// TODO should be done by the tester
lastLimeUpdate
=
linphone_config_get_int
(
lpconfig
,
"lime"
,
"last_lime_update_time"
,
-
1
);
try
{
// create user if not exist
...
...
src/chat/encryption/lime-v2.h
View file @
982f665d
...
...
@@ -82,7 +82,7 @@ public:
int
downloadingFile
(
const
std
::
shared_ptr
<
ChatMessage
>
&
message
,
size_t
offset
,
const
uint8_t
*
buffer
,
size_t
size
,
uint8_t
*
decrypted_buffer
)
override
;
int
uploadingFile
(
const
std
::
shared_ptr
<
ChatMessage
>
&
message
,
size_t
offset
,
const
uint8_t
*
buffer
,
size_t
*
size
,
uint8_t
*
encrypted_buffer
)
override
;
EncryptionEngineListener
::
EngineType
getEngineType
()
override
;
AbstractChatRoom
::
SecurityLevel
getSecurityLevel
(
std
::
string
deviceId
)
const
override
;
AbstractChatRoom
::
SecurityLevel
getSecurityLevel
(
const
std
::
string
&
deviceId
)
const
override
;
void
cleanDb
()
override
;
// CoreListener overrides
...
...
src/conference/session/media-session.cpp
View file @
982f665d
...
...
@@ -2824,7 +2824,7 @@ void MediaSessionPrivate::startAudioStream (CallSession::State targetState, bool
const
char
*
charRemoteIk
=
sal_custom_sdp_attribute_find
(
op
->
getRemoteMediaDescription
()
->
custom_sdp_attributes
,
"Ik"
);
// If LIMEv2 is disabled there might not be identity keys
if
(
charLocalIk
!=
NULL
&&
charRemoteIk
!=
NULL
)
{
if
(
charLocalIk
&&
charRemoteIk
)
{
const
string
&
stringB64LocalIk
(
charLocalIk
);
const
string
&
stringB64RemoteIk
(
charRemoteIk
);
...
...
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