Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
biboumi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
88
Issues
88
List
Boards
Labels
Service Desk
Milestones
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
louiz’
biboumi
Commits
0878a034
Commit
0878a034
authored
Apr 04, 2017
by
louiz’
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not allow pings from resources that aren’t in the channel
fix #3252
parent
e4cc6960
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
1 deletion
+30
-1
src/bridge/bridge.cpp
src/bridge/bridge.cpp
+2
-1
tests/end_to_end/__main__.py
tests/end_to_end/__main__.py
+28
-0
No files found.
src/bridge/bridge.cpp
View file @
0878a034
...
...
@@ -744,9 +744,10 @@ void Bridge::send_irc_participant_ping_request(const Iid& iid, const std::string
const
std
::
string
&
iq_id
,
const
std
::
string
&
to_jid
,
const
std
::
string
&
from_jid
)
{
Jid
from
(
to_jid
);
IrcClient
*
irc
=
this
->
get_irc_client
(
iid
.
get_server
());
IrcChannel
*
chan
=
irc
->
get_channel
(
iid
.
get_local
());
if
(
!
chan
->
joined
)
if
(
!
chan
->
joined
||
!
this
->
is_resource_in_chan
(
iid
.
to_tuple
(),
from
.
resource
)
)
{
this
->
xmpp
.
send_stanza_error
(
"iq"
,
to_jid
,
from_jid
,
iq_id
,
"cancel"
,
"not-allowed"
,
""
,
true
);
...
...
tests/end_to_end/__main__.py
View file @
0878a034
...
...
@@ -1139,6 +1139,34 @@ if __name__ == '__main__':
partial
(
expect_stanza
,
"/iq[@from='#foo%{irc_server_one}/{nick_one}'][@type='result'][@to='{jid_one}/{resource_one}'][@id='first_ping']"
),
]),
Scenario
(
"self_ping_not_in_muc"
,
[
handshake_sequence
(),
partial
(
send_stanza
,
"<presence from='{jid_one}/{resource_one}' to='#foo%{irc_server_one}/{nick_one}' />"
),
connection_sequence
(
"irc.localhost"
,
'{jid_one}/{resource_one}'
),
partial
(
expect_stanza
,
"/message/body[text()='Mode #foo [+nt] by {irc_host_one}']"
),
partial
(
expect_stanza
,
(
"/presence[@to='{jid_one}/{resource_one}'][@from='#foo%{irc_server_one}/{nick_one}']/muc_user:x/muc_user:item[@affiliation='admin'][@role='moderator']"
,
"/presence/muc_user:x/muc_user:status[@code='110']"
)
),
partial
(
expect_stanza
,
"/message[@from='#foo%{irc_server_one}'][@type='groupchat']/subject[not(text())]"
),
# Send a ping to ourself, in a muc where we’re not
partial
(
send_stanza
,
"<iq type='get' from='{jid_one}/{resource_one}' id='first_ping' to='#nil%{irc_server_one}/{nick_one}'><ping xmlns='urn:xmpp:ping' /></iq>"
),
# Immediately receive an error
partial
(
expect_stanza
,
"/iq[@from='#nil%{irc_server_one}/{nick_one}'][@type='error'][@to='{jid_one}/{resource_one}'][@id='first_ping']/error/stanza:not-allowed"
),
# Send a ping to ourself, in a muc where we are, but not this resource
partial
(
send_stanza
,
"<iq type='get' from='{jid_one}/{resource_two}' id='first_ping' to='#foo%{irc_server_one}/{nick_one}'><ping xmlns='urn:xmpp:ping' /></iq>"
),
# Immediately receive an error
partial
(
expect_stanza
,
"/iq[@from='#foo%{irc_server_one}/{nick_one}'][@type='error'][@to='{jid_one}/{resource_two}'][@id='first_ping']/error/stanza:not-allowed"
),
]),
Scenario
(
"self_ping_on_real_channel"
,
[
handshake_sequence
(),
...
...
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