Commit acde54c3 authored by Ian Bruene's avatar Ian Bruene
Browse files

Replaced magic number for keyid with MAX_KEYID

parent 3d0e4150
Pipeline #11187854 passed with stages
in 9 minutes and 33 seconds
......@@ -327,6 +327,8 @@ MAXFRAGS = 32
DEFTIMEOUT = 5000
DEFSTIMEOUT = 3000
# The maximum keyid for authentication, keyid is a 16-bit field
MAX_KEYID = 0xFFFF
class Packet:
"Encapsulate an NTP fragment"
......@@ -911,7 +913,7 @@ class ControlSession:
try:
key_id = int(input("Keyid: "))
# FIXME: Magic number, yuck
if key_id == 0 or key_id > 65535:
if key_id == 0 or key_id > MAX_KEYID:
raise ControlException(SERR_BADKEY)
except (SyntaxError, ValueError):
raise ControlException(SERR_BADKEY)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment