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
e4cc6960
Commit
e4cc6960
authored
Apr 04, 2017
by
louiz’
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle some iq of type='error' as valid ping response
fix #3251
parent
62225e8f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
1 deletion
+51
-1
src/xmpp/biboumi_component.cpp
src/xmpp/biboumi_component.cpp
+13
-1
tests/end_to_end/__main__.py
tests/end_to_end/__main__.py
+38
-0
No files found.
src/xmpp/biboumi_component.cpp
View file @
e4cc6960
...
...
@@ -564,6 +564,12 @@ void BiboumiComponent::handle_iq(const Stanza& stanza)
else
if
(
type
==
"error"
)
{
stanza_error
.
disable
();
const
auto
it
=
this
->
waiting_iq
.
find
(
id
);
if
(
it
!=
this
->
waiting_iq
.
end
())
{
it
->
second
(
bridge
,
stanza
);
this
->
waiting_iq
.
erase
(
it
);
}
}
}
catch
(
const
IRCNotConnected
&
ex
)
...
...
@@ -807,8 +813,14 @@ void BiboumiComponent::send_ping_request(const std::string& from,
{
log_error
(
"Received a corresponding ping result, but the 'to' from "
"the response mismatches the 'from' of the request"
);
return
;
}
else
const
std
::
string
type
=
stanza
.
get_tag
(
"type"
);
const
XmlNode
*
error
=
stanza
.
get_child
(
"error"
,
COMPONENT_NS
);
// Check if what we receive is considered a valid response. And yes, those errors are valid responses
if
(
type
==
"result"
||
(
type
==
"error"
&&
error
&&
(
error
->
get_child
(
"feature-not-implemented"
,
STANZA_NS
)
||
error
->
get_child
(
"service-unavailable"
,
STANZA_NS
))))
bridge
->
send_irc_ping_result
({
from
,
bridge
},
id
);
};
this
->
waiting_iq
[
id
]
=
result_cb
;
...
...
tests/end_to_end/__main__.py
View file @
e4cc6960
...
...
@@ -1101,6 +1101,44 @@ if __name__ == '__main__':
),
partial
(
expect_stanza
,
"/message[@from='#biboumi
\\
40louiz.org
\\
3a80%{irc_server_one}'][@type='groupchat']/subject[not(text())]"
),
]),
Scenario
(
"self_ping_with_error"
,
[
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
partial
(
send_stanza
,
"<iq type='get' from='{jid_one}/{resource_one}' id='first_ping' to='#foo%{irc_server_one}/{nick_one}'><ping xmlns='urn:xmpp:ping' /></iq>"
),
# We receive our own ping request,
partial
(
expect_stanza
,
"/iq[@from='{lower_nick_one}%{irc_server_one}'][@type='get'][@to='{jid_one}/{resource_one}'][@id='gnip_tsrif']"
),
# Respond to the request with an error
partial
(
send_stanza
,
"<iq from='{jid_one}/{resource_one}' id='gnip_tsrif' to='{lower_nick_one}%{irc_server_one}' type='error'><error type='cancel'><feature-not-implemented xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></iq>"
),
partial
(
expect_stanza
,
"/iq[@from='#foo%{irc_server_one}/{nick_one}'][@type='result'][@to='{jid_one}/{resource_one}'][@id='first_ping']"
),
# Send a ping to ourself
partial
(
send_stanza
,
"<iq type='get' from='{jid_one}/{resource_one}' id='first_ping' to='#foo%{irc_server_one}/{nick_one}'><ping xmlns='urn:xmpp:ping' /></iq>"
),
# We receive our own ping request,
partial
(
expect_stanza
,
"/iq[@from='{lower_nick_one}%{irc_server_one}'][@type='get'][@to='{jid_one}/{resource_one}'][@id='gnip_tsrif']"
),
# Respond to the request with an error
partial
(
send_stanza
,
"<iq from='{jid_one}/{resource_one}' id='gnip_tsrif' to='{lower_nick_one}%{irc_server_one}' type='error'><error type='cancel'><service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error></iq>"
),
partial
(
expect_stanza
,
"/iq[@from='#foo%{irc_server_one}/{nick_one}'][@type='result'][@to='{jid_one}/{resource_one}'][@id='first_ping']"
),
]),
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