version 1.1, 2001/11/17 22:46:00
|
version 1.2, 2001/12/06 23:14:33
|
Line 5
|
Line 5
|
# verifymodown.pl - script to enforce file mode and ownership |
# verifymodown.pl - script to enforce file mode and ownership |
# |
# |
# YEAR=2001 |
# YEAR=2001 |
# 11/17 Scott Harrison |
# 11/17,12/6 Scott Harrison |
# |
# |
# $Id$ |
# $Id$ |
### |
### |
Line 19 my $arguments=shift @ARGV;
|
Line 19 my $arguments=shift @ARGV;
|
my ($user)=($arguments=~/\-o (\S+)/); |
my ($user)=($arguments=~/\-o (\S+)/); |
my ($group)=($arguments=~/\-g (\S+)/); |
my ($group)=($arguments=~/\-g (\S+)/); |
my ($mode)=($arguments=~/\-m (\S+)/); |
my ($mode)=($arguments=~/\-m (\S+)/); |
|
my $nofix; |
|
$nofix=1 if $arguments=~/\-N/; |
|
|
my $currentmode=(stat($filename))[2]; |
my $currentmode=(stat($filename))[2]; |
my $currentuser=getpwuid((stat($filename))[4]); |
my $currentuser=getpwuid((stat($filename))[4]); |
Line 31 unless (-l $filename) {
|
Line 33 unless (-l $filename) {
|
$cflag.="[MODE IS $currentmode SHOULD BE $mode]" if $mode ne $currentmode; |
$cflag.="[MODE IS $currentmode SHOULD BE $mode]" if $mode ne $currentmode; |
} |
} |
|
|
$cflag.="[USER IS $currentuser SHOULD BE $user]" if $user ne $currentuser; |
$cflag.="[USER IS $currentuser SHOULD BE $user]" if $user ne $currentuser; |
$cflag.="[GROUP IS $currentgroup SHOULD BE $group]" |
$cflag.="[GROUP IS $currentgroup SHOULD BE $group]" |
if $group ne $currentgroup; |
if $group ne $currentgroup; |
|
|
|
if ($nofix) { |
|
print $cflag; exit; |
|
} |
|
|
if ($cflag) { |
if ($cflag) { |
`chmod $mode $filename`; |
`chmod $mode $filename`; |