Skip to content

Commit

Permalink
Fix KeyError in _HandleCoaPacket for 0.0.0.0 host
Browse files Browse the repository at this point in the history
When defining a client host `0.0.0.0` for a CoA radius Server, then a
KeyError will occur when handling a CoA packet.

    File ".../pyrad/server.py", line 250, in _HandleCoaPacket
        pkt.secret = self.hosts[pkt.source[0]].secret
                     ~~~~~~~~~~^^^^^^^^^^^^^^^
    KeyError: '172.16.0.100'

The reason seems to be that _AddSecret() was added at some point to
support using `0.0.0.0` as a host, but the `pkt.secret = ...` assignment
that it ought to replace was not removed.

This patch fixes the behavior by removing the stale assignment.
  • Loading branch information
Your Name authored and GIC-de committed Jul 24, 2024
1 parent 3d9cff1 commit eb74634
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion pyrad/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ def _HandleCoaPacket(self, pkt):
:type pkt: Packet class instance
"""
self._AddSecret(pkt)
pkt.secret = self.hosts[pkt.source[0]].secret
if pkt.code == packet.CoARequest:
self.HandleCoaPacket(pkt)
elif pkt.code == packet.DisconnectRequest:
Expand Down

0 comments on commit eb74634

Please sign in to comment.