[Git][NTPsec/ntpsec][master] Address GitLab issue #448: Crash from ntpsweep

Eric S. Raymond gitlab at mg.gitlab.com
Thu Mar 1 17:51:11 UTC 2018


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
33a4d5ac by Eric S. Raymond at 2018-03-01T17:49:40Z
Address GitLab issue #448: Crash from ntpsweep

- - - - -


2 changed files:

- docs/includes/ntpsweep-body.txt
- ntpclients/ntpsweep.py


Changes:

=====================================
docs/includes/ntpsweep-body.txt
=====================================
--- a/docs/includes/ntpsweep-body.txt
+++ b/docs/includes/ntpsweep-body.txt
@@ -3,7 +3,9 @@
 // tree, and once to make an individual man page.
 
 == Synopsis ==
-+ntpsweep+ [+-l+ 'host']... [-p] [+-m+ 'number'] [+-s+ 'prefix'] [+-h+ 'string']
++ntpsweep+ [+-l+ 'host']... [-p] [+-m+ 'number'] [+-s+ 'prefix']
+[+-h+ 'string'] [hostfile...]
+
 
 == Description ==
 
@@ -41,4 +43,7 @@ appear multiple times.
 +-h+ string, +--host+=_string_::
   Specify a single host.  Deprecated option for backwards compatibility.
 
+If hodtfiles are speciied, they are treated as lists of hostnames
+to be swept, one per line.
+
 // end


=====================================
ntpclients/ntpsweep.py
=====================================
--- a/ntpclients/ntpsweep.py
+++ b/ntpclients/ntpsweep.py
@@ -172,8 +172,12 @@ if __name__ == '__main__':
             print(__doc__, file=sys.stderr)
             raise SystemExit(0)
 
-    if arguments:
-        hostlist += [ln.strip() for ln in open(arguments[0]).readlines()]
+    try:
+        if arguments:
+            hostlist += [ln.strip() for ln in open(arguments[0]).readlines()]
+    except IOError:
+        sys.stderr.write("Host file not found.\n")
+        raise SystemExit(1)
 
     if not hostlist:
         hostlist = ["localhost"]



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/33a4d5acc5c6602f53362687e38b24a30d0b0d21

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/33a4d5acc5c6602f53362687e38b24a30d0b0d21
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20180301/91188191/attachment.html>


More information about the vc mailing list