summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2020-01-26 12:50:18 +0000
committerMarc Espie <espie@cvs.openbsd.org>2020-01-26 12:50:18 +0000
commit583cc522db19db5093cb2c588c3712ff3be97ff0 (patch)
treeabbc2feceac95038dcde843c8e82ec3ae1d777e0 /usr.sbin/pkg_add/OpenBSD
parent3468211cfbc548b77ca545433e662e670c3cd42b (diff)
give pkg_create knowledge of WRKOBJDIR, so it can error out if a symlink
points in there. okay aja@ sthen@
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PkgCreate.pm9
1 files changed, 8 insertions, 1 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm
index c3c2fcdda96..4185361a936 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.166 2020/01/13 13:11:31 espie Exp $
+# $OpenBSD: PkgCreate.pm,v 1.167 2020/01/26 12:50:17 espie Exp $
#
# Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org>
#
@@ -131,6 +131,7 @@ sub handle_options
if (defined $state->opt('u')) {
$state->{userlist} = $state->parse_userdb($state->opt('u'));
}
+ $state->{wrkobjdir} = $state->defines('WRKOBJDIR');
}
sub parse_userdb
@@ -291,6 +292,12 @@ sub compute_checksum
} elsif (!-e $chk) {
push(@{$state->{bad_symlinks}{$chk}}, $fname);
}
+ if (defined $state->{wrkobjdir} &&
+ $value =~ m/^\Q$state->{wrkobjdir}\E\//) {
+ $state->error(
+ "bad symlink: #1 (points into WRKOBJDIR)",
+ $fname);
+ }
$result->make_symlink($value);
} elsif (-f _) {
my ($dev, $ino, $size, $mtime) = (stat _)[0,1,7, 9];