diff options
author | Norbert Preining <preining@logic.at> | 2017-09-13 01:55:27 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2017-09-13 01:55:27 +0000 |
commit | e93b2d183454ff002d8526083f8706347afd28cc (patch) | |
tree | 2e1f3d619700b8fa98711268dfc03cf09124bed1 /Master/tlpkg/TeXLive/TLPDB.pm | |
parent | b41be8e206af34f91f7336b0fc4f0621ca26a295 (diff) |
crypto: use symbolic constants, require verification of main tlpdb
git-svn-id: svn://tug.org/texlive/trunk@45286 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive/TLPDB.pm')
-rw-r--r-- | Master/tlpkg/TeXLive/TLPDB.pm | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm index fbf22f8853c..1dcdb3b91cb 100644 --- a/Master/tlpkg/TeXLive/TLPDB.pm +++ b/Master/tlpkg/TeXLive/TLPDB.pm @@ -271,7 +271,7 @@ sub from_file { } else { $self->root($root_from_path); } - $self->verification_status("unknown"); + $self->verification_status($VS_UNKNOWN); my $retfh; my $tlpdbfile; my $is_verified = 0; @@ -367,24 +367,24 @@ sub from_file { # before we open and proceed, verify the downloaded file if ($params{'verify'} && $media ne 'local_uncompressed') { my ($r, $m) = TeXLive::TLCrypto::verify_checksum($tlpdbfile, "$path.$TeXLive::TLConfig::ChecksumExtension"); - if ($r == 1) { + if ($r == $VS_CHECKSUM_ERROR) { tldie("$0: checksum error when downloading $tlpdbfile from $path: $m\n"); - } elsif ($r == 2) { + } elsif ($r == $VS_SIGNATURE_ERROR) { tldie("$0: signature verification error of $tlpdbfile from $path: $m\n"); - } elsif ($r == -1) { + } elsif ($r == $VS_CONNECTION_ERROR) { tldie("$0: cannot download: $m\n"); - } elsif ($r == -2) { + } elsif ($r == $VS_UNSIGNED) { debug("$0: remote database checksum is not signed, continuing anyway!\n"); - $self->verification_status("not signed"); - } elsif ($r == -3) { + $self->verification_status($r); + } elsif ($r == $VS_GPG_UNAVAILABLE) { debug("$0: TLPDB: no gpg available, continuing anyway!\n"); - $self->verification_status("gnupg not available"); - } elsif ($r == -4) { + $self->verification_status($r); + } elsif ($r == $VS_PUBKEY_MISSING) { debug("$0: TLPDB: pubkey missing, continuing anyway!\n"); - $self->verification_status("pubkey missing"); - } elsif ($r == 0) { + $self->verification_status($r); + } elsif ($r == $VS_VERIFIED) { $is_verified = 1; - $self->verification_status("verified"); + $self->verification_status($r); } else { tldie("$0: unexpected return value from verify_checksum: $r\n"); } @@ -393,23 +393,24 @@ sub from_file { } else { if ($params{'verify'} && $media ne 'local_uncompressed') { my ($r, $m) = TeXLive::TLCrypto::verify_checksum($path, "$path.$TeXLive::TLConfig::ChecksumExtension"); - if ($r == 1) { + if ($r == $VS_CHECKSUM_ERROR) { tldie("$0: checksum error when downloading $path from $path: $m\n"); - } elsif ($r == 2) { + } elsif ($r == $VS_SIGNATURE_ERROR) { tldie("$0: signature verification error of $path from $path: $m\n"); - } elsif ($r == -1) { + } elsif ($r == $VS_CONNECTION_ERROR) { tldie("$0: cannot download: $m\n"); - } elsif ($r == -2) { + } elsif ($r == $VS_UNSIGNED) { debug("$0: remote database checksum is not signed, continuing anyway!\n"); - $self->verification_status("not signed"); - } elsif ($r == -3) { + $self->verification_status($r); + } elsif ($r == $VS_GPG_UNAVAILABLE) { debug("$0: TLPDB: no gpg available, continuing anyway!\n"); - $self->verification_status("gnupg not available"); - } elsif ($r == -4) { + $self->verification_status($r); + } elsif ($r == $VS_PUBKEY_MISSING) { debug("$0: TLPDB: pubkey missing, continuing anyway!\n"); - $self->verification_status("pubkey missing"); - } elsif ($r == 0) { + $self->verification_status($r); + } elsif ($r == $VS_VERIFIED) { $is_verified = 1; + $self->verification_status($r); } else { tldie("$0: unexpected return value from verify_checksum: $r\n"); } @@ -1174,8 +1175,8 @@ sub is_verified { =item C<< $tlpdb->verification_status >> -Returns a short textual explanation of the verification status. -In particular if the database is not verified, it returns the reason. +Returns the id of the verification status. To obtain a textual representation +us %TLCrypto::VerificationStatusDescription. =cut |