[Git][NTPsec/ntpsec][master] 2 commits: ntpleapfetch: make clear SHA1 is being used.
Gary E. Miller
gitlab at mg.gitlab.com
Sat Jan 28 03:18:28 UTC 2017
Gary E. Miller pushed to branch master at NTPsec / ntpsec
Commits:
0ae10fe7 by Gary E. Miller at 2017-01-27T19:16:31-08:00
ntpleapfetch: make clear SHA1 is being used.
- - - - -
505e140a by Gary E. Miller at 2017-01-27T19:18:03-08:00
Fix SHA2 reference to SHA1
- - - - -
2 changed files:
- ntpclients/ntpleapfetch
- wafhelpers/configure.py
Changes:
=====================================
ntpclients/ntpleapfetch
=====================================
--- a/ntpclients/ntpleapfetch
+++ b/ntpclients/ntpleapfetch
@@ -249,9 +249,9 @@ INTERVAL=$(( $INTERVAL *1 ))
# #@ number : the NTP date that the file expires
# Date (seconds since 1900) leaps : leaps is the # of seconds to add for times >= Date
# Date lines have comments.
-# #h hex hex hex hex hex is the SHA-1 checksum of the data & dates, excluding whitespace w/o leading zeroes
+# #h hex hex hex hex hex is the SHA1 checksum of the data & dates, excluding whitespace w/o leading zeroes
-function verifySHA {
+function verifySHA1 {
if [ ! -f "$1" ]; then
return 1
@@ -265,27 +265,27 @@ function verifySHA {
local DATA="`echo \"$RAW\" | sed -e'/^#h/d' -e's/^#[\$@]//g' | tr -d '[:space:]'`"
- # Compute the SHA hash of the data, removing the marker and filename
+ # Compute the SHA1 hash of the data, removing the marker and filename
# Computed in binary mode, which shouldn't matter since whitespace has been removed
# shasum comes in several flavors; a portable one is available in Perl (with Digest::SHA)
- local DSHA="`echo -n \"$DATA\" | shasum | sed -e's/[? *].*$//'`"
+ local DSHA1="`echo -n \"$DATA\" | shasum | sed -e's/[? *].*$//'`"
# Extract the file's hash. Restore any leading zeroes in hash segments.
# The sed [] includes a tab (\t) and space; #h is followed by a tab and space
- local FSHA="`echo \"$RAW\" | sed -e'/^#h/!d' -e's/^#h//' -e's/[ ] */ 0x/g'`"
- FSHA=`printf '%08x%08x%08x%08x%08x' $FSHA`
+ local FSHA1="`echo \"$RAW\" | sed -e'/^#h/!d' -e's/^#h//' -e's/[ ] */ 0x/g'`"
+ FSHA1=`printf '%08x%08x%08x%08x%08x' $FSHA1`
- if [ -n "$FSHA" -a \( "$FSHA" = "$DSHA" \) ]; then
+ if [ -n "$FSHA1" -a \( "$FSHA1" = "$DSHA1" \) ]; then
if [ -n "$2" ]; then
log "info" "Checksum of $1 validated"
fi
else
log "error" "Checksum of $1 is invalid:"
- [ -z "$FSHA" ] && FSHA="(no checksum record found in file)"
- log "error" "EXPECTED: $FSHA"
- log "error" "COMPUTED: $DSHA"
+ [ -z "$FSHA1" ] && FSHA1="(no checksum record found in file)"
+ log "error" "EXPECTED: $FSHA1"
+ log "error" "COMPUTED: $DSHA1"
return 1
fi
@@ -329,7 +329,7 @@ fi
# Or is expiring soon
# Download a new one
-if [ -n "$FORCE" ] || ! verifySHA $LEAPFILE "$VERBOSE" || [ $EXPIRES -lt `date -d "NOW + $PREFETCH" +%s` ] ; then
+if [ -n "$FORCE" ] || ! verifySHA1 $LEAPFILE "$VERBOSE" || [ $EXPIRES -lt `date -d "NOW + $PREFETCH" +%s` ] ; then
TRY=0
while true; do
TRY=$(( $TRY + 1 ))
@@ -342,7 +342,7 @@ if [ -n "$FORCE" ] || ! verifySHA $LEAPFILE "$VERBOSE" || [ $EXPIRES -lt `date -
cat ${TMPFILE}.log
fi
- if ! verifySHA $TMPFILE "$VERBOSE" ; then
+ if ! verifySHA1 $TMPFILE "$VERBOSE" ; then
# There is no point in retrying, as the file on the server is almost
# certainly corrupt.
=====================================
wafhelpers/configure.py
=====================================
--- a/wafhelpers/configure.py
+++ b/wafhelpers/configure.py
@@ -511,7 +511,7 @@ def cmd_configure(ctx, config):
"same sockets on alternate interfaces, required "
"by Linux at least")
- # These are required by the SHA2 code and various refclocks
+ # These are required by the SHA1 code and various refclocks
if sys.byteorder == "little":
pass
elif sys.byteorder == "big":
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/1be0b58dd8c7a0f2e2d31d3d568c119d67cacc03...505e140a2bb5afb9029d7b783a45a0530d433a96
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170128/f4cdfe4b/attachment.html>
More information about the vc
mailing list