Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix KeyError in _HandleCoaPacket for 0.0.0.0 host #196

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mmakaay
Copy link

@mmakaay mmakaay commented May 31, 2024

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant