5 dh_suidregister - obsolete suid registration program
13 This program used to register suid and sgid files with L<suidregister(1)>,
14 but with the introduction of L<dpkg-statoverride(8)>, registration of files
15 in this way is unnecessary, and even harmful, so this program should not be
18 =head1 CONVERTING TO STATOVERRIDE
20 Converting a package that uses this program to use the new statoverride
21 mechanism is easy. Just remove the call to dh_suidregister from
22 debian/rules, and add a versioned conflicts into your control file, as
25 Conflicts: suidmanager (<< 0.50)
27 The conflicts is only necessary if your package used to register things
28 with suidmanager; if it did not, you can just remove the call to this
29 program from your rules file.
34 use Debian::Debhelper::Dh_Lib;
39 foreach my $package (@{$dh{DOPACKAGES}}) {
40 my $tmp=tmpdir($package);
41 my $suid=pkgfile($package,"suid");
46 @files=filearray($suid, $tmp);
49 if (($package eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
53 if (! @files && ! $suid) {
54 # No files specified (and no empty debian/suid file), so
55 # guess what files to process.
56 @files=split(/\n/,`find $tmp -type f -perm +6000`);
58 # Strip the debian working directory off of the filenames.
62 # We will strip leading /'s, so the user can feed this
63 # program either absolute filenames, or relative filenames,
64 # and it will do the right thing either way.
68 # Register files with suidregister.
69 foreach my $file (@files) {
70 # Strip leading $tostrip from $file.
73 # Create the sed string that will be used to
74 # fill in the blanks in the autoscript files.
75 # Fill with the owner, group, and perms of the file.
76 my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat("$tmp/$file");
77 # Now come up with the user and group names for the uid and
79 my $user=getpwuid($uid);
80 if (! defined $user) {
81 warning("$file has odd uid $uid, not in /etc/passwd");
84 my $group=getgrgid($gid);
85 if (! defined $group) {
86 warning("$file has odd gid $gid not in /etc/group");
89 # Note that I have to print mode in ocal, stripping file
91 my $sedstr=sprintf("s:#FILE#:$file:;s/#PACKAGE#/$package/;s/#OWNER#/$user/;s/#GROUP#/$group/;s/#PERMS#/%#o/",
93 autoscript($package,"postinst","postinst-suid",$sedstr);
94 autoscript($package,"postrm","postrm-suid","$sedstr");
97 # Remove suid bits from files. This is delayed to this point, because
98 # of a situation with hard linked files if it is done earlier.
99 # See changelog for 2.0.77.
100 foreach my $file (@files) {
101 if ( -e "$tmp/$file") {
102 doit("chmod","a-s","$tmp/$file");
107 warning("This program should no longer be used. Please read the dh_suidregister(1) man page.");
112 # Although they called it, it's not going to do anything.
114 warning("This program is obsolete, does nothing, and may be safely removed from your rules file.");
121 This program is a part of debhelper.
125 Joey Hess <joeyh@debian.org>