diff options
author | bbaetz%student.usyd.edu.au <> | 2002-04-07 12:56:45 +0200 |
---|---|---|
committer | bbaetz%student.usyd.edu.au <> | 2002-04-07 12:56:45 +0200 |
commit | ae8a18de80c43febc782c4f398e75fdf89281601 (patch) | |
tree | 385198c02a27e1befa5e65f262ca8ca7b7f2edba /globals.pl | |
parent | 09c6150e957783a972ea0123b4c31181f68c7410 (diff) | |
download | bugzilla-ae8a18de80c43febc782c4f398e75fdf89281601.tar.gz bugzilla-ae8a18de80c43febc782c4f398e75fdf89281601.tar.xz |
Bug 134575 - some scripts trying to make world writable directories
r=justdave, gerv
Diffstat (limited to 'globals.pl')
-rw-r--r-- | globals.pl | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/globals.pl b/globals.pl index cb3612671..249945ad9 100644 --- a/globals.pl +++ b/globals.pl @@ -117,6 +117,18 @@ $::superusergroupset = "9223372036854775807"; #} #$::SIG{__DIE__} = \&die_with_dignity; +# Some files in the data directory must be world readable iff we don't have +# a webserver group. Call this function to do this. +sub ChmodDataFile($$) { + my ($file, $mask) = @_; + my $perm = 0770; + if ((stat('data'))[2] & 0002) { + $perm = 0777; + } + $perm = $perm & $mask; + chmod $perm,$file; +} + sub ConnectToDatabase { my ($useshadow) = (@_); if (!defined $::db) { @@ -565,8 +577,6 @@ sub GenerateVersionTable { my @list = sort { uc($a) cmp uc($b)} keys(%::versions); @::legal_product = @list; - mkdir("data", 0777); - chmod 0777, "data"; my $tmpname = "data/versioncache.$$"; open(FID, ">$tmpname") || die "Can't create $tmpname"; @@ -636,7 +646,7 @@ sub GenerateVersionTable { print FID "1;\n"; close FID; rename $tmpname, "data/versioncache" || die "Can't rename $tmpname to versioncache"; - chmod 0666, "data/versioncache"; + ChmodDataFile('data/versioncache', 0666); } |