From 93193ee18daeafbfed7e13bc5cfa21fdb77e305b Mon Sep 17 00:00:00 2001 From: Istvan Ruzman Date: Wed, 12 Aug 2020 10:22:01 +0200 Subject: [PATCH] Fix: refresh message authentication when serialising --- src/pyrad3/packet.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/pyrad3/packet.py b/src/pyrad3/packet.py index a48d446..ffbc700 100644 --- a/src/pyrad3/packet.py +++ b/src/pyrad3/packet.py @@ -183,6 +183,8 @@ class Packet(OrderedDict): def serialize(self) -> bytes: """Serialize the Packet to the RADIUS Line Format""" + if self.host.message_authenticator: + self.add_message_authenticator() # TODO: This is not an abstract method raise NotImplementedError @@ -298,17 +300,12 @@ class AcctPacket(Packet): # pylint: disable=abstract-method def increase_acct_delay_time(self, delay_time: float): """Increase the Accounting Delay Time - This method automatically adjust the Authenticator - and the Message-Authenticator (if present) - No check for the Accounting Codes are made, an Accounting-Respones should not contain the Acct-Delay-Time Attribute. """ try: self["Acct-Delay-Time"] += int(delay_time) - if self.host.message_authenticator: - self.refresh_message_authenticator() except KeyError: pass