diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2009-03-05 10:43:01 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2009-03-05 10:43:01 +0000 |
commit | 13189e0df97e9811e0cf1b12baf851a3276e054e (patch) | |
tree | d37de56684d92bcbb26ab5dafff806df4b94c997 /usr.sbin | |
parent | 684bf8a077400d301ed6603368be96ad2943d11d (diff) |
more stuff to check digests during extraction, if wanted.
Fix read/write of digitalsignature stuff.
don't integrate manual-installs, since it's highly variable.
create correct category for digitalsignature, so it gets written out.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackingElement.pm | 34 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackingList.pm | 4 |
2 files changed, 34 insertions, 4 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm index de0ad3b97a3..4662cdd5dec 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackingElement.pm,v 1.153 2009/03/03 11:01:26 espie Exp $ +# $OpenBSD: PackingElement.pm,v 1.154 2009/03/05 10:43:00 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -376,6 +376,30 @@ sub make_hardlink $self->{link} = $linkname; } +sub may_check_digest +{ + my ($self, $file, $state) = @_; + if ($state->{check_digest}) { + $self->check_digest($file, $state); + } +} + +sub check_digest +{ + my ($self, $file, $state) = @_; + if (!defined $self->{d}) { + $state->fatal($self->fullname, " does not have a signature"); + } + my $d = $self->compute_digest($file->{destdir}.$file->{name}); + if (!$d->equals($self->{d})) { + $state->fatal("checksum for ", $self->fullname, + " does not match"); + } + if ($state->{very_verbose}) { + print "Checksum match for ", $self->fullname, "\n"; + } +} + sub IsFile() { 1 } package OpenBSD::PackingElement::File; @@ -764,6 +788,11 @@ our @ISA=qw(OpenBSD::PackingElement::UniqueOption); sub category() { 'manual-installation' } +# XXX don't incorporate this in signatures. +sub write_no_sig() +{ +} + package OpenBSD::PackingElement::SystemPackage; our @ISA=qw(OpenBSD::PackingElement::UniqueOption); @@ -1574,6 +1603,7 @@ package OpenBSD::PackingElement::DigitalSignature; our @ISA=qw(OpenBSD::PackingElement::Unique); sub keyword() { 'digital-signature' } __PACKAGE__->register_with_factory; +sub category() { "digital-signature" } # parse to and from a subset of iso8601 # @@ -1628,7 +1658,7 @@ sub write_no_sig { my ($self, $fh) = @_; print $fh "\@", $self->keyword, " ", $self->{key}, ":", - $self->{timestamp}, "\n"; + time_to_iso8601($self->{timestamp}), "\n"; } package OpenBSD::PackingElement::Old; diff --git a/usr.sbin/pkg_add/OpenBSD/PackingList.pm b/usr.sbin/pkg_add/OpenBSD/PackingList.pm index 72088ed1697..4a9c6d19a47 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackingList.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackingList.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackingList.pm,v 1.85 2008/10/20 10:25:16 espie Exp $ +# $OpenBSD: PackingList.pm,v 1.86 2009/03/05 10:43:00 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -381,7 +381,7 @@ sub is_signed } our @unique_categories = - (qw(name no-default-conflict manual-installation extrainfo localbase arch)); + (qw(name digital-signature no-default-conflict manual-installation extrainfo localbase arch)); our @list_categories = (qw(conflict pkgpath incompatibility updateset depend |