Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
openSUSE:Leap:15.1
python-sleekxmpp
sleekxmpp-check-roster-push-origin.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File sleekxmpp-check-roster-push-origin.patch of Package python-sleekxmpp
--- a/sleekxmpp/clientxmpp.py +++ b/sleekxmpp/clientxmpp.py @@ -16,6 +16,7 @@ from __future__ import absolute_import, import logging +from sleekxmpp.jid import JID from sleekxmpp.stanza import StreamFeatures from sleekxmpp.basexmpp import BaseXMPP from sleekxmpp.exceptions import XMPPError @@ -99,7 +100,17 @@ class ClientXMPP(BaseXMPP): self.add_event_handler('roster_update', self._handle_roster) self.register_stanza(StreamFeatures) - + def roster_push_filter(iq): + from_ = iq['from'] + if from_ and from_ != JID('') and from_ != self.boundjid.bare: + reply = iq.reply() + reply['type'] = 'error' + reply['error']['type'] = 'cancel' + reply['error']['code'] = 503 + reply['error']['condition'] = 'service-unavailable' + reply.send() + return + self.event('roster_update', iq) self.register_handler( Callback('Stream Features', MatchXPath('{%s}features' % self.stream_ns), @@ -107,7 +118,7 @@ class ClientXMPP(BaseXMPP): self.register_handler( Callback('Roster Update', StanzaPath('iq@type=set/roster'), - lambda iq: self.event('roster_update', iq))) + roster_push_filter)) # Setup default stream features self.register_plugin('feature_starttls')
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor