Use the username credential instead of jid to enable ANONYMOUS auth.

This commit is contained in:
Lance Stout 2012-11-27 19:53:43 -05:00
parent 2c2498b658
commit 0eb009496e

View file

@ -44,15 +44,16 @@ class FeatureMechanisms(BasePlugin):
}
def plugin_init(self):
if not self.use_mech and not self.xmpp.requested_jid.user:
self.use_mech = 'ANONYMOUS'
if self.sasl_callback is None:
self.sasl_callback = self._default_credentials
if self.security_callback is None:
self.security_callback = self._default_security
creds = self.sasl_callback(set(['username']), set())
if not self.use_mech and not creds['username']:
self.use_mech = 'ANONYMOUS'
self.mech = None
self.mech_list = set()
self.attempted_mechs = set()