X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=lib%2FBackupPC%2FCGI%2FLib.pm;h=70a7e49999ec7b80c2a579982db0573499642714;hp=1133b3a6c9712e1fa26517f1c23f8c8c8a073649;hb=17dcbbebb871212f90b81bb97f8d1feb528bdc43;hpb=5c6a6cc4f333ce44a9df62ab828b0b9341579f7c diff --git a/lib/BackupPC/CGI/Lib.pm b/lib/BackupPC/CGI/Lib.pm index 1133b3a..70a7e49 100644 --- a/lib/BackupPC/CGI/Lib.pm +++ b/lib/BackupPC/CGI/Lib.pm @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 2.1.0beta1, released 9 Apr 2004. +# Version 2.1.0, released 20 Jun 2004. # # See http://backuppc.sourceforge.net. # @@ -102,8 +102,10 @@ sub NewRequest $Lang = $bpc->Lang(); $ConfigMTime = $bpc->ConfigMTime(); } elsif ( $bpc->ConfigMTime() != $ConfigMTime ) { - $bpc->ServerMesg("log Re-read config file because mtime changed"); - $bpc->ServerMesg("server reload"); + $bpc->ConfigRead(); + %Conf = $bpc->Conf(); + $Lang = $bpc->Lang(); + $ConfigMTime = $bpc->ConfigMTime(); } # @@ -120,6 +122,10 @@ sub NewRequest # $MyURL = $ENV{SCRIPT_NAME}; $User = $ENV{REMOTE_USER}; + # + # Handle LDAP uid=user when using mod_authz_ldap + # + $User = $1 if ( $User =~ /uid=([^,]+)/i ); # # Clean up %ENV for taint checking @@ -154,6 +160,15 @@ EOF {map {$_, 1} split(",", $Hosts->{$host}{moreUsers}) } } } + + # + # Untaint the host name + # + if ( $In{host} =~ /^([\w.\s-]+)$/ ) { + $In{host} = $1; + } else { + delete($In{host}); + } } sub timeStamp2 @@ -278,6 +293,8 @@ sub GetStatusInfo { my($status) = @_; ServerConnect(); + %Status = () if ( $status =~ /\bhosts\b/ ); + %StatusHost = () if ( $status =~ /\bhost\(/ ); my $reply = $bpc->ServerMesg("status $status"); $reply = $1 if ( $reply =~ /(.*)/s ); eval($reply); @@ -392,23 +409,27 @@ sub Header { my($title, $content, $noBrowse, $contentSub, $contentPost) = @_; my @adminLinks = ( - { link => "", name => $Lang->{Status}, + { link => "", name => $Lang->{Status}}, + { link => "?action=adminOpts", name => $Lang->{Admin_Options}, + priv => 1}, + { link => "?action=editConfig", name => "Edit Config", + priv => 1}, + { link => "?action=editHosts", name => "Edit Hosts", priv => 1}, - { link => "?action=adminOpts", name => $Lang->{Admin_Options} }, - { link => "?action=summary", name => $Lang->{PC_Summary}, + { link => "?action=summary", name => $Lang->{PC_Summary}}, + { link => "?action=view&type=LOG", name => $Lang->{LOG_file}, priv => 1}, - { link => "?action=view&type=LOG", name => $Lang->{LOG_file} }, - { link => "?action=LOGlist", name => $Lang->{Old_LOGs} }, - { link => "?action=emailSummary", name => $Lang->{Email_summary} }, - { link => "?action=view&type=config", name => $Lang->{Config_file} }, - { link => "?action=view&type=hosts", name => $Lang->{Hosts_file} }, - { link => "?action=queue", name => $Lang->{Current_queues} }, - { link => "?action=view&type=docs", name => $Lang->{Documentation}, + { link => "?action=LOGlist", name => $Lang->{Old_LOGs}, priv => 1}, - { link => "http://backuppc.sourceforge.net/faq", name => "FAQ", + { link => "?action=emailSummary", name => $Lang->{Email_summary}, priv => 1}, - { link => "http://backuppc.sourceforge.net", name => "SourceForge", + { link => "?action=view&type=config", name => $Lang->{Config_file}, priv => 1}, + { link => "?action=view&type=hosts", name => $Lang->{Hosts_file}, + priv => 1}, + { link => "?action=queue", name => $Lang->{Current_queues}, + priv => 1}, + @{$Conf{CgiNavBarLinks} || []}, ); my $host = $In{host}; @@ -420,12 +441,12 @@ sub Header $Conf{CgiHeaders} -
+
EOF if ( defined($Hosts) && defined($host) && defined($Hosts->{$host}) ) { print "
"; - NavSectionTitle("${EscURI($host)}"); + NavSectionTitle("${EscHTML($host)}"); print < \n"; } @@ -487,20 +509,23 @@ $hostSelectbox

EOF } - print < EOF + } NavSectionTitle($Lang->{NavSectionTitle_}); foreach my $l ( @adminLinks ) { - if ( $PrivAdmin || $l->{priv} ) { - NavLink($l->{link}, $l->{name}); + if ( $PrivAdmin || !$l->{priv} ) { + my $txt = $l->{lname} ne "" ? $Lang->{$l->{lname}} : $l->{name}; + NavLink($l->{link}, $txt); + } } -} -print <

EOF