summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2016-04-25 10:45:55 +0000
committerMarc Espie <espie@cvs.openbsd.org>2016-04-25 10:45:55 +0000
commit55a84ffd4d4b9895764e70eda6e163cd3608c8d7 (patch)
treeaebd6fcafb4799a2d744ad6914750efa0209e3b7 /usr.sbin/pkg_add/OpenBSD
parentea51a35bafff94b712bdcf0fe9fec241d889e790 (diff)
now that sysmerge happens before us, no need to fallback on _pfetch
revert previous commit
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageRepository.pm23
1 files changed, 8 insertions, 15 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm
index dfaacebab2b..40f14418dce 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackageRepository.pm,v 1.121 2016/04/16 11:00:42 espie Exp $
+# $OpenBSD: PackageRepository.pm,v 1.122 2016/04/25 10:45:54 espie Exp $
#
# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
#
@@ -577,17 +577,21 @@ our @ISA=qw(OpenBSD::PackageRepository::Distant);
our %distant = ();
-sub try_drop
+sub drop_privileges_and_setup_env
{
- my ($self, $user) = @_;
+ my $self = shift;
+ my $user = '_pkgfetch';
+ # we can't cache anything, we happen after the fork,
+ # right before exec
if (my (undef, undef, $uid, $gid) = getpwnam($user)) {
$( = $gid;
$) = "$gid $gid";
$< = $uid;
$> = $uid;
} else {
- return 0;
+ $self->{state}->fatal("Couldn't change identity: can't find #1 user", $user);
}
+
# create sanitized env for ftp
my %newenv = (
HOME => '/var/empty',
@@ -618,17 +622,6 @@ sub try_drop
}
# don't forget to swap!
%ENV = %newenv;
- return 1;
-}
-
-sub drop_privileges_and_setup_env
-{
- my $self = shift;
- my $u1 = '_pkgfetch';
- my $u2 = '_pfetch';
- $self->try_drop($u1) or $self->try_drop($u2) or
- $self->{state}->fatal(
- "Couldn't change identity: missing #1 and #2 users", $u1, $u2);
}