projects
/
BackupPC.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
use asa logo
[BackupPC.git]
/
lib
/
BackupPC
/
CGI
/
Lib.pm
diff --git
a/lib/BackupPC/CGI/Lib.pm
b/lib/BackupPC/CGI/Lib.pm
index
d6dc53f
..
9861acc
100644
(file)
--- a/
lib/BackupPC/CGI/Lib.pm
+++ b/
lib/BackupPC/CGI/Lib.pm
@@
-11,7
+11,7
@@
# Craig Barratt <cbarratt@users.sourceforge.net>
#
# COPYRIGHT
# Craig Barratt <cbarratt@users.sourceforge.net>
#
# COPYRIGHT
-# Copyright (C) 2003 Craig Barratt
+# Copyright (C) 2003
-2009
Craig Barratt
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@
-29,7
+29,7
@@
#
#========================================================================
#
#
#========================================================================
#
-# Version 3.
0.0alpha, released 23 Jan 2006
.
+# Version 3.
2.0, released 31 Jul 2010
.
#
# See http://backuppc.sourceforge.net.
#
#
# See http://backuppc.sourceforge.net.
#
@@
-102,11
+102,16
@@
sub NewRequest
%Conf = $bpc->Conf();
$Lang = $bpc->Lang();
$ConfigMTime = $bpc->ConfigMTime();
%Conf = $bpc->Conf();
$Lang = $bpc->Lang();
$ConfigMTime = $bpc->ConfigMTime();
+ umask($Conf{UmaskMode});
} elsif ( $bpc->ConfigMTime() != $ConfigMTime ) {
$bpc->ConfigRead();
} elsif ( $bpc->ConfigMTime() != $ConfigMTime ) {
$bpc->ConfigRead();
+ $TopDir = $bpc->TopDir();
+ $LogDir = $bpc->LogDir();
+ $BinDir = $bpc->BinDir();
%Conf = $bpc->Conf();
$Lang = $bpc->Lang();
$ConfigMTime = $bpc->ConfigMTime();
%Conf = $bpc->Conf();
$Lang = $bpc->Lang();
$ConfigMTime = $bpc->ConfigMTime();
+ umask($Conf{UmaskMode});
}
#
}
#
@@
-123,10
+128,16
@@
sub NewRequest
#
$MyURL = $ENV{SCRIPT_NAME};
$User = $ENV{REMOTE_USER};
#
$MyURL = $ENV{SCRIPT_NAME};
$User = $ENV{REMOTE_USER};
+
#
#
- # Handle LDAP uid=user when using mod_authz_ldap
+ # Handle LDAP uid=user when using mod_authz_ldap
and otherwise untaint
#
#
- $User = $1 if ( $User =~ /uid=([^,]+)/i );
+ $User = $1 if ( $User =~ /uid=([^,]+)/i || $User =~ /(.*)/ );
+
+ # strip Active directory domain in front of user
+ $User = $1 if ( $User =~ /\w+\\(\w+)/ );
+#use Data::Dump qw(dump);
+#warn "XX User: $User",dump( \%ENV );
#
# Clean up %ENV for taint checking
#
# Clean up %ENV for taint checking
@@
-177,7
+188,10
@@
sub timeStamp2
my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)
= localtime($_[0] == 0 ? time : $_[0] );
$mon++;
my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)
= localtime($_[0] == 0 ? time : $_[0] );
$mon++;
- if ( $Conf{CgiDateFormatMMDD} ) {
+ if ( $Conf{CgiDateFormatMMDD} == 2 ) {
+ $year += 1900;
+ return sprintf("%04d-%02d-%02d %02d:%02d", $year, $mon, $mday, $hour, $min);
+ } elsif ( $Conf{CgiDateFormatMMDD} ) {
return sprintf("$mon/$mday %02d:%02d", $hour, $min);
} else {
return sprintf("$mday/$mon %02d:%02d", $hour, $min);
return sprintf("$mon/$mday %02d:%02d", $hour, $min);
} else {
return sprintf("$mday/$mon %02d:%02d", $hour, $min);
@@
-285,7
+299,8
@@
sub ServerConnect
Trailer();
exit(1);
} else {
Trailer();
exit(1);
} else {
- ErrorExit(eval("qq{$Lang->{Unable_to_connect_to_BackupPC_server}}"));
+ ErrorExit(eval("qq{$Lang->{Unable_to_connect_to_BackupPC_server}}"),
+ eval("qq{$Lang->{Unable_to_connect_to_BackupPC_server_error_message}}"));
}
}
}
}
}
}
@@
-344,6
+359,10
@@
sub CheckPermission
$Privileged ||= $User eq $Hosts->{$host}{user};
$Privileged ||= defined($Hosts->{$host}{moreUsers}{$User});
$Privileged ||= $User eq $Hosts->{$host}{user};
$Privileged ||= defined($Hosts->{$host}{moreUsers}{$User});
+
+ # XXX check against REMOTE_NTGROUP from mod_ntlm
+ $Privileged ||= $Conf{CgiAdminUserGroup} eq $ENV{REMOTE_NTGROUP};
+
return $Privileged;
}
return $Privileged;
}
@@
-411,14
+430,14
@@
sub Header
my($title, $content, $noBrowse, $contentSub, $contentPost) = @_;
my @adminLinks = (
{ link => "", name => $Lang->{Status}},
my($title, $content, $noBrowse, $contentSub, $contentPost) = @_;
my @adminLinks = (
{ link => "", name => $Lang->{Status}},
- { link => "?action=adminOpts", name => $Lang->{Admin_Options},
- priv => 1},
+ { link => "?action=summary", name => $Lang->{PC_Summary}},
{ link => "?action=editConfig", name => $Lang->{CfgEdit_Edit_Config},
priv => 1},
{ link => "?action=editConfig&newMenu=hosts",
name => $Lang->{CfgEdit_Edit_Hosts},
priv => 1},
{ link => "?action=editConfig", name => $Lang->{CfgEdit_Edit_Config},
priv => 1},
{ link => "?action=editConfig&newMenu=hosts",
name => $Lang->{CfgEdit_Edit_Hosts},
priv => 1},
- { link => "?action=summary", name => $Lang->{PC_Summary}},
+ { link => "?action=adminOpts", name => $Lang->{Admin_Options},
+ priv => 1},
{ link => "?action=view&type=LOG", name => $Lang->{LOG_file},
priv => 1},
{ link => "?action=LOGlist", name => $Lang->{Old_LOGs},
{ link => "?action=view&type=LOG", name => $Lang->{LOG_file},
priv => 1},
{ link => "?action=LOGlist", name => $Lang->{Old_LOGs},
@@
-427,6
+446,11
@@
sub Header
priv => 1},
{ link => "?action=queue", name => $Lang->{Current_queues},
priv => 1},
priv => 1},
{ link => "?action=queue", name => $Lang->{Current_queues},
priv => 1},
+ # XXX additional search extensions
+ { link => "?action=search", name => $Lang->{Search_archive},
+ priv => 0},
+ { link => "?action=burn", name => $Lang->{Burn_media},
+ priv => 1},
@{$Conf{CgiNavBarLinks} || []},
);
my $host = $In{host};
@{$Conf{CgiNavBarLinks} || []},
);
my $host = $In{host};
@@
-438,9
+462,14
@@
sub Header
<html><head>
<title>$title</title>
<link rel=stylesheet type="text/css" href="$Conf{CgiImageDirURL}/$Conf{CgiCSSFile}" title="CSSFile">
<html><head>
<title>$title</title>
<link rel=stylesheet type="text/css" href="$Conf{CgiImageDirURL}/$Conf{CgiCSSFile}" title="CSSFile">
+<link rel=icon href="$Conf{CgiImageDirURL}/favicon.ico" type="image/x-icon">
$Conf{CgiHeaders}
$Conf{CgiHeaders}
+<script src="$Conf{CgiImageDirURL}/sorttable.js"></script>
</head><body onLoad="document.getElementById('NavMenu').style.height=document.body.scrollHeight">
</head><body onLoad="document.getElementById('NavMenu').style.height=document.body.scrollHeight">
+<!--
<a href="http://backuppc.sourceforge.net"><img src="$Conf{CgiImageDirURL}/logo.gif" hspace="5" vspace="7" border="0"></a><br>
<a href="http://backuppc.sourceforge.net"><img src="$Conf{CgiImageDirURL}/logo.gif" hspace="5" vspace="7" border="0"></a><br>
+-->
+<img src="/asa-150x50.png" hspace="5" vspace="7">
EOF
if ( defined($Hosts) && defined($host) && defined($Hosts->{$host}) ) {
EOF
if ( defined($Hosts) && defined($host) && defined($Hosts->{$host}) ) {
@@
-492,8
+521,8
@@
EOF
EOF
my $hostSelectbox = "<option value=\"#\">$Lang->{Select_a_host}</option>";
my @hosts = GetUserHosts($Conf{CgiNavBarAdminAllHosts});
EOF
my $hostSelectbox = "<option value=\"#\">$Lang->{Select_a_host}</option>";
my @hosts = GetUserHosts($Conf{CgiNavBarAdminAllHosts});
+ NavSectionTitle($Lang->{Hosts});
if ( defined($Hosts) && %$Hosts > 0 && @hosts ) {
if ( defined($Hosts) && %$Hosts > 0 && @hosts ) {
- NavSectionTitle($Lang->{Hosts});
foreach my $host ( @hosts ) {
NavLink("?host=${EscURI($host)}", $host)
if ( @hosts < $Conf{CgiNavBarAdminAllHosts} );
foreach my $host ( @hosts ) {
NavLink("?host=${EscURI($host)}", $host)
if ( @hosts < $Conf{CgiNavBarAdminAllHosts} );