From c67116ec1e08c146ba0f315dc58bfdd3ae0d5372 Mon Sep 17 00:00:00 2001 From: Wichert Akkerman Date: Thu, 30 Nov 2000 01:53:35 +0000 Subject: [PATCH] add new --import option to import settings from /etc/suid.conf --- ChangeLog | 5 +++++ TODO | 6 ++++++ debian/changelog | 2 ++ scripts/dpkg-statoverride.8 | 11 ++++++++++- scripts/dpkg-statoverride.pl | 37 +++++++++++++++++++++++++++++++++++- 5 files changed, 59 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c2252adb..37fd8e9c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Nov 30 02:45:42 CET 2000 Wichert Akkerman + + * scripts/dpkg-statoverride.{pl,8}: add new --import option to + import settings from /etc/suid.conf + Tue 28 Nov 18:48:52 CET 2000 peter karlsson * po/sv.po: Terminology changes diff --git a/TODO b/TODO index dd81151a..83df5adb 100644 --- a/TODO +++ b/TODO @@ -17,6 +17,12 @@ dpkg * try to remove directories again after removing conffiles * verify Enhances works (ie don't trigger some assertion) +Fix: + package a conflicted with old versions of package b. package b + conficted with old versions of package a. I had the old versions of both + installed, and told dpkg to install the new versions of a and b + simulantaneously. It refused. + dselect: * support Enhances (GNU/FSF) * toggle for searching through descriptions diff --git a/debian/changelog b/debian/changelog index 51358043..13f826fb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,8 @@ dpkg (1.8.0) unstable; urgency=low * Fix two memory leaks. Closes: Bug#74259 * Fix some things perl5.6 complains about. Closes: Bug#77337 * Fix referenes to dpkg-deb manpage. Closes: Bug#77855 + * Add new --import option to dpkg-statoverride to make it easy to + import suidmanager settings. -- Wichert Akkerman UNRELEASED diff --git a/scripts/dpkg-statoverride.8 b/scripts/dpkg-statoverride.8 index bc2d7020..28794450 100644 --- a/scripts/dpkg-statoverride.8 +++ b/scripts/dpkg-statoverride.8 @@ -1,4 +1,4 @@ -.TH DPKG-STATOVERRIDE 8 "June 2000" "Debian project" "dpkg utililties" +.TH DPKG-STATOVERRIDE 8 "November 2000" "Debian project" "dpkg utililties" .SH NAME dpkg-statoverride -- override ownership and mode of files .SH SYNOPSIS @@ -6,6 +6,8 @@ dpkg-statoverride -- override ownership and mode of files .br \fBdpkg-statoverride\fR [options] --remove \fI\fR .br +\fBdpkg-statoverride\fR [options] --import \fI\fR \fI\fR +.br \fBdpkg-statoverride\fR [options] --list \fI[]\fR .SH DESCRIPTION `\fBstat overrides\fR' are a way to tell dpkg to use a different owner @@ -30,6 +32,13 @@ groups can be specified by their name (for example \fBroot\fR or .I --remove Remove an override for \fB\fR. .TP +.TP +.I --import +Import the override for file \fB\fR as provided by package +\fB\fR. If the user has not made an override nothing is +done and the default permissions are used. If an override is present +it is removed from \fI/etc/suid.conf\fR and added to the statoverride +database. .I --list [] List all overrides. If a glob pattern is specified restrict the output to overrides which match the glob. diff --git a/scripts/dpkg-statoverride.pl b/scripts/dpkg-statoverride.pl index 89ad080f..0d49fbe3 100755 --- a/scripts/dpkg-statoverride.pl +++ b/scripts/dpkg-statoverride.pl @@ -19,6 +19,7 @@ for copying conditions. There is NO warranty. Usage: dpkg-statoverride [options] --add + dpkg-statoverride [options] --import dpkg-statoverride [options] --remove dpkg-statoverride [options] --list [] @@ -61,6 +62,9 @@ while (@ARGV) { } elsif (m/^--list$/) { &CheckModeConflict; $mode= 'list'; + } elsif (m/^--import$/) { + &CheckModeConflict; + $mode= 'import'; } else { &badusage("unknown option \`$_'"); } @@ -118,7 +122,7 @@ if ($mode eq "add") { } } } elsif ($mode eq "remove") { - @ARGV==1 || &badusage("--remove needs four arguments"); + @ARGV==1 || &badusage("--remove needs one arguments"); $file=$ARGV[0]; if (not defined $user{$file}) { print "No override present."; @@ -129,6 +133,37 @@ if ($mode eq "add") { delete $mode{$file}; $dowrite=1; print STDERR "warning: --update is useless for --remove\n" if ($doupdate); +} elsif ($mode eq "import") { + @ARGV==2 || &badusage("--import needs two arguments"); + $pkg=$ARGV[0]; + $file=$ARGV[1]; + if (defined $user{$file}) { + print STDERR "An override for \"$file\" already exists, "; + if ($doforce) { + print STDERR "but --force specified so lets ignore it.\n"; + } else { + print STDERR "aborting\n"; + exit(3); + } + SUIDCONF=open("/etc/suid.conf") || &quit("error opening /etc/suid.conf"); + while () { + chomp; + ($sm_pkg,$sm_file,$sm_user,$sm_group)=split; + next ($sm_file != $pkg) next; + last if ($sm_pkg==$pkg); + $sm_user="#$sm_user") if ($sm_user =~ m/^\d*$/); + $sm_group="#$sm_group") if ($sm_group =~ m/^\d*$/); + $user{$fm_file}=$sm_user; + $group{$fm_file}=$sm_group; + if { -x /usr/sbin/suidunregister) { + @args = ("suidunregister", "$file"); + system(@args) == 0 || &quit("system @args failed: $?"); + } + $dowrite=1; + last; + } + close(SUIDCONF); + } } elsif ($mode eq "list") { my (@list,@ilist,$pattern,$file); -- 2.39.5