[Git][NTPsec/ntpsec][master] Address GitLab issue #189: ntpq mrv traceback
Eric S. Raymond
gitlab at mg.gitlab.com
Sat Dec 3 19:00:35 UTC 2016
Eric S. Raymond pushed to branch master at NTPsec / ntpsec
Commits:
d7135c8c by Eric S. Raymond at 2016-12-03T14:00:15-05:00
Address GitLab issue #189: ntpq mrv traceback
- - - - -
1 changed file:
- ntpq/ntpq
Changes:
=====================================
ntpq/ntpq
=====================================
--- a/ntpq/ntpq
+++ b/ntpq/ntpq
@@ -412,8 +412,11 @@ usage: help [ command ]
except:
self.warn("Invalid index literal.\n")
return -1
- if idx not in range(1, len(self.peers)+1):
- self.warn("No such index.\n")
+ if idx < 0 or idx >= 2**16-1:
+ self.warn("%d is not a valid association number.\n" % idx)
+ return -1
+ elif idx not in range(1, len(self.peers)+1):
+ self.warn("No such association as %d.\n" % idx)
return -1
else:
return self.peers[idx - 1].associd
@@ -436,7 +439,7 @@ usage: help [ command ]
return ()
lo = self.__assoc_valid(tokens[0])
hi = self.__assoc_valid(tokens[1])
- if (lo >= 0 and hi >= 0 and hi < lo):
+ if lo < 0 or hi < 0 or hi < 0:
return ()
return (lo, hi)
@@ -518,6 +521,7 @@ usage: help [ command ]
def __dolist(self, varlist, associd, op, type, quiet=False):
"List variables associated with a specified peer."
try:
+ print("Qerying %d" % associd)
variables = self.session.readvar(associd, varlist, op)
except ntp.packet.ControlException as e:
self.warn(e.message + "\n")
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/d7135c8cd8acd662e36e4abee11ac5be404eae94
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161203/1876ce87/attachment.html>
More information about the vc
mailing list