diff --git a/Util.pm b/Util.pm index c292a1a1e87797b1333f3db474f489088630cc1d..6edee152446ae2eadd822bd9ce6098b25e3b6459 100644 --- a/Util.pm +++ b/Util.pm @@ -13,7 +13,7 @@ use Crypt::CBC; use Digest::HMAC_SHA1 qw(hmac_sha1_hex); my $blocksize = 8; # A blowfish block is 8 bytes -my $configfile = "/etc/userdir-ldap/userdir-ldap.conf"; +my $configfile = $ENV{USERDIR_LDAP_CONF} // "/etc/userdir-ldap/userdir-ldap.conf"; #my $configfile = "/home/randolph/html/debian/perl/userdir-ldap.conf"; my %config = &ReadConfigFile; @@ -391,11 +391,22 @@ sub LDAPUpdate { ################### # Config file stuff sub ReadConfigFile { + our %config = { }; + &ReadSomeConfigFile($configfile, \%config); + return %config; +} + +sub ReadSomeConfigFile { # reads a config file and results a hashref with the results - my (%config, $attr, $setting); - open (F, "<$configfile") || &HTMLError("Cannot open $configfile: $!"); - while () { + my ($file, $config) = @_; + my ($attr, $setting); + my $fh = new IO::File $file, '<' || &HTMLError("Cannot open config file $file: $!"); + while (<$fh>) { chomp; + if (s{^include\s+(?!=)}{}) { + &ReadSomeConfigFile($_, $config); + next; + } if ((!/^\s*#/) && ($_ ne "")) { # Chop off any trailing comments s/#.*//; @@ -405,11 +416,10 @@ sub ReadConfigFile { $setting =~ s/;$//; $attr =~ s/^\s+//; $attr =~ s/\s+$//; $setting =~ s/^\s+//; $setting =~ s/\s+$//; - $config{$attr} = $setting; + $config->{$attr} = $setting; } } - close F; - return %config; + close $fh; } sub UpgradeConnection($) { diff --git a/html/hostinfo.wml b/html/hostinfo.wml index 796df4b8fbcaed5371c87f004d848fffa121f405..7031f3ad9d7ff6a8f5b950d56a579c3e671bc478 100644 --- a/html/hostinfo.wml +++ b/html/hostinfo.wml @@ -6,8 +6,18 @@