Philipp Hörist pushed to branch master at gajim / python-nbxmpp

Commits:

2 changed files:

Changes:

  • nbxmpp/auth.py
    ... ... @@ -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')
    

  • nbxmpp/protocol.py
    ... ... @@ -190,6 +190,7 @@ NS_HASHES_BLAKE2B_256 = 'urn:xmpp:hash-function-text-names:id-blake2b256'
    190 190
     NS_HASHES_BLAKE2B_512 = 'urn:xmpp:hash-function-text-names:id-blake2b512'
    
    191 191
     NS_OPENPGP = 'urn:xmpp:openpgp:0'
    
    192 192
     NS_BOOKMARK_CONVERSION = 'urn:xmpp:bookmarks-conversion:0'
    
    193
    +NS_DOMAIN_BASED_NAME = 'urn:xmpp:domain-based-name:1'
    
    193 194
     
    
    194 195
     #xmpp_stream_error_conditions = '''
    
    195 196
     #bad-format --  --  -- The entity has sent XML that cannot be processed.