diff options
author | Lance Stout <lancestout@gmail.com> | 2011-08-03 17:00:51 -0700 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2011-08-03 17:00:51 -0700 |
commit | d4091dbde641dc9796b51e032ea23a0ba5c1fcbb (patch) | |
tree | 4efc7d117b4e40b630c3b09a7f983ba2dbd3cb98 /sleekxmpp/features/sasl_plain.py | |
parent | 9a6eb333e65e58f705aca6a8874d5b65bd52e0e7 (diff) | |
download | slixmpp-d4091dbde641dc9796b51e032ea23a0ba5c1fcbb.tar.gz slixmpp-d4091dbde641dc9796b51e032ea23a0ba5c1fcbb.tar.bz2 slixmpp-d4091dbde641dc9796b51e032ea23a0ba5c1fcbb.tar.xz slixmpp-d4091dbde641dc9796b51e032ea23a0ba5c1fcbb.zip |
Integrate a modified version of Dave Cridland's Suelta SASL library.
Diffstat (limited to 'sleekxmpp/features/sasl_plain.py')
-rw-r--r-- | sleekxmpp/features/sasl_plain.py | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/sleekxmpp/features/sasl_plain.py b/sleekxmpp/features/sasl_plain.py deleted file mode 100644 index 427660ab..00000000 --- a/sleekxmpp/features/sasl_plain.py +++ /dev/null @@ -1,41 +0,0 @@ -import base64 -import sys -import logging - -from sleekxmpp.plugins.base import base_plugin - - -log = logging.getLogger(__name__) - - -class sasl_plain(base_plugin): - - def plugin_init(self): - self.name = 'SASL PLAIN' - self.rfc = '6120' - self.description = 'SASL PLAIN Mechanism' - self.stanza = self.xmpp['feature_mechanisms'].stanza - - self.xmpp['feature_mechanisms'].register('PLAIN', - self._handle_plain, - priority=self.config.get('priority', 1)) - - def _handle_plain(self): - if not self.xmpp.boundjid.user: - return False - - if sys.version_info < (3, 0): - user = bytes(self.xmpp.boundjid.user) - password = bytes(self.xmpp.password) - else: - user = bytes(self.xmpp.boundjid.user, 'utf-8') - password = bytes(self.xmpp.password, 'utf-8') - - auth = base64.b64encode(b'\x00' + user + \ - b'\x00' + password).decode('utf-8') - - resp = self.stanza.Auth(self.xmpp) - resp['mechanism'] = 'PLAIN' - resp['value'] = auth - resp.send(now=True) - return True |