diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2005-09-24 12:07:39 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2005-09-24 12:07:39 +0000 |
commit | 31dea6e6f15e461783f2b4fb47f12d5d9b1bee31 (patch) | |
tree | 88b1cf0fb75e58a541d32cb364f486475301d015 /usr.sbin/pkg_add/OpenBSD | |
parent | ee3ee1d58ca6a6f192ea6e9b5a8c00c2029c34d9 (diff) |
move uname/gname existence check into ArcCheck: Ustar archives deal with
this differently. Namely, use specific variables that default to the
numeric value if the uid/gid don't exist in mkheader.
Since the entry fields are not filled, ArcCheck gets all it needs for
the package check.
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/ArcCheck.pm | 8 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Ustar.pm | 32 |
2 files changed, 26 insertions, 14 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/ArcCheck.pm b/usr.sbin/pkg_add/OpenBSD/ArcCheck.pm index 8e1702d86be..96c68d97a89 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.1 2005/08/07 14:18:05 espie Exp $ +# $OpenBSD: ArcCheck.pm,v 1.2 2005/09/24 12:07:38 espie Exp $ # # Copyright (c) 2005 Marc Espie <espie@openbsd.org> # @@ -67,6 +67,12 @@ sub prepare_long { my ($self, $filename) = @_; my $entry = $self->prepare($filename); + if (!defined $entry->{uname}) { + die "No user name for ", $entry->{name}, " (uid ", $entry->{uid}, ")\n"; + } + if (!defined $entry->{gname}) { + die "No group name for ", $entry->{name}, " (gid ", $entry->{gid}. "\n"; + } my ($prefix, $name) = split_name($entry->{name}); if (length($name) > MAXFILENAME || length($prefix) > MAXPREFIX) { $self->{name_index} = 0 if !defined $self->{name_index}; diff --git a/usr.sbin/pkg_add/OpenBSD/Ustar.pm b/usr.sbin/pkg_add/OpenBSD/Ustar.pm index 0a7a4b3a3a2..d409894b2da 100644 --- a/usr.sbin/pkg_add/OpenBSD/Ustar.pm +++ b/usr.sbin/pkg_add/OpenBSD/Ustar.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Ustar.pm,v 1.37 2005/09/20 20:06:48 espie Exp $ +# $OpenBSD: Ustar.pm,v 1.38 2005/09/24 12:07:38 espie Exp $ # # Copyright (c) 2002-2004 Marc Espie <espie@openbsd.org> # @@ -200,6 +200,18 @@ sub mkheader $major = 0; $minor = 0; } + my ($uname, $gname); + if (defined $entry->{uname}) { + $uname = $entry->{uname}; + } else { + $uname = $entry->{uid}; + } + if (defined $entry->{gname}) { + $gname = $entry->{gname}; + } else { + $gname = $entry->{gid}; + } + if (defined $entry->{cwd}) { my $cwd = $entry->{cwd}; $cwd.='/' unless $cwd =~ m/\/$/; @@ -217,17 +229,11 @@ sub mkheader if (length $linkname > MAXLINKNAME) { die "Linkname too long $linkname\n"; } - if (!defined $entry->{uname}) { - die "No user name for ", $entry->{name}, " (uid ", $entry->{uid}, ")\n"; - } - if (length $entry->{uname} > MAXUSERNAME) { - die "Username too long ", $entry->{uname}, "\n"; - } - if (!defined $entry->{gname}) { - die "No group name for ", $entry->{name}, " (gid ", $entry->{gid}. "\n"; + if (length $uname > MAXUSERNAME) { + die "Username too long $uname\n"; } - if (length $entry->{gname} > MAXGROUPNAME) { - die "Groupname too long ", $entry->{gname}, "\n"; + if (length $gname > MAXGROUPNAME) { + die "Groupname too long $gname\n"; } my $header; my $cksum = ' 'x8; @@ -243,8 +249,8 @@ sub mkheader $type, $linkname, 'ustar', '00', - $entry->{uname}, - $entry->{gname}, + $uname, + $gname, sprintf("%07o", $major), sprintf("%07o", $minor), $prefix, "\0"); |