summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2016-04-21 02:42:47 +0000
committerNorbert Preining <preining@logic.at>2016-04-21 02:42:47 +0000
commit800560e3139b1d2c41bc86a3fbf8659529ee39d8 (patch)
treeb1028a226ce9ac27948b15424ae9babfd302584b
parentec007a1257638d2063647d9712b5ea5d41b1276a (diff)
tlpdb: safe status of being verified, show status for each tlpdb
git-svn-id: svn://tug.org/texlive/trunk@40646 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-xMaster/texmf-dist/scripts/texlive/tlmgr.pl18
-rw-r--r--Master/tlpkg/TeXLive/TLPDB.pm29
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm8
3 files changed, 42 insertions, 13 deletions
diff --git a/Master/texmf-dist/scripts/texlive/tlmgr.pl b/Master/texmf-dist/scripts/texlive/tlmgr.pl
index 30446f90ce0..8efa365f719 100755
--- a/Master/texmf-dist/scripts/texlive/tlmgr.pl
+++ b/Master/texmf-dist/scripts/texlive/tlmgr.pl
@@ -5820,12 +5820,15 @@ sub init_tlmedia {
# this "location-url" line should not be changed since GUI programs
# depend on it:
print "location-url\t$locstr\n" if $::machinereadable;
- info("$prg: package repositories (" .
- ($::gpg ? "" : "not ") . "verified):\n");
- info("\tmain = " . $repos{'main'} . "\n");
+ info("$prg: package repositories\n");
+ info("\tmain = " . $repos{'main'} . " (" .
+ ($remotetlpdb->virtual_get_tlpdb('main')->is_verified ? "" : "not ") .
+ "verified)\n");
for my $t (@tags) {
if ($t ne 'main') {
- info("\t$t = " . $repos{$t} . "\n");
+ info("\t$t = " . $repos{$t} . " (" .
+ ($remotetlpdb->virtual_get_tlpdb($t)->is_verified ? "" : "not ") .
+ "verified)\n");
}
}
return 1;
@@ -5861,7 +5864,7 @@ sub _init_tlmedia {
# depend on it:
print "location-url\t$location\n" if $::machinereadable;
info("$prg: package repository $location (" .
- ($::gpg ? "" : "not ") . "verified)\n");
+ ($remotetlpdb->is_verified ? "" : "not ") . "verified)\n");
return 1;
}
@@ -5904,7 +5907,7 @@ sub setup_one_remotetlpdb {
ddebug("remote path of digest = $path\n");
my ($ret, $msg) = TeXLive::TLUtils::verify_checksum($loc_copy_of_remote_tlpdb, $path);
- if ($ret < 0) {
+ if ($ret == -1) {
info(<<END_NO_INTERNET);
No connection to the internet.
Unable to download the checksum of the remote TeX Live database,
@@ -5920,6 +5923,9 @@ END_NO_INTERNET
$remotetlpdb = TeXLive::TLPDB->new(root => $location,
tlpdbfile => $loc_copy_of_remote_tlpdb);
$local_copy_tlpdb_used = 1;
+ } elsif ($ret == -2) {
+ # the remote database has not be signed, warn
+ debug("$0: remote database is not signed, continuing anyway!\n");
} elsif ($ret == 1) {
# no problem, checksum is wrong, we need to get new tlpdb
} elsif ($ret == 2) {
diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm
index 65999bfc9a5..2e85fb82e1f 100644
--- a/Master/tlpkg/TeXLive/TLPDB.pm
+++ b/Master/tlpkg/TeXLive/TLPDB.pm
@@ -57,6 +57,7 @@ C<TeXLive::TLPDB> -- A database of TeX Live Packages
$tlpdb->package_revision("packagename");
$tlpdb->location;
$tlpdb->platform;
+ $tlpdb->is_verified;
$tlpdb->config_src_container;
$tlpdb->config_doc_container;
$tlpdb->config_container_format;
@@ -132,7 +133,8 @@ sub new {
my %params = @_;
my $self = {
root => $params{'root'},
- tlps => $params{'tlps'}
+ tlps => $params{'tlps'},
+ verified => 0
};
my $verify = defined($params{'verify'}) ? $params{'verify'} : 0;
ddebug("TLPDB new: args: @_ ; verify = $verify\n");
@@ -276,6 +278,7 @@ sub from_file {
}
my $retfh;
my $tlpdbfile;
+ my $is_verified = 0;
# do media detection
my $rootpath = $self->root;
if ($rootpath =~ m,http://|ftp://,) {
@@ -374,8 +377,10 @@ sub from_file {
tldie("$0: signature verification error of $tlpdbfile from $path: $m\n");
} elsif ($r == -1) {
tldie("$0: connection problems, cannot download: $m\n");
+ } elsif ($r == -2) {
+ debug("$0: remote database checksum is not signed, continuing anyway!\n");
} elsif ($r == 0) {
- # all is fine, do nothing
+ $is_verified = 1;
} else {
tldie("$0: unexpected return value from verify_checksum: $r\n");
}
@@ -390,8 +395,10 @@ sub from_file {
tldie("$0: signature verification error of $tlpdbfile from $path: $m\n");
} elsif ($r == -1) {
tldie("$0: connection problems, cannot download: $m\n");
+ } elsif ($r == -2) {
+ debug("$0: remote database checksum is not signed, continuing anyway!\n");
} elsif ($r == 0) {
- # all is fine, do nothing
+ $is_verified = 1;
} else {
tldie("$0: unexpected return value from verify_checksum: $r\n");
}
@@ -414,6 +421,8 @@ sub from_file {
debug(" $path\n");
}
+ $self->{'verified'} = $is_verified;
+
# remove the un-xz-ed tlpdb file from temp dir
# THAT IS RACY!!! we should fix that in some better way with tempfile
close($retfh);
@@ -1137,6 +1146,20 @@ sub platform {
=pod
+=item C<< $tlpdb->is_verified >>
+
+Returns 0/1 depending on whether the tlpdb was verified by checking
+the cryptographic signature.
+
+=cut
+
+sub is_verified {
+ my $self = shift;
+ return $self->{'verified'};
+}
+
+=pod
+
=item C<< $tlpdb->listdir >>
The function C<listdir> allows to read and set the packages variable
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm
index dc3c909df08..9eb2c89be25 100644
--- a/Master/tlpkg/TeXLive/TLUtils.pm
+++ b/Master/tlpkg/TeXLive/TLUtils.pm
@@ -3753,8 +3753,8 @@ sub slurp_file {
Verifies that C<$file> has checksum C<$checksum_url>, and if gpg is
available also verifies that the checksum is signed.
-Returns 0 on success, -1 on connection error, 1 on checksum, and
-2 on signature errors.
+Returns 0 on success, -1 on connection error, -2 on missing signature
+file, 1 on checksum, and 2 on signature errors.
In case of errors returns an informal message as second argument.
=cut
@@ -3831,7 +3831,7 @@ sub download_to_temp_or_file {
Verifies a download of C<$url> into C<$file> by cheking the
gpg signature in C<$url.asc>.
-Returns 0 on success, -1 on connection error, 2 on signature error.
+Returns 0 on success, -2 on missing signature file, 2 on signature error.
In case of errors returns an informal message as second argument.
=cut
@@ -3862,7 +3862,7 @@ GPGERROR
}
} else {
debug("no access to cryptographic signature $signature_url\n");
- return(-1);
+ return(-2, "no access to cryptographic signature");
}
} else {
debug("gpg prog not defined, no checking of signatures\n");