| ... |
... |
@@ -29,6 +29,7 @@ from nbxmpp.protocol import Node |
|
29
|
29
|
from nbxmpp.protocol import NodeProcessed
|
|
30
|
30
|
from nbxmpp.protocol import SASL_ERROR_CONDITIONS
|
|
31
|
31
|
from nbxmpp.protocol import SASL_AUTH_MECHS
|
|
|
32
|
+from nbxmpp.protocol import NS_DOMAIN_BASED_NAME
|
|
32
|
33
|
from nbxmpp.util import b64decode
|
|
33
|
34
|
from nbxmpp.util import b64encode
|
|
34
|
35
|
from nbxmpp.const import GSSAPIState
|
| ... |
... |
@@ -77,6 +78,7 @@ class SASL(PlugIn): |
|
77
|
78
|
self._method = None
|
|
78
|
79
|
|
|
79
|
80
|
self._channel_binding = None
|
|
|
81
|
+ self._domain_based_name = None
|
|
80
|
82
|
|
|
81
|
83
|
def _setup_mechs(self):
|
|
82
|
84
|
if self._owner.connected in ('ssl', 'tls'):
|
| ... |
... |
@@ -139,6 +141,11 @@ class SASL(PlugIn): |
|
139
|
141
|
|
|
140
|
142
|
log.info('Available mechanisms: %s', available_mechs)
|
|
141
|
143
|
|
|
|
144
|
+ hostname = stanza.getTag('hostname', namespace=NS_DOMAIN_BASED_NAME)
|
|
|
145
|
+ if hostname is not None:
|
|
|
146
|
+ self._domain_based_name = hostname.getData()
|
|
|
147
|
+ log.info('Found domain based name: %s', self._domain_based_name)
|
|
|
148
|
+
|
|
142
|
149
|
if not available_mechs:
|
|
143
|
150
|
log.error('No available auth mechanisms found')
|
|
144
|
151
|
self._abort_auth('invalid-mechanism')
|
| ... |
... |
@@ -192,7 +199,8 @@ class SASL(PlugIn): |
|
192
|
199
|
|
|
193
|
200
|
elif self._chosen_mechanism == 'GSSAPI':
|
|
194
|
201
|
self._method = GSSAPI(self._owner.Connection)
|
|
195
|
|
- self._method.initiate(self._owner.xmpp_hostname)
|
|
|
202
|
+ self._method.initiate(self._domain_based_name or
|
|
|
203
|
+ self._owner.xmpp_hostname)
|
|
196
|
204
|
|
|
197
|
205
|
else:
|
|
198
|
206
|
log.error('Unknown auth mech')
|