Yo Ian!
+ except IOError:
+ print("***Can't read control key from /etc/ntp.conf")
Seems to me that errors should go to stderr, not stdout.
Also, users can be incredibly thick. Every error should start with:
(progname) ERROR:
RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
[email protected] Tel:+1 541 382 8588
Veritas liberabit vos. -- Quid est veritas?
"If you can’t measure it, you can’t improve it." - Lord Kelvin
Title:
GitLab
Eric S. Raymond pushed to branch master
at NTPsec / ntpsec
Commits:
3 changed files:
Changes:
ntpclients/ntpq.py
| ... |
... |
@@ -544,6 +544,8 @@ usage: poll [n] [verbose] |
|
544
|
544
|
self.session.password()
|
|
545
|
545
|
except ntp.packet.ControlException as e:
|
|
546
|
546
|
self.warn(e.message + "\n")
|
|
|
547
|
+ except IOError:
|
|
|
548
|
+ print("***Can't read control key from /etc/ntp.conf")
|
|
547
|
549
|
|
|
548
|
550
|
def help_passwd(self):
|
|
549
|
551
|
self.say("""\
|
| ... |
... |
@@ -1152,6 +1154,9 @@ usage: lopeers |
|
1152
|
1154
|
except ntp.packet.ControlException as e:
|
|
1153
|
1155
|
self.warn(e.message + "\n")
|
|
1154
|
1156
|
return
|
|
|
1157
|
+ except IOError:
|
|
|
1158
|
+ print("***Can't read control key from /etc/ntp.conf")
|
|
|
1159
|
+ return
|
|
1155
|
1160
|
if self.debug > 2:
|
|
1156
|
1161
|
self.warn("In Config\nKeyword = :config\nCommand = %s\n" % line)
|
|
1157
|
1162
|
try:
|
| ... |
... |
@@ -1298,6 +1303,8 @@ usage: mrulist [tag=value] [tag=value] [tag=value] [tag=value] |
|
1298
|
1303
|
except ntp.packet.ControlException as e:
|
|
1299
|
1304
|
self.warn(e.message + "\n")
|
|
1300
|
1305
|
return
|
|
|
1306
|
+ except IOError:
|
|
|
1307
|
+ print("***Can't read control key from /etc/ntp.conf")
|
|
1301
|
1308
|
|
|
1302
|
1309
|
def help_ifstats(self):
|
|
1303
|
1310
|
self.say("""\
|
| ... |
... |
@@ -1321,6 +1328,8 @@ usage: ifstats |
|
1321
|
1328
|
except ntp.packet.ControlException as e:
|
|
1322
|
1329
|
self.warn(e.message + "\n")
|
|
1323
|
1330
|
return
|
|
|
1331
|
+ except IOError:
|
|
|
1332
|
+ print("***Can't read control key from /etc/ntp.conf")
|
|
1324
|
1333
|
|
|
1325
|
1334
|
def help_reslist(self):
|
|
1326
|
1335
|
self.say("""\
|
pylib/packet.py
| ... |
... |
@@ -1603,11 +1603,13 @@ class Authenticator: |
|
1603
|
1603
|
keyid = int(line.split()[1])
|
|
1604
|
1604
|
(keytype, passwd) = self.passwords[keyid]
|
|
1605
|
1605
|
if passwd is None:
|
|
|
1606
|
+ # Invalid key ID
|
|
1606
|
1607
|
raise ValueError
|
|
1607
|
1608
|
if len(passwd) > 20:
|
|
1608
|
1609
|
passwd = ntp.util.hexstr2octets(passwd)
|
|
1609
|
1610
|
return (keyid, keytype, passwd)
|
|
1610
|
1611
|
else:
|
|
|
1612
|
+ # No control lines found
|
|
1611
|
1613
|
raise ValueError
|
|
1612
|
1614
|
|
|
1613
|
1615
|
@staticmethod
|
tests/pylib/test_packet.py
| ... |
... |
@@ -1919,6 +1919,22 @@ class TestAuthenticator(unittest.TestCase): |
|
1919
|
1919
|
except ValueError:
|
|
1920
|
1920
|
errored = True
|
|
1921
|
1921
|
self.assertEqual(errored, True)
|
|
|
1922
|
+ # Malformed control line
|
|
|
1923
|
+ self.open_data = ["control foo"]
|
|
|
1924
|
+ try:
|
|
|
1925
|
+ cls.control()
|
|
|
1926
|
+ errored = False
|
|
|
1927
|
+ except ValueError:
|
|
|
1928
|
+ errored = True
|
|
|
1929
|
+ self.assertEqual(errored, True)
|
|
|
1930
|
+ # Non-existent key
|
|
|
1931
|
+ self.open_data = ["control 42"]
|
|
|
1932
|
+ try:
|
|
|
1933
|
+ cls.control()
|
|
|
1934
|
+ errored = False
|
|
|
1935
|
+ except KeyError:
|
|
|
1936
|
+ errored = True
|
|
|
1937
|
+ self.assertEqual(errored, True)
|
|
1922
|
1938
|
finally:
|
|
1923
|
1939
|
ntpp.open = open
|
|
1924
|
1940
|
|
_______________________________________________
vc mailing list
[email protected]
http://lists.ntpsec.org/mailman/listinfo/vc
pgpCkqYs2UOJh.pgp
Description: OpenPGP digital signature
_______________________________________________
devel mailing list
[email protected]
http://lists.ntpsec.org/mailman/listinfo/devel