This is needed to fix issues with dict iteration resulting in different
order of attributes when trying to calculate Message-Authenticator
externally to pyrad.
Signed-off-by: Jouni Malinen <j@w1.fi>
**attributes)
def RequestPacket(self):
- attr = self._PktEncodeAttributes()
+ attr = b''
+ for code,datalst in sorted(self.items()):
+ for data in datalst:
+ attr += self._PktEncodeAttribute(code, data)
if self.id is None:
self.id = random.randrange(0, 256)
# request attributes
req.AddAttribute("Message-Authenticator", 16*b"\x00")
- attrs = req._PktEncodeAttributes()
+ attrs = b''
+ for code,datalst in sorted(req.items()):
+ for data in datalst:
+ attrs += req._PktEncodeAttribute(code, data)
# Length
flen = 4 + 16 + len(attrs)