/ /home/httpd/perl #print("Not wrapping setuid scripts\n"); $fslist=''; open(FIND, "find -xdev -type f \\( -perm -04000 -o -perm -02000 \\) -print|"); while (<FIND>) { chop; next unless -T; print("Fixing ", $_, "\n"); ($dir,$file) = m|(.*)/(.*)|; chdir $dir || die "Can't chdir to $dir"; ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat($file); die("Can't stat $_") unless $ino; rename($file,".$file"); chmod(($mode & 01777), ".$file");# wipe out set[ug]id bits open(C,">.tmp$$.c") || die("Can't write C program for $_"); $real = "$dir/.$file"; print C ' int execv (const char *filename, char *const argv[]); int main(argc,argv) int argc; char **argv; { execv("' . $real . '",argv); } '; close C; system('/usr/bin/cc', ".tmp$$.c", '-o', $file); die("Can't compile new $_") if $?; chown($uid, $gid, $file); chmod($mode, $file); unlink(".tmp$$.c"); chdir('/'); }