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
2c0e1fea
Commit
2c0e1fea
authored
Sep 11, 2018
by
Matthieu Tanon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix infinite IMDN loop by authorising clear IMDN and isComposing messages
parent
982f665d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
2 deletions
+31
-2
src/chat/chat-message/chat-message-p.h
src/chat/chat-message/chat-message-p.h
+4
-0
src/chat/chat-message/chat-message.cpp
src/chat/chat-message/chat-message.cpp
+17
-0
src/chat/encryption/lime-v2.cpp
src/chat/encryption/lime-v2.cpp
+10
-2
No files found.
src/chat/chat-message/chat-message-p.h
View file @
2c0e1fea
...
...
@@ -126,6 +126,9 @@ public:
void
setEncryptionPrevented
(
bool
value
)
{
encryptionPrevented
=
value
;
}
void
setAuthorisationWarning
(
bool
value
)
{
authorizationWarning
=
value
;
}
// TODO find better name
bool
getAuthorisationWarning
()
{
return
authorizationWarning
;
}
// TODO find better name
// -----------------------------------------------------------------------------
// Deprecated methods only used for C wrapper, to be removed some day...
// -----------------------------------------------------------------------------
...
...
@@ -213,6 +216,7 @@ private:
IdentityAddress
fromAddress
;
IdentityAddress
authenticatedFromAddress
;
bool
senderAuthenticationEnabled
=
true
;
bool
authorizationWarning
=
false
;
// TODO find a better name
IdentityAddress
toAddress
;
ChatMessage
::
State
state
=
ChatMessage
::
State
::
Idle
;
...
...
src/chat/chat-message/chat-message.cpp
View file @
2c0e1fea
...
...
@@ -533,6 +533,23 @@ LinphoneReason ChatMessagePrivate::receive () {
currentRecvStep
|=
ChatMessagePrivate
::
Step
::
Cpim
;
}
// Message Authorisation (could be done in CPIM modifier)
// If LIMEv2 enabled, check authorisation warning flag
// If warning flag is true, check if message is an isComposing or an IMDN
if
(
q
->
getSharedFromThis
()
->
getPrivate
()
->
getAuthorisationWarning
())
{
if
(
q
->
getSharedFromThis
()
->
getInternalContent
().
getContentType
()
!=
ContentType
::
Imdn
&&
q
->
getSharedFromThis
()
->
getInternalContent
().
getContentType
()
!=
ContentType
::
ImIsComposing
)
{
// TODO acknowledge message reception with errorCode = 0
// TODO return a "message refused because not encrypted" IMDN to the sender
errorCode
=
415
;
// TODO 415 for example, maybe another one is better ? 488 ? 603 ?
reason
=
linphone_error_code_to_reason
(
errorCode
);
if
(
getNegativeDeliveryNotificationRequired
())
{
static_cast
<
ChatRoomPrivate
*>
(
q
->
getChatRoom
()
->
getPrivate
())
->
sendDeliveryErrorNotification
(
q
->
getSharedFromThis
(),
reason
);
}
return
reason
;
}
if
((
currentRecvStep
&
ChatMessagePrivate
::
Step
::
Multipart
)
==
ChatMessagePrivate
::
Step
::
Multipart
)
{
lInfo
()
<<
"Multipart step already done, skipping"
;
}
else
{
...
...
src/chat/encryption/lime-v2.cpp
View file @
2c0e1fea
...
...
@@ -280,10 +280,18 @@ ChatMessageModifier::Result LimeV2::processIncomingMessage (const shared_ptr<Cha
internalContent
=
message
->
getInternalContent
();
// Check if message if encrypted and unwrap the multipart
ContentType
incomingContentType
=
message
->
getInternalContent
().
getContentType
();
ContentType
expectedContentType
=
ContentType
::
Encrypted
;
expectedContentType
.
addParameter
(
"boundary"
,
MultipartBoundary
);
if
(
internalContent
.
getContentType
()
!=
expectedContentType
)
{
lError
()
<<
"LIMEv2 unexpected content-type: "
<<
internalContent
.
getContentType
();
if
(
incomingContentType
==
ContentType
::
Cpim
)
{
lInfo
()
<<
"LIMEv2 incoming CPIM message"
;
message
->
getPrivate
()
->
setAuthorisationWarning
(
true
);
// Disable sender authentication otherwise the message will always get discarded because it doesn't have a sipfrag
message
->
getPrivate
()
->
enableSenderAuthentication
(
false
);
return
ChatMessageModifier
::
Result
::
Skipped
;
}
else
if
(
incomingContentType
!=
expectedContentType
)
{
lError
()
<<
"LIMEv2 unexpected content-type: "
<<
incomingContentType
;
return
ChatMessageModifier
::
Result
::
Error
;
}
list
<
Content
>
contentList
=
ContentManager
::
multipartToContentList
(
internalContent
);
...
...
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