From: Jeff Trawick Date: Thu, 15 May 2014 20:19:10 +0000 (+0000) Subject: Ensure that min/max valid timestamps (milliseconds since the epoch) X-Git-Tag: 2.5.0-alpha~4196 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=56da5cba0adb272b74de745de6e9bf85ae39e1ad;p=apache Ensure that min/max valid timestamps (milliseconds since the epoch) make sense: no negative numbers, and require an input of "-" instead of "0" to indicate that the timestamp isn't being provided. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1595034 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/support/ctlogconfig b/support/ctlogconfig index 4ebef5cb07..a3ac6ff585 100755 --- a/support/ctlogconfig +++ b/support/ctlogconfig @@ -88,12 +88,19 @@ def time_arg(args): t = args.pop(0) if t == '-': return None + bad_val = False + val = None try: - return int(t) + val = int(t) except ValueError: + bad_val = True + + if bad_val or val < 1: print >> sys.stderr, 'The timestamp "%s" is invalid' % t sys.exit(1) + return val + def configure_public_key(cur, args): record_id = record_id_arg(cur, args, False)