diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2014-11-30 16:44:05 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2014-11-30 16:44:05 +0000 |
commit | 9e67b86ffd7b5e1c015cf1804196627db9d35257 (patch) | |
tree | b6f7197ec3aeba82012ec5f703997e18472946cd | |
parent | d278dfd3beea4c91daa3087542bd56d0d472ff0e (diff) |
much simpler checks, always enforce root/bin (or root/wheel for symlinks)
for files without @owner/@group annotations, independently of who you are.
This should fix building-as-root for good, even without twiddling
FAKE_AS_ROOT.
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/ArcCheck.pm | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/ArcCheck.pm b/usr.sbin/pkg_add/OpenBSD/ArcCheck.pm index fae3964d0f7..1495a48533c 100644 --- a/usr.sbin/pkg_add/OpenBSD/ArcCheck.pm +++ b/usr.sbin/pkg_add/OpenBSD/ArcCheck.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: ArcCheck.pm,v 1.29 2014/09/16 08:51:38 espie Exp $ +# $OpenBSD: ArcCheck.pm,v 1.30 2014/11/30 16:44:04 espie Exp $ # # Copyright (c) 2005-2006 Marc Espie <espie@openbsd.org> # @@ -116,7 +116,7 @@ sub prepare_long } else { delete $entry->{uid}; } - } elsif ($< && $entry->{uid} == $<) { + } else { $entry->{uname} = "root"; delete $entry->{uid}; } @@ -127,10 +127,19 @@ sub prepare_long } else { delete $entry->{gid}; } - } elsif ($< && $( =~ m/\b$entry->{gid}\b/) { + } else { $entry->{gname} = "bin"; delete $entry->{gid}; } + # likewise, we skip links on extractions, so hey, don't even care + # about modes and stuff. + if ($entry->isSymLink) { + $entry->{mode} = 0777; + $entry->{uname} = 'root'; + $entry->{gname} = 'wheel'; + delete $entry->{uid}; + delete $entry->{gid}; + } $entry->recheck_owner; if (!defined $entry->{uname}) { $self->fatal("No user name for #1 (uid #2)", @@ -152,15 +161,6 @@ sub prepare_long if (defined $item->{ts}) { delete $entry->{mtime}; } - # likewise, we skip links on extractions, so hey, don't even care - # about modes and stuff. - if ($entry->isSymLink) { - $entry->{mode} = 0777; - $entry->{uid} = 0; - $entry->{gid} = 0; - $entry->{uname} = 'root'; - $entry->{gname} = 'wheel'; - } $entry->set_name($item->name); return $entry; |