summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2014-01-07 11:51:16 +0000
committerMarc Espie <espie@cvs.openbsd.org>2014-01-07 11:51:16 +0000
commit06c435c63738a554c759c04a747e5b0455a5b96f (patch)
tree5c23b641132596d6265d01a01519ab385bcacf2e /usr.sbin
parent54121efbfc93e851205d904b2ffb01d9e6b14f39 (diff)
integrate signer logic and fix resign with -DSIGNER
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PkgCreate.pm21
1 files changed, 8 insertions, 13 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm
index 91b2198e39b..36dc23ac3d0 100644
--- a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm
@@ -1,6 +1,6 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: PkgCreate.pm,v 1.85 2014/01/07 10:38:12 espie Exp $
+# $OpenBSD: PkgCreate.pm,v 1.86 2014/01/07 11:51:15 espie Exp $
#
# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
#
@@ -1150,13 +1150,19 @@ sub add_signature
{
my ($self, $plist, $state) = @_;
- if ($plist->has('digital-signature')) {
+ if ($plist->has('digital-signature') || $plist->has('signer')) {
if ($state->defines('resign')) {
$state->errsay("Resigning #1", $plist->pkgname);
delete $plist->{'digital-signature'};
+ delete $plist->{signer};
}
}
+ my $signer = $state->{subst}->value('SIGNER');
+ if (defined $signer) {
+ OpenBSD::PackingElement::Signer->add($plist, $signer);
+ }
+
my $sig = $state->{signer}->new_sig;
$sig->add_object($plist);
$sig->{b64sig} = $state->{signer}->compute_signature($state, $plist);
@@ -1169,15 +1175,6 @@ sub create_archive
return OpenBSD::Ustar->new($fh, $state, $dir);
}
-sub setup_signer
-{
- my ($self, $plist, $state) = @_;
- my $signer = $state->{subst}->value('SIGNER');
- if (!defined $signer) {
- return;
- }
- OpenBSD::PackingElement::Signer->add($plist, $signer);
-}
sub sign_existing_package
{
@@ -1187,7 +1184,6 @@ sub sign_existing_package
my $plist = OpenBSD::PackingList->fromfile($dir.CONTENTS);
$plist->set_infodir($dir);
$self->add_signature($plist, $state);
- $self->setup_signer($plist, $state);
$plist->save;
my $tmp = OpenBSD::Temp::permanent_file($output, "pkg");
my $wrarc = $self->create_archive($state, $tmp, ".");
@@ -1273,7 +1269,6 @@ sub add_extra_info
my ($self, $plist, $state) = @_;
my $subst = $state->{subst};
- $self->setup_signer($plist, $state);
my $fullpkgpath = $subst->value('FULLPKGPATH');
my $cdrom = $subst->value('PERMIT_PACKAGE_CDROM') ||
$subst->value('CDROM');;