summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2006-11-05 11:41:46 +0000
committerMarc Espie <espie@cvs.openbsd.org>2006-11-05 11:41:46 +0000
commit7ce00e21ff6fb86cf4936fda8ea32f78f3364f6c (patch)
tree37eb451f4b3109d5db9059a0a061c029b9aa8a5d /usr.sbin/pkg_add
parent00a2241f1b6f4532e8dc6b61739466bed0cbf27b (diff)
warn for any weird stuff in packages.
Namely: - anything that doesn't belong to owner root/bin, group bin/wheel must be annotated in the packing-list. - any file setuid, setgid, writable by others must be annotated in the packing-list. These warnings must be fixed. They will become errors in the near futur.
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/pkg_create23
1 files changed, 22 insertions, 1 deletions
diff --git a/usr.sbin/pkg_add/pkg_create b/usr.sbin/pkg_add/pkg_create
index d0847b1fcda..197b3789f61 100644
--- a/usr.sbin/pkg_add/pkg_create
+++ b/usr.sbin/pkg_add/pkg_create
@@ -1,6 +1,6 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: pkg_create,v 1.47 2006/10/15 15:37:28 jmc Exp $
+# $OpenBSD: pkg_create,v 1.48 2006/11/05 11:41:45 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -37,6 +37,8 @@ sub anything { ${$_[1]}++; }
sub print_file {}
package OpenBSD::PackingElement::FileBase;
+use POSIX;
+
sub archive
{
my ($self, $arc, $base, $verbose) = @_;
@@ -44,6 +46,25 @@ sub archive
if (defined $arc) {
my $o = $arc->prepare_long($self);
$o->write();
+ if (!defined $self->{owner}) {
+ if ($o->{uname} ne 'root' && $o->{uname} ne 'bin') {
+ print STDERR "Warning: no \@owner for ",
+ $self->fullname(), " (", $o->{uname}, ")\n";
+ }
+ }
+ if (!defined $self->{group}) {
+ if ($o->{gname} ne 'bin' && $o->{gname} ne 'wheel') {
+ print STDERR "Warning: no \@group for ",
+ $self->fullname(), " (", $o->{gname}, ")\n";
+ }
+ }
+ if (!defined $self->{mode} && $o->isFile()) {
+ if (($o->{mode} & (S_ISUID | S_ISGID | S_IWOTH)) != 0) {
+ print STDERR "Warning: weird mode for ",
+ $self->fullname(), ": ",
+ sprintf("%4o", $o->{mode}), "\n";
+ }
+ }
}
if ($verbose) {
print "Adding ", $self->{name}, "\n";