/usr/share/perl5/Debian/Dwww/Initialize.pm is in dwww 1.13.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | # vim:ft=perl:cindent:ts=4:sts=4:sw=4:et:fdm=marker:cms=\ #\ %s
#
package Debian::Dwww::Initialize;
use Exporter();
use Sys::Hostname;
use Debian::Dwww::ConfigFile;
use strict;
use vars qw(@ISA @EXPORT);
@ISA = qw(Exporter);
@EXPORT = qw(DwwwInitialize DwwwSetupDirs);
sub DwwwInitialize($) {
my $filename = shift;
my $hostname = &hostname();
$hostname =~ s/\..*$//;
my $cfgvars = ReadConfigFile($filename);
my $dwwwvars = {};
map +{ $dwwwvars->{$_} = $cfgvars->{$_}->{'cfgval'} ? $cfgvars->{$_}->{'cfgval'}
: $cfgvars->{$_}->{'defval'} }, keys %$cfgvars;
umask (022);
$ENV{'PATH'} = "/usr/sbin:/usr/bin:$ENV{'PATH'}";
foreach my $k ( 'DWWW_DOCPATH', 'DWWW_ALLOWEDLINKPATH' ) {
my @paths = split( /:/, $dwwwvars->{$k} );
$dwwwvars->{$k} = \@paths;
}
return $dwwwvars;
}
sub DwwwSetupDirs() {
my $dwwwvars = shift;
my $dir = "/var/cache/dwww";
if ( ! -d "$dir" ) {
mkdir "$dir", 0755 or die "Cannot create directory $dir";
chown 0, 0, "$dir"
}
if ( ! -d "$dir/db" ) {
mkdir "$dir/db", 0755 or die "Cannot create directory $dir/db";
my $uid = (getpwnam("$dwwwvars->{'DWWW_CGIUSER'}"))[2] or die "User $dwwwvars->{'DWWW_CGIUSER'} does not exist\n";
chown $uid, 0, "$dir/db";
}
}
1;
|