From 3a173f3feb7dad79150eabf07bc8f304e13cdfe7 Mon Sep 17 00:00:00 2001 From: cbarratt Date: Mon, 16 Aug 2004 03:10:41 +0000 Subject: [PATCH] Changes for 2.1.0pl1: MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit * Added fix to lib/BackupPC/Lang/nl.pm from Lieven Bridts. * Added patch from Tony Nelson to remove $Info{pid} before BackupPC writes the status and shuts down. * Changed BackupPC_nightly so that it doesn't call find() if the directory doesn't exist. This avoids errors in certain versions of perl. Reported by Bernd Rilling. * Fixed BackupPC::CGI::Lib to correctly re-load config.pl for mod_perl. Reported by Tony Nelson and Jimmy Liang. * Explicitly untaint $In{host} in BackupPC::CGI::Lib to fix problem reported by Thomas Tempé. * Added newline to "...skipping because of user requested delay..." log message in BackupPC_dump. Reported by Wayne Scott. * Added read file size error checking to BackupPC_tarCreate. Reported by Brandon Evans. * Added check in BackupPC::Xfer::RsyncFileIO to ensure that when compression is toggled on/off, a compressed backup doesn't link to an uncompressed pool file (and an uncompressed backup doesn't link to a compressed pool file). Reported by Brandon Evans. * Updated documentation with new dirvish URL and a typo from Todd Curry. * Fix to BackupPC_sendEmail so that it correctly sends admin emails for hosts that have failed backups. Reported by Simon Kuhn. --- ChangeLog | 36 ++++++++++++++++++++++++++++++++ bin/BackupPC | 1 + bin/BackupPC_dump | 2 +- bin/BackupPC_nightly | 3 ++- bin/BackupPC_sendEmail | 3 ++- bin/BackupPC_tarCreate | 18 ++++++++++++++++ doc-src/BackupPC.pod | 5 ++--- lib/BackupPC/CGI/Lib.pm | 15 +++++++++++-- lib/BackupPC/Lang/nl.pm | 6 +++--- lib/BackupPC/Xfer/RsyncFileIO.pm | 11 ++++++++++ makeDist | 4 ++-- 11 files changed, 91 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index e9ee938..a296a1c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,6 +20,42 @@ #------------------------------------------------------------------------ # Version __VERSION__, __RELEASEDATE__ #------------------------------------------------------------------------ + +* Added fix to lib/BackupPC/Lang/nl.pm from Lieven Bridts. + +* Added patch from Tony Nelson to remove $Info{pid} before BackupPC + writes the status and shuts down. + +* Changed BackupPC_nightly so that it doesn't call find() if the + directory doesn't exist. This avoids errors in certain versions + of perl. Reported by Bernd Rilling. + +* Fixed BackupPC::CGI::Lib to correctly re-load config.pl for mod_perl. + Reported by Tony Nelson and Jimmy Liang. + +* Explicitly untaint $In{host} in BackupPC::CGI::Lib to fix problem + reported by Thomas Tempé. + +* Added newline to "...skipping because of user requested delay..." + log message in BackupPC_dump. Reported by Wayne Scott. + +* Added read file size error checking to BackupPC_tarCreate. + Reported by Brandon Evans. + +* Added check in BackupPC::Xfer::RsyncFileIO to ensure that when + compression is toggled on/off, a compressed backup doesn't link + to an uncompressed pool file (and an uncompressed backup doesn't + link to a compressed pool file). Reported by Brandon Evans. + +* Updated documentation with new dirvish URL and a typo from + Todd Curry. + +* Fix to BackupPC_sendEmail so that it correctly sends admin emails + for hosts that have failed backups. Reported by Simon Kuhn. + +#------------------------------------------------------------------------ +# Version 2.1.0, 20 Jun 2004 +#------------------------------------------------------------------------ * Added Dutch translation from Lieven Bridts, with tweaks from Guus Houtzager. diff --git a/bin/BackupPC b/bin/BackupPC index 50d5500..5304e61 100755 --- a/bin/BackupPC +++ b/bin/BackupPC @@ -1806,6 +1806,7 @@ sub ServerShutdown } %Jobs = (); } + delete($Info{pid}); StatusWrite(); unlink("$TopDir/log/BackupPC.pid"); exit(1); diff --git a/bin/BackupPC_dump b/bin/BackupPC_dump index 62173e7..c37e239 100755 --- a/bin/BackupPC_dump +++ b/bin/BackupPC_dump @@ -348,7 +348,7 @@ if ( !$opts{i} && !$opts{f} && $Conf{BlackoutGoodCnt} >= 0 } if ( !$opts{i} && !$opts{f} && $StatusHost{backoffTime} > time ) { - printf(LOG "%sskipping because of user requested delay (%.1f hours left)", + printf(LOG "%sskipping because of user requested delay (%.1f hours left)\n", $bpc->timeStamp, ($StatusHost{backoffTime} - time) / 3600); NothingToDo($needLink); } diff --git a/bin/BackupPC_nightly b/bin/BackupPC_nightly index bca759d..54206c2 100755 --- a/bin/BackupPC_nightly +++ b/bin/BackupPC_nightly @@ -148,7 +148,8 @@ for my $pool ( qw(pool cpool) ) { $fileLinkMax = 0; $fileCntRename = 0; %FixList = (); - find({wanted => \&GetPoolStats}, "$TopDir/$pool/$dir"); + find({wanted => \&GetPoolStats}, "$TopDir/$pool/$dir") + if ( -d "$TopDir/$pool/$dir" ); my $kb = $blkCnt / 2; my $kbRm = $blkCntRm / 2; my $kb2 = $blkCnt2 / 2; diff --git a/bin/BackupPC_sendEmail b/bin/BackupPC_sendEmail index ff6ddc7..bd9a440 100755 --- a/bin/BackupPC_sendEmail +++ b/bin/BackupPC_sendEmail @@ -82,7 +82,8 @@ my $mesg = ""; my @badHosts = (); foreach my $host ( sort(keys(%Status)) ) { - next if ( $Status{$host}{reason} ne "backup failed" + next if ( ($Status{$host}{reason} ne "Reason_backup_failed" + && $Status{$host}{reason} ne "Reason_restore_failed") || $Status{$host}{error} =~ /^lost network connection to host/ ); push(@badHosts, "$host ($Status{$host}{error})"); } diff --git a/bin/BackupPC_tarCreate b/bin/BackupPC_tarCreate index a5fa5eb..dce51dc 100755 --- a/bin/BackupPC_tarCreate +++ b/bin/BackupPC_tarCreate @@ -423,10 +423,28 @@ sub TarWriteFile TarWriteFileInfo($fh, $hdr); my($data, $size); while ( $f->read(\$data, $BufSize) > 0 ) { + if ( $size + length($data) > $hdr->{size} ) { + print(STDERR "Error: truncating $hdr->{fullPath} to" + . " $hdr->{size} bytes\n"); + $data = substr($data, 0, $hdr->{size} - $size); + $ErrorCnt++; + } TarWrite($fh, \$data); $size += length($data); } $f->close; + if ( $size != $hdr->{size} ) { + print(STDERR "Error: padding $hdr->{fullPath} to $hdr->{size}" + . " bytes from $size bytes\n"); + $ErrorCnt++; + while ( $size < $hdr->{size} ) { + my $len = $hdr->{size} - $size; + $len = $BufSize if ( $len > $BufSize ); + $data = "\0" x $len; + TarWrite($fh, \$data); + $size += $len; + } + } TarWritePad($fh, $size); $FileCnt++; $ByteCnt += $size; diff --git a/doc-src/BackupPC.pod b/doc-src/BackupPC.pod index a780f9e..3b714e8 100644 --- a/doc-src/BackupPC.pod +++ b/doc-src/BackupPC.pod @@ -269,8 +269,7 @@ BackupPC server data to tape. Various programs and scripts use rsync to provide hardlinked backups. See, for example, Mike Rubel's site (L), -JW Schultz's dirvish (L (although as of -June 2004 this link doesn't work)), +JW Schultz's dirvish (L), Ben Escoto's rdiff-backup (L), and John Bowman's rlbackup (L). @@ -1543,7 +1542,7 @@ status files to keep. Note that for direct restore to work, the $Conf{XferMethod} must be able to write to the client. For example, that means an SMB share for smbclient needs to be writable, and the rsyncd module -needs "read only" set to "yes". This creates additional security +needs "read only" set to "false". This creates additional security risks. If you only create read-only SMB shares (which is a good idea), then the direct restore will fail. You can disable the direct restore option by setting $Conf{SmbClientRestoreCmd}, diff --git a/lib/BackupPC/CGI/Lib.pm b/lib/BackupPC/CGI/Lib.pm index 280ff53..9d89b0d 100644 --- a/lib/BackupPC/CGI/Lib.pm +++ b/lib/BackupPC/CGI/Lib.pm @@ -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(); } # @@ -154,6 +156,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 diff --git a/lib/BackupPC/Lang/nl.pm b/lib/BackupPC/Lang/nl.pm index 2431e53..93f92bb 100644 --- a/lib/BackupPC/Lang/nl.pm +++ b/lib/BackupPC/Lang/nl.pm @@ -2,7 +2,7 @@ #my %lang; #use strict; -#File: nl.pm version 1.3 +#File: nl.pm version 1.5 # -------------------------------- $Lang{Start_Archive} = "Start Archivering"; @@ -79,7 +79,7 @@ $Lang{BackupPC_Server_Status_General_Info}= < -eof +EOF $Lang{BackupPC_Server_Status} = <{rxFile}{size} vs $rxSize)") if ( $fio->{logLevel} >= 5 ); } + # + # If compression was off and now on, or on and now off, then + # don't do an exact match. + # + if ( defined($fio->{rxLocalAttr}) + && !$fio->{rxLocalAttr}{compress} != !$fio->{xfer}{compress} ) { + $fio->{rxMatchBlk} = undef; # compression changed, so no file match + $fio->log("$fio->{rxFile}{name}: compression changed, so no match" + . " ($fio->{rxLocalAttr}{compress} vs $fio->{xfer}{compress})") + if ( $fio->{logLevel} >= 4 ); + } delete($fio->{rxInFd}); delete($fio->{rxOutFd}); delete($fio->{rxDigest}); diff --git a/makeDist b/makeDist index edc3c43..bd17758 100755 --- a/makeDist +++ b/makeDist @@ -42,8 +42,8 @@ use Getopt::Std; umask(0022); -my $Version = "2.1.0"; -my $ReleaseDate = "20 Jun 2004"; +my $Version = "2.1.0pl1"; +my $ReleaseDate = "15 Aug 2004"; my $DistDir = "dist/BackupPC-$Version"; my @PerlSrc = qw( -- 2.20.1