2011-06-30 22:40:22 +00:00
|
|
|
import base64
|
|
|
|
import sys
|
|
|
|
import logging
|
|
|
|
|
|
|
|
from sleekxmpp.plugins.base import base_plugin
|
|
|
|
|
|
|
|
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
class sasl_anonymous(base_plugin):
|
|
|
|
|
|
|
|
def plugin_init(self):
|
|
|
|
self.name = 'SASL ANONYMOUS'
|
|
|
|
self.rfc = '6120'
|
|
|
|
self.description = 'SASL ANONYMOUS Mechanism'
|
2011-07-03 04:57:50 +00:00
|
|
|
self.stanza = self.xmpp['feature_mechanisms'].stanza
|
2011-06-30 22:40:22 +00:00
|
|
|
|
2011-07-03 04:57:50 +00:00
|
|
|
self.xmpp['feature_mechanisms'].register('ANONYMOUS',
|
2011-06-30 22:40:22 +00:00
|
|
|
self._handle_anonymous,
|
|
|
|
priority=self.config.get('priority', 0))
|
|
|
|
|
|
|
|
def _handle_anonymous(self):
|
|
|
|
if self.xmpp.boundjid.user:
|
|
|
|
return False
|
|
|
|
|
2011-07-03 04:57:50 +00:00
|
|
|
resp = self.stanza.Auth(self.xmpp)
|
2011-06-30 22:40:22 +00:00
|
|
|
resp['mechanism'] = 'ANONYMOUS'
|
|
|
|
resp.send(now=True)
|
|
|
|
|
|
|
|
return True
|