From 9eaa775cf46f42eee783f48b085b765d08cf3296 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Wed, 24 Jan 2018 03:55:35 +0000 Subject: better debugging and stronger integrity checks git-svn-id: svn://tug.org/texlive/trunk@46421 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/TeXLive/TLCrypto.pm | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'Master/tlpkg/TeXLive/TLCrypto.pm') diff --git a/Master/tlpkg/TeXLive/TLCrypto.pm b/Master/tlpkg/TeXLive/TLCrypto.pm index ed54df1cc42..2d6a0a1cd5a 100644 --- a/Master/tlpkg/TeXLive/TLCrypto.pm +++ b/Master/tlpkg/TeXLive/TLCrypto.pm @@ -180,7 +180,7 @@ sub tlchecksum { } elsif ($::checksum_method eq "digest::sha") { $cs = $out; } - ddebug("tlchecksum: cs ===$cs===\n"); + debug("tlchecksum($file): ===$cs===\n"); if (length($cs) != 128) { tlwarn("unexpected output from $::checksum_method: $out\n"); return ""; @@ -247,23 +247,29 @@ sub verify_checksum { # next step is verification of tlpdb checksum with checksum file # existenc of checksum_file was checked above if (!$checksum_file) { + debug("verify_checksum: download did not succeed for $checksum_url\n"); return($VS_CONNECTION_ERROR, "download did not succeed: $checksum_url"); } # check the signature my ($ret, $msg) = verify_signature($checksum_file, $checksum_url); - return ($ret, $msg) if ($ret != 0); + + if ($ret != 0) { + debug("verify_checksum: returning $ret and $msg\n"); + return ($ret, $msg) + } # verify local data open $cs_fh, "<$checksum_file" or die("cannot read file: $!"); if (read ($cs_fh, $remote_digest, $ChecksumLength) != $ChecksumLength) { close($cs_fh); + debug("verify_checksum: incomplete read from\n $checksum_file\nfor\n $file\nand\n $checksum_url\n"); return($VS_CHECKSUM_ERROR, "incomplete read from $checksum_file"); } else { close($cs_fh); - ddebug("found remote digest: $remote_digest\n"); + debug("verify_checksum: found remote digest\n $remote_digest\nfrom\n $checksum_file\nfor\n $file\nand\n $checksum_url\n"); } $local_digest = tlchecksum($file); - ddebug("local_digest = $local_digest\n"); + debug("verify_checksum: local_digest = $local_digest\n"); if ($local_digest ne $remote_digest) { return($VS_CHECKSUM_ERROR, "digest disagree"); } -- cgit v1.2.3