Esempio n. 1
0
 def _recv_sasl_message(self):
   header = read_all_compat(self._trans, 5)
   status, length = struct.unpack(">BI", header)
   if length > 0:
     payload = read_all_compat(self._trans, length)
   else:
     payload = ""
   return status, payload
Esempio n. 2
0
 def _read_frame(self):
   header = read_all_compat(self._trans, 4)
   (length,) = struct.unpack(">I", header)
   if self.encode:
     # If the frames are encoded (i.e. you're using a QOP of auth-int or
     # auth-conf), then make sure to include the header in the bytes you send to
     # sasl.decode()
     encoded = header + read_all_compat(self._trans, length)
     success, decoded = self.sasl.decode(encoded)
     if not success:
       raise TTransportException(type=TTransportException.UNKNOWN,
                                 message=self.sasl.getError())
   else:
     # If the frames are not encoded, just pass it through
     decoded = read_all_compat(self._trans, length)
   self.__rbuf = StringIO(decoded)