From 17dcbbebb871212f90b81bb97f8d1feb528bdc43 Mon Sep 17 00:00:00 2001
From: cbarratt
Date: Sun, 11 Sep 2005 01:37:01 +0000
Subject: [PATCH] Various changes, including changes in 2.1.1 and 2.1.2
releases.
---
ChangeLog | 55 +++++++++++++++++++++++++++++++-
bin/BackupPC | 17 ++++++++--
bin/BackupPC_archive | 5 ++-
bin/BackupPC_archiveHost | 22 +++++++++++--
bin/BackupPC_dump | 16 ++++++++--
bin/BackupPC_restore | 5 ++-
bin/BackupPC_sendEmail | 14 +++++---
bin/BackupPC_tarCreate | 5 +--
bin/BackupPC_tarExtract | 24 +++++++-------
bin/BackupPC_zipCreate | 2 +-
conf/config.pl | 17 +++++++---
configure.pl | 2 +-
doc-src/BackupPC.pod | 9 ++++--
init.d/src/gentoo-backuppc | 1 +
lib/BackupPC/CGI/EditConfig.pm | 3 +-
lib/BackupPC/CGI/Lib.pm | 7 +++-
lib/BackupPC/CGI/Restore.pm | 39 ++++++++++------------
lib/BackupPC/Lang/de.pm | 6 ++--
lib/BackupPC/Lang/es.pm | 6 ++--
lib/BackupPC/Lang/fr.pm | 10 +++---
lib/BackupPC/Lang/it.pm | 8 ++---
lib/BackupPC/Lang/nl.pm | 11 ++++---
lib/BackupPC/Lang/pt_br.pm | 6 ++--
lib/BackupPC/Lib.pm | 8 +++--
lib/BackupPC/View.pm | 30 +++++++++--------
lib/BackupPC/Xfer/Rsync.pm | 4 ++-
lib/BackupPC/Xfer/RsyncFileIO.pm | 2 +-
27 files changed, 229 insertions(+), 105 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 6102576..177734a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -46,7 +46,60 @@
* Add NT_STATUS_FILE_LOCK_CONFLICT to pst read error check in
BackupPC_sendEmail to fix bug reported by Dale Renton.
-* Fixed minor typo in documentation from Richard Ames
+* Fixed simple but serious bug in bin/BackupPC_tarCreate that prevented
+ hardlinks being saved correctly. Debugged by Michael (mna.news) with
+ several other people.
+
+* Fixed serious bug in bin/BackupPC_dump reported/debugged by Dan
+ Niles that can happen when multiple full backups are deleted after
+ $Conf{FullKeepCnt} is changed.
+
+* Added fixup of $ENV{REMOTE_USER} to lib/BackupPC/CGI/Lib.pm in the
+ case of using mod_authz_ldap; patch submitted by Alain Perrier.
+
+* Added env LC_ALL=C to $Conf{TarClientCmd} and $Conf{TarClientRestoreCmd}
+ to avoid locale problems, suggested by Ludovic Drolez.
+
+* Changed ping output parsing to pick out average rtt time, based
+ on patch from Ron Bickers.
+
+* Changed lib/BackupPC/CGI/Lib.pm so that link to "$TopDir/conf/$host.pl"
+ is displayed if it exists. Patch from Andreas Vögele.
+
+* Applied daemonize patch to bin/BackupPC from:
+ http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=301057
+
+* It's now a fatal error if $Conf{CompressLevel} is set, but
+ Compress::Zlib is not found. Before $Conf{CompressLevel} was
+ silently set to 0, which made all the backups uncompressed.
+ That meant the user never knew if they forget to install
+ Compress::Zlib but were expecting compression to be on.
+
+* Finally increased $Conf{ClientTimeout} to 72000 (20 hours).
+
+* Fixed minor documentation typos from Richard Ames, JP Vossen.
+
+* Changed bin/BackupPC_archiveHost to use /bin/csh instead of
+ /bin/sh. That way any errors in the pipeline are reported
+ via the exit status, instead of just the last.
+
+* Added sleep 1 in restart() function in init.d/src/gentoo-backuppc,
+ suggested by Jon Hood.
+
+* Added $DestDir to the path of the CGI image directory in configure.pl.
+ Patch submitted by Andreas Vögele.
+
+* Added $Conf{EMailHeaders} for additional email headers, requested
+ by Ludovic Gasc.
+
+* Made shareName argument regexp checking more general to allow parens.
+
+* Applied extensive patch to French translation from Frederic Lehobey.
+
+* Minor change to Dutch language $Lang{Pool_Stat} from Wander Winkelhorst.
+
+* Minor change to French language $Lang{EMailOutlookBackupMesg} and
+ $Lang{EMailOutlookBackupSubj} from Ludovic Gasc.
#------------------------------------------------------------------------
# Version 2.1.0pl1, 15 Aug 2004
diff --git a/bin/BackupPC b/bin/BackupPC
index dab51db..4c13633 100755
--- a/bin/BackupPC
+++ b/bin/BackupPC
@@ -66,6 +66,7 @@ use Getopt::Std;
use Socket;
use Carp;
use Digest::MD5;
+use POSIX qw(setsid);
###########################################################################
# Handle command line options
@@ -260,10 +261,22 @@ sub Main_Initialize
if ( $opts{d} ) {
#
- # daemonize by forking
+ # daemonize by forking; more robust method per:
+ # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=301057
#
- defined(my $pid = fork) or die "Can't fork: $!";
+ my $pid;
+ defined($pid = fork) or die("Can't fork: $!");
+ exit if( $pid ); # parent exits
+
+ POSIX::setsid();
+ defined($pid = fork) or die("Can't fork: $!");
exit if $pid; # parent exits
+
+ chdir ("/") or die("Cannot chdir to /: $!\n");
+ close(STDIN);
+ open(STDIN , ">/dev/null") or die("Cannot open /dev/null as stdin\n");
+ # STDOUT and STDERR are handled in LogFileOpen() right below,
+ # otherwise we would have to reopen them too.
}
#
diff --git a/bin/BackupPC_archive b/bin/BackupPC_archive
index 6ab75ea..73425d5 100644
--- a/bin/BackupPC_archive
+++ b/bin/BackupPC_archive
@@ -139,7 +139,10 @@ if ( $Conf{ClientNameAlias} ne "" ) {
#
# Setup file extension for compression and open ArchiveLOG output file
#
-$Conf{CompressLevel} = 0 if ( !BackupPC::FileZIO->compOk );
+if ( $Conf{CompressLevel} && !BackupPC::FileZIO->compOk ) {
+ $stat{hostError} = "Compress::Zlib not found";
+ exit(ArchiveCleanup($client));
+}
my $fileExt = $Conf{CompressLevel} > 0 ? ".z" : "";
my $ArchiveLOG = BackupPC::FileZIO->open("$Dir/ArchiveLOG$fileExt", 1,
$Conf{CompressLevel});
diff --git a/bin/BackupPC_archiveHost b/bin/BackupPC_archiveHost
index 4bad6c6..ed481a7 100755
--- a/bin/BackupPC_archiveHost
+++ b/bin/BackupPC_archiveHost
@@ -88,6 +88,22 @@ my $mesg = "Writing tar archive for host $host, backup #$bkupNum";
#
$share = $bpc->shellEscape($share);
$host = $bpc->shellEscape($host);
+
+#
+# We prefer to use /bin/csh because the exit status of a pipeline
+# is non-zero if any command is non zero. In contrast, /bin/sh
+# and /bin/bash use the convention that the exit status is just
+# the exit status of the last command of the pipeline.
+#
+my @shell;
+if ( -x "/bin/csh" ) {
+ @shell = ("/bin/csh", "-cf");
+} elsif ( -x "/bin/sh" ) {
+ @shell = ("/bin/sh", "-c");
+} else {
+ print("Error: Can't find executable /bin/csh or /bin/sh\n");
+ exit(1);
+}
my $cmd = "$tarCreate -t -h $host -n $bkupNum -s $share . ";
$cmd .= "| $compPath " if ( $compPath ne "cat" && $compPath ne "" );
if ( -b $outLoc || -c $outLoc || -f $outLoc ) {
@@ -115,9 +131,9 @@ print("$mesg\n");
#
# Run the command
#
-my $ret = system($cmd);
+my $ret = system(@shell, $cmd);
if ( $ret ) {
- print("Executing: $cmd\n");
+ print("Executing: @shell -cf $cmd\n");
print("Error: $tarCreate, compress or split failed\n");
exit(1);
}
@@ -129,7 +145,7 @@ if ( $ret ) {
if ( -d $outLoc && -x $parPath ) {
if ( $parfile != 0 ) {
print("Running $parPath to create parity files\n");
- my $parCmd = "$parPath c -r$parfile $outLoc/$host.$bkupNum.tar$fileExt.par2 $outLoc/$host.$bkupNum.tar$fileExt.*";
+ my $parCmd = "$parPath c -r$parfile $outLoc/$host.$bkupNum.tar$fileExt.par2 $outLoc/$host.$bkupNum.tar$fileExt*";
$ret = system($parCmd);
if ( $ret ) {
print("Executing: $parCmd\n");
diff --git a/bin/BackupPC_dump b/bin/BackupPC_dump
index ccf71d6..8151cbd 100755
--- a/bin/BackupPC_dump
+++ b/bin/BackupPC_dump
@@ -434,7 +434,11 @@ $bpc->RmTreeDefer("$TopDir/trash", "$Dir/new") if ( -d "$Dir/new" );
#
# Setup file extension for compression and open XferLOG output file
#
-$Conf{CompressLevel} = 0 if ( !BackupPC::FileZIO->compOk );
+if ( $Conf{CompressLevel} && !BackupPC::FileZIO->compOk ) {
+ print(LOG $bpc->timeStamp, "dump failed: can't find Compress::Zlib\n");
+ print("dump failed: can't find Compress::Zlib\n");
+ exit(1);
+}
my $fileExt = $Conf{CompressLevel} > 0 ? ".z" : "";
my $XferLOG = BackupPC::FileZIO->open("$Dir/XferLOG$fileExt", 1,
$Conf{CompressLevel});
@@ -1117,6 +1121,7 @@ sub BackupExpire
$fullKeepCnt = [$fullKeepCnt] if ( ref($fullKeepCnt) ne "ARRAY" );
my $fullAgeMax;
my $fullPeriod = int(0.5 + $Conf{FullPeriod});
+ $fullPeriod = 7 if ( $fullPeriod <= 0 );
for ( my $i = 0 ; $i < @$fullKeepCnt ; $i++ ) {
$fullAgeMax += $fullKeepCnt->[$i] * $fullPeriod;
$fullPeriod *= 2;
@@ -1203,8 +1208,8 @@ sub BackupFullExpire
#
# Delete the full backup
#
- #printf("Deleting backup $i ($prevFull)\n");
- push(@delete, $i);
+ #print("Deleting backup $i ($prevFull)\n");
+ unshift(@delete, $i);
} else {
$fullCnt++;
while ( $fullKeepIdx < @$fullKeepCnt
@@ -1345,6 +1350,11 @@ sub BackupRemove
my($client, $Backups, $idx) = @_;
my($Dir) = "$TopDir/pc/$client";
+ if ( $Backups->[$idx]{num} eq "" ) {
+ print("BackupRemove: ignoring empty backup number for idx $idx\n");
+ return;
+ }
+
$bpc->RmTreeDefer("$TopDir/trash",
"$Dir/$Backups->[$idx]{num}");
unlink("$Dir/SmbLOG.$Backups->[$idx]{num}")
diff --git a/bin/BackupPC_restore b/bin/BackupPC_restore
index 5389e7d..2015df8 100755
--- a/bin/BackupPC_restore
+++ b/bin/BackupPC_restore
@@ -186,7 +186,10 @@ if ( (my $errMsg = CorrectHostCheck($hostIP, $host)) ) {
#
# Setup file extension for compression and open RestoreLOG output file
#
-$Conf{CompressLevel} = 0 if ( !BackupPC::FileZIO->compOk );
+if ( $Conf{CompressLevel} && !BackupPC::FileZIO->compOk ) {
+ $stat{hostError} = "Compress:Zlib not found";
+ exit(RestoreCleanup($client));
+}
my $fileExt = $Conf{CompressLevel} > 0 ? ".z" : "";
my $RestoreLOG = BackupPC::FileZIO->open("$Dir/RestoreLOG$fileExt", 1,
$Conf{CompressLevel});
diff --git a/bin/BackupPC_sendEmail b/bin/BackupPC_sendEmail
index cb5c533..3a1200d 100755
--- a/bin/BackupPC_sendEmail
+++ b/bin/BackupPC_sendEmail
@@ -140,10 +140,12 @@ EOF
}
if ( $mesg ne "" && $Conf{EMailAdminUserName} ne "" ) {
+ my $headers = $Conf{EMailHeaders};
+ $headers .= "\n" if ( $headers !~ /\n$/ );
$mesg = <{user} = $user;
- $vars->{host} = $host;
- $vars->{domain} = $Conf{EMailUserDestDomain};
- $vars->{CgiURL} = $Conf{CgiURL};
+ $vars->{user} = $user;
+ $vars->{host} = $host;
+ $vars->{headers} = $Conf{EMailHeaders};
+ $vars->{headers} .= "\n" if ( $vars->{headers} !~ /\n$/ );
+ $vars->{domain} = $Conf{EMailUserDestDomain};
+ $vars->{CgiURL} = $Conf{CgiURL};
$subj =~ s/\$(\w+)/defined($vars->{$1}) ? $vars->{$1} : "\$$1"/eg;
$vars->{subj} = $subj;
$mesg =~ s/\$(\w+)/defined($vars->{$1}) ? $vars->{$1} : "\$$1"/eg;
diff --git a/bin/BackupPC_tarCreate b/bin/BackupPC_tarCreate
index 071de33..ce67747 100755
--- a/bin/BackupPC_tarCreate
+++ b/bin/BackupPC_tarCreate
@@ -227,7 +227,7 @@ sub archiveWrite
#
sub archiveWriteHardLinks
{
- my $fh = @_;
+ my($fh) = @_;
foreach my $hdr ( @HardLinks ) {
$hdr->{size} = 0;
my $name = $hdr->{linkname};
@@ -483,6 +483,7 @@ sub TarWriteFile
$done = 1;
} else {
foreach my $arg ( @ARGV ) {
+ $arg = "/" if ( $arg eq "." );
$arg =~ s{^\./+}{/};
$arg =~ s{/+$}{};
$done = 1 if ( $name eq $arg || $name =~ /^\Q$arg\// );
@@ -504,7 +505,7 @@ sub TarWriteFile
my $name = $hdr->{linkname};
$name =~ s{^\./}{/};
$HardLinkExtraFiles{$name} = $hdr->{name};
- archiveWrite($fh, $hdr->{linkname}, $hdr->{name});
+ archiveWrite($fh, $name, $hdr->{name});
}
} elsif ( $hdr->{type} == BPC_FTYPE_SYMLINK ) {
#
diff --git a/bin/BackupPC_tarExtract b/bin/BackupPC_tarExtract
index 270776f..32044f6 100755
--- a/bin/BackupPC_tarExtract
+++ b/bin/BackupPC_tarExtract
@@ -58,7 +58,7 @@ if ( $ARGV[0] !~ /^([\w\.\s-]+)$/ ) {
exit(1);
}
my $client = $1;
-if ( $ARGV[1] !~ /^([\w\s\.\/\$-]+)$/ ) {
+if ( $ARGV[1] !~ /^([\w\s.\/$(){}[\]-]+)$/ ) {
print("$0: bad share name '$ARGV[1]'\n");
exit(1);
}
@@ -313,7 +313,7 @@ sub TarReadFile
#
my($nRead);
#print("Reading $f->{name}, $f->{size} bytes, type $f->{type}\n");
- pathCreate($dir, "$OutDir/$ShareName/$f->{mangleName}", $f);
+ pathCreate($dir, "$OutDir/$ShareName/$f->{mangleName}", $file, $f);
my $poolWrite = BackupPC::PoolWrite->new($bpc,
"$OutDir/$ShareName/$f->{mangleName}",
$f->{size}, $Compress);
@@ -351,7 +351,7 @@ sub TarReadFile
# a plain file.
#
$f->{size} = length($f->{linkname});
- pathCreate($dir, "$OutDir/$ShareName/$f->{mangleName}", $f);
+ pathCreate($dir, "$OutDir/$ShareName/$f->{mangleName}", $file, $f);
my $poolWrite = BackupPC::PoolWrite->new($bpc,
"$OutDir/$ShareName/$f->{mangleName}",
$f->{size}, $Compress);
@@ -369,7 +369,7 @@ sub TarReadFile
# contents.
#
$f->{size} = length($f->{linkname});
- pathCreate($dir, "$OutDir/$ShareName/$f->{mangleName}", $f);
+ pathCreate($dir, "$OutDir/$ShareName/$f->{mangleName}", $file, $f);
my $poolWrite = BackupPC::PoolWrite->new($bpc,
"$OutDir/$ShareName/$f->{mangleName}",
$f->{size}, $Compress);
@@ -393,7 +393,7 @@ sub TarReadFile
} else {
$data = "$f->{devmajor},$f->{devminor}";
}
- pathCreate($dir, "$OutDir/$ShareName/$f->{mangleName}", $f);
+ pathCreate($dir, "$OutDir/$ShareName/$f->{mangleName}", $file, $f);
my $poolWrite = BackupPC::PoolWrite->new($bpc,
"$OutDir/$ShareName/$f->{mangleName}",
length($data), $Compress);
@@ -487,15 +487,17 @@ sub logFileAction
#
sub pathCreate
{
- my($dir, $file, $f) = @_;
+ my($dir, $fullPath, $file, $f) = @_;
#
- # Get parent directory of each of $dir and $file
+ # Get parent directory of each of $dir and $fullPath
#
- $dir =~ s{/[^/]*$}{};
- $file =~ s{/[^/]*$}{};
- return if ( -d $file );
- mkpath($file, 0, 0777);
+ $dir =~ s{/[^/]*$}{};
+ $fullPath =~ s{/[^/]*$}{};
+ return if ( -d $fullPath );
+ mkpath($fullPath, 0, 0777);
+ $Attrib{$dir} = BackupPC::Attrib->new({ compress => $Compress })
+ if ( !defined($Attrib{$dir}) );
$Attrib{$dir}->set($file, {
type => BPC_FTYPE_DIR,
mode => 0755,
diff --git a/bin/BackupPC_zipCreate b/bin/BackupPC_zipCreate
index bebea7a..7c859d2 100755
--- a/bin/BackupPC_zipCreate
+++ b/bin/BackupPC_zipCreate
@@ -120,7 +120,7 @@ if ( $i >= @Backups ) {
my $PathRemove = $1 if ( $opts{r} =~ /(.+)/ );
my $PathAdd = $1 if ( $opts{p} =~ /(.+)/ );
-if ( $opts{s} !~ /^([\w\s\.\/\$-]+)$/ ) {
+if ( $opts{s} !~ /^([\w\s.\/$(){}[\]-]+)$/ ) {
print(STDERR "$0: bad share name '$opts{s}'\n");
exit(1);
}
diff --git a/conf/config.pl b/conf/config.pl
index d8b6ac9..1284c5d 100644
--- a/conf/config.pl
+++ b/conf/config.pl
@@ -705,7 +705,7 @@ $Conf{BackupZeroFilesIsFatal} = 1;
# - 'rsync': backup and restore via rsync (via rsh or ssh).
# Best choice for linux/unix. Good choice also for WinXX.
#
-# - 'rsyncd': backup and restre via rsync daemon on the client.
+# - 'rsyncd': backup and restore via rsync daemon on the client.
# Best choice for linux/unix if you have rsyncd running on
# the client. Good choice also for WinXX.
#
@@ -880,7 +880,7 @@ $Conf{TarShareName} = '/';
# This setting only matters if $Conf{XferMethod} = 'tar'.
#
$Conf{TarClientCmd} = '$sshPath -q -x -n -l root $host'
- . ' $tarPath -c -v -f - -C $shareName+'
+ . ' env LC_ALL=C $tarPath -c -v -f - -C $shareName+'
. ' --totals';
#
@@ -937,7 +937,7 @@ $Conf{TarIncrArgs} = '--newer=$incrDate+ $fileList+';
# restore option will be removed.
#
$Conf{TarClientRestoreCmd} = '$sshPath -q -x -l root $host'
- . ' $tarPath -x -p --numeric-owner --same-owner'
+ . ' env LC_ALL=C $tarPath -x -p --numeric-owner --same-owner'
. ' -v -f - -C $shareName+';
#
@@ -1344,7 +1344,7 @@ $Conf{CompressLevel} = 0;
# Despite the name, this parameter sets the timeout for all transport
# methods (tar, smb etc).
#
-$Conf{ClientTimeout} = 7200;
+$Conf{ClientTimeout} = 72000;
#
# Maximum number of log files we keep around in each PC's directory
@@ -1583,6 +1583,14 @@ $Conf{EMailNotifyOldOutlookDays} = 5.0;
$Conf{EMailOutlookBackupSubj} = undef;
$Conf{EMailOutlookBackupMesg} = undef;
+#
+# Additional email headers
+#
+$Conf{EMailHeaders} = < 1,
EMailOutlookBackupSubj => 1,
EMailOutlookBackupMesg => 1,
+ EMailHeaders => 1,
};
diff --git a/configure.pl b/configure.pl
index bb86691..ec63ebb 100755
--- a/configure.pl
+++ b/configure.pl
@@ -467,7 +467,7 @@ foreach my $dir ( qw(bin doc
# Create CGI image directory
#
foreach my $dir ( ($Conf{CgiImageDir}) ) {
- next if ( $dir eq "" || -d $dir );
+ next if ( $dir eq "" || -d "$DestDir$dir" );
mkpath("$DestDir$dir", 0, 0775);
if ( !-d "$DestDir$dir" || !chown($Uid, $Gid, "$DestDir$dir") ) {
die("Failed to create or chown $DestDir$dir");
diff --git a/doc-src/BackupPC.pod b/doc-src/BackupPC.pod
index 0de8a1e..3cca13d 100644
--- a/doc-src/BackupPC.pod
+++ b/doc-src/BackupPC.pod
@@ -299,7 +299,7 @@ appreciated, both positive and negative.
Beyond being a satisfied user and telling other people about it, everyone
is encouraged to add links to L
-(I'll see then via Google) or otherwise publicize BackupPC. Unlike
+(I'll see them via Google) or otherwise publicize BackupPC. Unlike
the commercial products in this space, I have a zero budget (in both
time and money) for marketing, PR and advertising, so it's up to
all of you! Feel free to vote for BackupPC at
@@ -1983,7 +1983,10 @@ is only run when there are no BackupPC_dump or BackupPC_link processes
running. Therefore, when it is time to run BackupPC_nightly, no new
backups are started and BackupPC waits until all backups have finished.
Then BackupPC_nightly is run, and until it finishes no new backups are
-started. If BackupPC_nightly is slow, the settings
+started. If BackupPC_nightly takes too long to run, the settings
+$Conf{MaxBackupPCNightlyJobs} and $Conf{BackupPCNightlyPeriod} can
+be used to run several BackupPC_nightly processes in parallel, and
+to split its job over several nights.
=back
@@ -2728,7 +2731,7 @@ See L.
=head1 Copyright
-Copyright (C) 2001-2004 Craig Barratt
+Copyright (C) 2001-2005 Craig Barratt
=head1 Credits
diff --git a/init.d/src/gentoo-backuppc b/init.d/src/gentoo-backuppc
index 3df501e..98d3cf6 100755
--- a/init.d/src/gentoo-backuppc
+++ b/init.d/src/gentoo-backuppc
@@ -34,6 +34,7 @@ stop() {
restart() {
ebegin "Restarting BackupPC"
svc_stop
+ sleep 1
svc_start
eend $? "Failed to restart BackupPC"
}
diff --git a/lib/BackupPC/CGI/EditConfig.pm b/lib/BackupPC/CGI/EditConfig.pm
index 92f9cce..dc831c2 100644
--- a/lib/BackupPC/CGI/EditConfig.pm
+++ b/lib/BackupPC/CGI/EditConfig.pm
@@ -322,8 +322,7 @@ sub action
my $userHost = 1 if ( $Privileged && !$PrivAdmin && defined($host) );
if ( !$Privileged ) {
- #ErrorExit(eval("qq{$Lang->{Only_privileged_users_can_edit_config_files}}"));
- ErrorExit("Only_privileged_users_can_edit_config_files");
+ ErrorExit(eval("qq{$Lang->{Only_privileged_users_can_edit_config_files}}"));
}
if ( defined($In{menu}) || $In{editAction} eq "Save" ) {
diff --git a/lib/BackupPC/CGI/Lib.pm b/lib/BackupPC/CGI/Lib.pm
index 96a5a78..70a7e49 100644
--- a/lib/BackupPC/CGI/Lib.pm
+++ b/lib/BackupPC/CGI/Lib.pm
@@ -122,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
@@ -465,7 +469,8 @@ EOF
$Lang->{Last_bad_XferLOG_errors_only},
" class=\"navbar\"");
}
- if ( -f "$TopDir/pc/$host/config.pl" ) {
+ if ( -f "$TopDir/pc/$host/config.pl"
+ || ($host ne "config" && -f "$TopDir/conf/$host.pl") ) {
NavLink("?action=editConfig&host=${EscURI($host)}",
"Edit Config", " class=\"navbar\"");
}
diff --git a/lib/BackupPC/CGI/Restore.pm b/lib/BackupPC/CGI/Restore.pm
index d43d70d..0310c63 100644
--- a/lib/BackupPC/CGI/Restore.pm
+++ b/lib/BackupPC/CGI/Restore.pm
@@ -112,35 +112,30 @@ EOF
#
$content .= eval("qq{$Lang->{Restore_Options_for__host2}}");
- #
- # If there is a single host, make sure direct restore is enabled
- #
if ( @hosts == 1 ) {
#
# Pick up the host's config file
#
$bpc->ConfigRead($hosts[0]);
%Conf = $bpc->Conf();
+ }
- #
- # Decide if option 1 (direct restore) is available based
- # on whether the restore command is set.
- #
- my $cmd = $Conf{XferMethod} eq "smb" ? $Conf{SmbClientRestoreCmd}
- : $Conf{XferMethod} eq "tar" ? $Conf{TarClientRestoreCmd}
- : $Conf{XferMethod} eq "archive" ? undef
- : $Conf{RsyncRestoreArgs};
- if ( defined($cmd) ) {
- $content .= eval(
- "qq{$Lang->{Restore_Options_for__host_Option1}}");
- } else {
- my $hostDest = $hosts[0];
- $content .= eval(
- "qq{$Lang->{Restore_Options_for__host_Option1_disabled}}");
- }
- } else {
- $content .= eval("qq{$Lang->{Restore_Options_for__host_Option1}}");
- }
+ #
+ # Decide if option 1 (direct restore) is available based
+ # on whether the restore command is set.
+ #
+ my $cmd = $Conf{XferMethod} eq "smb" ? $Conf{SmbClientRestoreCmd}
+ : $Conf{XferMethod} eq "tar" ? $Conf{TarClientRestoreCmd}
+ : $Conf{XferMethod} eq "archive" ? undef
+ : $Conf{RsyncRestoreArgs};
+ if ( defined($cmd) ) {
+ $content .= eval(
+ "qq{$Lang->{Restore_Options_for__host_Option1}}");
+ } else {
+ my $hostDest = $hosts[0];
+ $content .= eval(
+ "qq{$Lang->{Restore_Options_for__host_Option1_disabled}}");
+ }
#
# Verify that Archive::Zip is available before showing the
diff --git a/lib/BackupPC/Lang/de.pm b/lib/BackupPC/Lang/de.pm
index 5fc0f9b..e112b73 100644
--- a/lib/BackupPC/Lang/de.pm
+++ b/lib/BackupPC/Lang/de.pm
@@ -1217,7 +1217,7 @@ $Lang{EMailNoBackupEverMesg} = <<'EOF';
To: $user$domain
cc:
Subject: $subj
-
+$headers
Hallo $userName,
Ihr Computer ($host) wurde durch den Backup Server noch nie erfolgreich gesichert.
@@ -1247,7 +1247,7 @@ $Lang{EMailNoBackupRecentMesg} = <<'EOF';
To: $user$domain
cc:
Subject: $subj
-
+$headers
Hallo $userName,
Ihr Computer ($host) wurde seit $days Tagen nicht mehr erfolgreich gesichert.
@@ -1279,7 +1279,7 @@ $Lang{EMailOutlookBackupMesg} = <<'EOF';
To: $user$domain
cc:
Subject: $subj
-
+$headers
Hallo $userName,
die Outlook Dateien auf Ihrem Computer wurden $howLong Tage nicht gesichert.
diff --git a/lib/BackupPC/Lang/es.pm b/lib/BackupPC/Lang/es.pm
index ca7973b..2011795 100644
--- a/lib/BackupPC/Lang/es.pm
+++ b/lib/BackupPC/Lang/es.pm
@@ -1218,7 +1218,7 @@ $Lang{EMailNoBackupEverMesg} = <<'EOF';
To: $user$domain
cc:
Subject: $subj
-
+$headers
Estimado $userName,
Su PC ($host) nunca ha completado una copia de seguridad mediante nuestro
@@ -1247,7 +1247,7 @@ $Lang{EMailNoBackupRecentMesg} = <<'EOF';
To: $user$domain
cc:
Subject: $subj
-
+$headers
Estimado $userName,
No se ha podido completar ninguna copia de seguridad de su PC ($host) durante
@@ -1278,7 +1278,7 @@ $Lang{EMailOutlookBackupMesg} = <<'EOF';
To: $user$domain
cc:
Subject: $subj
-
+$headers
Estimado $userName,
Los archivos de Outlook de su PC tienen $howLong.
diff --git a/lib/BackupPC/Lang/fr.pm b/lib/BackupPC/Lang/fr.pm
index e4fb494..080261e 100644
--- a/lib/BackupPC/Lang/fr.pm
+++ b/lib/BackupPC/Lang/fr.pm
@@ -664,7 +664,7 @@ Les fichiers existants sont ceux qui sont d
Les nouveaux fichiers sont ceux qui ont été ajoutés au serveur.
Les fichiers vides et les erreurs de SMB ne sont pas comptabilisés dans les fichiers nouveaux ou réutilisés.
-