summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2016-10-03 10:59:55 +0000
committerMarc Espie <espie@cvs.openbsd.org>2016-10-03 10:59:55 +0000
commitfe3a005b45764a11eff5c24ff4a96c719a8843f5 (patch)
tree3b236194eb2898f6903b638f102800d0a67e7e0e /usr.sbin/pkg_add
parentb678ad863d8cfa3b4d6267a1b6a565206e4acca9 (diff)
throw a decent error message, signify2 can't (yet) sign non local packages
(it would need a way to get "raw" gzip data)
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PkgSign.pm5
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Signer.pm16
2 files changed, 19 insertions, 2 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgSign.pm b/usr.sbin/pkg_add/OpenBSD/PkgSign.pm
index 55d18807f12..aabbb45aec1 100644
--- a/usr.sbin/pkg_add/OpenBSD/PkgSign.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PkgSign.pm
@@ -1,6 +1,6 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: PkgSign.pm,v 1.11 2016/09/28 12:32:13 espie Exp $
+# $OpenBSD: PkgSign.pm,v 1.12 2016/10/03 10:59:54 espie Exp $
#
# Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org>
#
@@ -189,6 +189,9 @@ sub sign_existing_repository
my ($self, $state, $source) = @_;
require OpenBSD::PackageRepository;
my $repo = OpenBSD::PackageRepository->new($source, $state);
+ if ($state->{signer}->want_local && !$repo->is_local_file) {
+ $state->fatal("Signing distant source is not supported");
+ }
my @list = sort @{$repo->list};
if (@list == 0) {
$state->errsay('Source repository "#1" is empty', $source);
diff --git a/usr.sbin/pkg_add/OpenBSD/Signer.pm b/usr.sbin/pkg_add/OpenBSD/Signer.pm
index 148e820e659..02b72b05db8 100644
--- a/usr.sbin/pkg_add/OpenBSD/Signer.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Signer.pm
@@ -1,6 +1,6 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: Signer.pm,v 1.8 2016/09/15 13:14:03 espie Exp $
+# $OpenBSD: Signer.pm,v 1.9 2016/10/03 10:59:54 espie Exp $
#
# Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org>
#
@@ -87,6 +87,11 @@ sub sign
$pkg->wipe_info;
}
+sub want_local
+{
+ return 0;
+}
+
package OpenBSD::Signer::X509;
our @ISA = qw(OpenBSD::Signer);
sub new
@@ -170,10 +175,19 @@ sub sign
my ($signer, $pkg, $state, $tmp) = @_;
my $privkey = $signer->{privkey};
my $url = $pkg->url;
+ if (!$pkg->{repository}->is_local_file) {
+ $pkg->close(1);
+ $state->fatal("Signing distant package #1 is not supported",
+ $url);
+ }
$url =~ s/^file://;
$state->system(OpenBSD::Paths->signify, '-zS', '-s', $privkey, '-m', $url, '-x', $tmp);
}
+sub want_local
+{
+ return 1;
+}
# specific parameter handling plus element creation
package OpenBSD::CreateSign::State;
our @ISA = qw(OpenBSD::AddCreateDelete::State);