"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/BackupPC/Xfer/Smb.pm" between
BackupPC-4.3.2.tar.gz and BackupPC-4.4.0.tar.gz

About: BackupPC is a high-performance, enterprise-grade system for backing up Linux and WinXX PCs and laptops to a server’s disk (http/cgi user interface).

Smb.pm  (BackupPC-4.3.2):Smb.pm  (BackupPC-4.4.0)
skipping to change at line 31 skipping to change at line 31
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
#======================================================================== #========================================================================
# #
# Version 4.3.2, released 17 Feb 2020. # Version 4.4.0, released 20 Jun 2020.
# #
# See http://backuppc.sourceforge.net. # See http://backuppc.sourceforge.net.
# #
#======================================================================== #========================================================================
package BackupPC::Xfer::Smb; package BackupPC::Xfer::Smb;
use strict; use strict;
use Encode qw/from_to encode/; use Encode qw/from_to encode/;
use base qw(BackupPC::Xfer::Protocol); use base qw(BackupPC::Xfer::Protocol);
use Fcntl qw(F_GETFL F_SETFL O_NONBLOCK); use Fcntl qw(F_GETFL F_SETFL O_NONBLOCK);
use Errno qw(EWOULDBLOCK); use Errno qw(EWOULDBLOCK);
sub useTar sub useTar
{ {
return 1; return 1;
} }
sub start sub start
{ {
my($t) = @_; my($t) = @_;
my $bpc = $t->{bpc}; my $bpc = $t->{bpc};
my $conf = $t->{conf}; my $conf = $t->{conf};
my $I_option = $t->{hostIP} eq $t->{host} ? [] : ['-I', $t->{hostIP}]; my $I_option = $t->{hostIP} eq $t->{host} ? [] : ['-I', $t->{hostIP}];
my(@fileList, $X_option, $smbClientCmd, $logMsg); my(@fileList, $X_option, $smbClientCmd, $logMsg);
my $shareNamePath = $t->shareName2Path($t->{shareName}); my $shareNamePath = $t->shareName2Path($t->{shareName});
my($timeStampFile); my($timeStampFile);
local(*SMB); local(*SMB);
# #
# First propagate the PASSWD setting # First propagate the PASSWD setting
# #
$ENV{PASSWD} = $ENV{BPC_SMB_PASSWD} if ( defined($ENV{BPC_SMB_PASSWD}) ); $ENV{PASSWD} = $ENV{BPC_SMB_PASSWD} if ( defined($ENV{BPC_SMB_PASSWD}) );
$ENV{PASSWD} = $conf->{SmbSharePasswd} $ENV{PASSWD} = $conf->{SmbSharePasswd}
if ( defined($conf->{SmbSharePasswd}) ); if ( defined($conf->{SmbSharePasswd}) );
if ( !defined($ENV{PASSWD}) ) { if ( !defined($ENV{PASSWD}) ) {
$t->{_errStr} = "passwd not set for smbclient"; $t->{_errStr} = "passwd not set for smbclient";
return; return;
} }
if ( !defined($conf->{SmbClientPath}) || !-x $conf->{SmbClientPath} ) { if ( !defined($conf->{SmbClientPath}) || !-x $conf->{SmbClientPath} ) {
$t->{_errStr} = '$Conf{SmbClientPath} is not a valid executable'; $t->{_errStr} = '$Conf{SmbClientPath} is not a valid executable';
return; return;
} }
if ( $t->{type} eq "restore" ) { if ( $t->{type} eq "restore" ) {
$smbClientCmd = $conf->{SmbClientRestoreCmd}; $smbClientCmd = $conf->{SmbClientRestoreCmd};
$logMsg = "restore started for share $t->{shareName}"; $logMsg = "restore started for share $t->{shareName}";
} else { } else {
# #
# Turn $conf->{BackupFilesOnly} and $conf->{BackupFilesExclude} # Turn $conf->{BackupFilesOnly} and $conf->{BackupFilesExclude}
# into a hash of arrays of files, and $conf->{SmbShareName} # into a hash of arrays of files, and $conf->{SmbShareName}
# to an array # to an array
# #
$bpc->backupFileConfFix($conf, "SmbShareName"); $bpc->backupFileConfFix($conf, "SmbShareName");
$t->{fileIncludeHash} = {}; $t->{fileIncludeHash} = {};
if ( defined($conf->{BackupFilesOnly}{$t->{shareName}}) ) { if ( defined($conf->{BackupFilesOnly}{$t->{shareName}}) ) {
foreach my $file ( @{$conf->{BackupFilesOnly}{$t->{shareName}}} ) { foreach my $file ( @{$conf->{BackupFilesOnly}{$t->{shareName}}} ) {
$file = encode($conf->{ClientCharset}, $file) $file = encode($conf->{ClientCharset}, $file)
if ( $conf->{ClientCharset} ne "" ); if ( $conf->{ClientCharset} ne "" );
push(@fileList, $file); push(@fileList, $file);
$t->{fileIncludeHash}{$file} = 1; $t->{fileIncludeHash}{$file} = 1;
} }
} elsif ( defined($conf->{BackupFilesExclude}{$t->{shareName}}) ) { } elsif ( defined($conf->{BackupFilesExclude}{$t->{shareName}}) ) {
foreach my $file ( @{$conf->{BackupFilesExclude}{$t->{shareName}}} ) foreach my $file ( @{$conf->{BackupFilesExclude}{$t->{shareName}}} )
{ {
$file = encode($conf->{ClientCharset}, $file) $file = encode($conf->{ClientCharset}, $file)
if ( $conf->{ClientCharset} ne "" ); if ( $conf->{ClientCharset} ne "" );
push(@fileList, $file); push(@fileList, $file);
} }
# #
# Allow simple wildcards in exclude list by specifying "r" option. # Allow simple wildcards in exclude list by specifying "r" option.
# #
$X_option = "rX"; $X_option = "rX";
} }
if ( $t->{type} eq "full" ) { if ( $t->{type} eq "full" ) {
$smbClientCmd = $conf->{SmbClientFullCmd}; $smbClientCmd = $conf->{SmbClientFullCmd};
$logMsg = "full backup started for share $t->{shareName}"; $logMsg = "full backup started for share $t->{shareName}";
} else { } else {
$timeStampFile = "$t->{outDir}/timeStamp.level0"; $timeStampFile = "$t->{outDir}/timeStamp.level0";
open(LEV0, ">", $timeStampFile) && close(LEV0); open(LEV0, ">", $timeStampFile) && close(LEV0);
utime($t->{incrBaseTime} - 3600, $t->{incrBaseTime} - 3600, utime($t->{incrBaseTime} - 3600, $t->{incrBaseTime} - 3600, $timeSta
$timeStampFile); mpFile);
$smbClientCmd = $conf->{SmbClientIncrCmd}; $smbClientCmd = $conf->{SmbClientIncrCmd};
$logMsg = "incr backup started back to " $logMsg =
. $bpc->timeStamp($t->{incrBaseTime} - 3600, 0) "incr backup started back to "
. " (backup #$t->{incrBaseBkupNum}) for share" . $bpc->timeStamp($t->{incrBaseTime} - 3600, 0)
. " $t->{shareName}"; . " (backup #$t->{incrBaseBkupNum}) for share"
. " $t->{shareName}";
} }
} }
$logMsg .= " (client path $shareNamePath)" if ( $t->{shareName} ne $shareNam ePath ); $logMsg .= " (client path $shareNamePath)" if ( $t->{shareName} ne $shareNam ePath );
my $args = { my $args = {
smbClientPath => $conf->{SmbClientPath}, smbClientPath => $conf->{SmbClientPath},
host => $t->{host}, host => $t->{host},
hostIP => $t->{hostIP}, hostIP => $t->{hostIP},
client => $t->{client}, client => $t->{client},
shareNameOrig => $t->{shareName}, shareNameOrig => $t->{shareName},
shareName => $shareNamePath, shareName => $shareNamePath,
userName => $conf->{SmbShareUserName}, userName => $conf->{SmbShareUserName},
fileList => \@fileList, fileList => \@fileList,
I_option => $I_option, I_option => $I_option,
X_option => $X_option, X_option => $X_option,
timeStampFile => $timeStampFile, timeStampFile => $timeStampFile,
}; };
from_to($args->{shareName}, "utf8", $conf->{ClientCharset}) from_to($args->{shareName}, "utf8", $conf->{ClientCharset})
if ( $conf->{ClientCharset} ne "" ); if ( $conf->{ClientCharset} ne "" );
$smbClientCmd = $bpc->cmdVarSubstitute($smbClientCmd, $args); $smbClientCmd = $bpc->cmdVarSubstitute($smbClientCmd, $args);
if ( !defined($t->{xferPid} = open(SMB, "-|")) ) { if ( !defined($t->{xferPid} = open(SMB, "-|")) ) {
$t->{_errStr} = "Can't fork to run smbclient"; $t->{_errStr} = "Can't fork to run smbclient";
return; return;
} }
$t->{pipeSMB} = *SMB; $t->{pipeSMB} = *SMB;
if ( !$t->{xferPid} ) { if ( !$t->{xferPid} ) {
# #
# This is the smbclient child. # This is the smbclient child.
# #
setpgrp 0,0; setpgrp 0, 0;
if ( $t->{type} eq "restore" ) { if ( $t->{type} eq "restore" ) {
# #
# For restores close the write end of the pipe, # For restores close the write end of the pipe,
# clone STDIN from RH, and STDERR to STDOUT # clone STDIN from RH, and STDERR to STDOUT
# #
close($t->{pipeWH}); close($t->{pipeWH});
close(STDERR); close(STDERR);
open(STDERR, ">&STDOUT"); open(STDERR, ">&STDOUT");
close(STDIN); close(STDIN);
open(STDIN, "<&$t->{pipeRH}"); open(STDIN, "<&$t->{pipeRH}");
skipping to change at line 172 skipping to change at line 172
# clone STDOUT to WH, STDERR to STDOUT # clone STDOUT to WH, STDERR to STDOUT
# #
close($t->{pipeRH}); close($t->{pipeRH});
close(STDERR); close(STDERR);
open(STDERR, ">&STDOUT"); open(STDERR, ">&STDOUT");
open(STDOUT, ">&$t->{pipeWH}"); open(STDOUT, ">&$t->{pipeWH}");
} }
# #
# Run smbclient. # Run smbclient.
# #
alarm(0); alarm(0);
$bpc->cmdExecOrEval($smbClientCmd, $args); $bpc->cmdExecOrEval($smbClientCmd, $args);
# should not be reached, but just in case... # should not be reached, but just in case...
$t->{_errStr} = "Can't exec $conf->{SmbClientPath}"; $t->{_errStr} = "Can't exec $conf->{SmbClientPath}";
return; return;
} }
my $str = $bpc->execCmd2ShellCmd(@$smbClientCmd); my $str = $bpc->execCmd2ShellCmd(@$smbClientCmd);
from_to($str, $conf->{ClientCharset}, "utf8") from_to($str, $conf->{ClientCharset}, "utf8")
if ( $conf->{ClientCharset} ne "" ); if ( $conf->{ClientCharset} ne "" );
$t->{XferLOG}->write(\"Running: $str\n"); $t->{XferLOG}->write(\"Running: $str\n");
alarm($conf->{ClientTimeout}); alarm($conf->{ClientTimeout});
$t->{_errStr} = undef; $t->{_errStr} = undef;
# #
# make pipeSMB non-blocking; BackupPC_dump uses select() to see if there # make pipeSMB non-blocking; BackupPC_dump uses select() to see if there
# is something to read. # is something to read.
# #
if ( !fcntl($t->{pipeSMB}, F_SETFL, fcntl($t->{pipeSMB}, F_GETFL, 0) | O_NON BLOCK) ) { if ( !fcntl($t->{pipeSMB}, F_SETFL, fcntl($t->{pipeSMB}, F_GETFL, 0) | O_NON BLOCK) ) {
$t->{_errStr} = "can't set pipeSMB to non-blocking"; $t->{_errStr} = "can't set pipeSMB to non-blocking";
} }
skipping to change at line 208 skipping to change at line 209
if ( vec($rout, fileno($t->{pipeSMB}), 1) ) { if ( vec($rout, fileno($t->{pipeSMB}), 1) ) {
my $mesg; my $mesg;
$! = 0; $! = 0;
if ( sysread($t->{pipeSMB}, $mesg, 8192) <= 0 ) { if ( sysread($t->{pipeSMB}, $mesg, 8192) <= 0 ) {
if ( $! == EWOULDBLOCK ) { if ( $! == EWOULDBLOCK ) {
$t->{XferLOG}->write(\"readOutput: no bytes read (EWOULDBLOCK); continuing\n"); $t->{XferLOG}->write(\"readOutput: no bytes read (EWOULDBLOCK); continuing\n");
} elsif ( eof($t->{pipeSMB}) ) { } elsif ( eof($t->{pipeSMB}) ) {
vec($$FDreadRef, fileno($t->{pipeSMB}), 1) = 0; vec($$FDreadRef, fileno($t->{pipeSMB}), 1) = 0;
my $ok = close($t->{pipeSMB}); my $ok = close($t->{pipeSMB});
$t->{XferLOG}->write(\"readOutput: sysread returns 0 and got EOF (exit ok = $ok, $!)\n"); $t->{XferLOG}->write(\"readOutput: sysread returns 0 and got EOF (exit ok = $ok, $!)\n");
$t->{xferOK} = $ok ? 1 : 0; $t->{xferOK} = $ok ? 1 : 0;
$t->{smbOut} .= "Non-zero exit status from smbclient\n" if ( !$o k ); $t->{smbOut} .= "Non-zero exit status from smbclient\n" if ( !$o k );
} }
} else { } else {
$t->{smbOut} .= $mesg; $t->{smbOut} .= $mesg;
} }
} }
while ( $t->{smbOut} =~ /(.*?)[\n\r]+(.*)/s ) { while ( $t->{smbOut} =~ /(.*?)[\n\r]+(.*)/s ) {
$_ = $1; $_ = $1;
$t->{smbOut} = $2; $t->{smbOut} = $2;
# #
# ignore the log file time stamps from smbclient introduced # ignore the log file time stamps from smbclient introduced
# in version 3.0.0 - don't even write them to the log file. # in version 3.0.0 - don't even write them to the log file.
# #
if ( m{^\[\d+/\d+/\d+ +\d+:\d+:\d+.*\] +(client/cli|lib/util_unistr).*\(\ if ( m{^\[\d+/\d+/\d+ +\d+:\d+:\d+.*\] +(client/cli|lib/util_unistr).*\(
d+\)} ) { \d+\)} ) {
$t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 5 ); $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 5 );
next; next;
} }
# #
# refresh our inactivity alarm # refresh our inactivity alarm
# #
alarm($conf->{ClientTimeout}) if ( !$t->{abort} ); alarm($conf->{ClientTimeout}) if ( !$t->{abort} );
$t->{lastOutputLine} = $_ if ( !/^$/ ); $t->{lastOutputLine} = $_ if ( !/^$/ );
from_to($_, $conf->{ClientCharset}, "utf8") from_to($_, $conf->{ClientCharset}, "utf8")
if ( $conf->{ClientCharset} ne "" ); if ( $conf->{ClientCharset} ne "" );
# #
# This section is highly dependent on the version of smbclient. # This section is highly dependent on the version of smbclient.
# If you upgrade Samba, make sure that these regexp are still valid. # If you upgrade Samba, make sure that these regexp are still valid.
# #
# MAKSYM 14082016: The next regex will never match on Samba-4.3, as # MAKSYM 14082016: The next regex will never match on Samba-4.3, as
# smbclient doesn't produce output required; keeping it for older Sambas # smbclient doesn't produce output required; keeping it for older Sambas
if ( /^\s*(-?\d+) \(\s*\d+[.,]\d kb\/s\) (.*)$/ ) { if ( /^\s*(-?\d+) \(\s*\d+[.,]\d kb\/s\) (.*)$/ ) {
my $sambaFileSize = $1; my $sambaFileSize = $1;
my $pcFileName = $2; my $pcFileName = $2;
(my $fileName = $pcFileName) =~ s/\\/\//g; (my $fileName = $pcFileName) =~ s/\\/\//g;
$sambaFileSize += 1024 * 1024 * 4096 if ( $sambaFileSize < 0 ); $sambaFileSize += 1024 * 1024 * 4096 if ( $sambaFileSize < 0 );
$fileName =~ s/^\/*//; $fileName =~ s/^\/*//;
$t->{byteCnt} += $sambaFileSize; $t->{byteCnt} += $sambaFileSize;
$t->{fileCnt}++; $t->{fileCnt}++;
$t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 2 ); $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 2 );
} elsif ( /restore tar file (.*) of size (\d+) bytes/ ) { } elsif ( /restore tar file (.*) of size (\d+) bytes/ ) {
$t->{byteCnt} += $2; $t->{byteCnt} += $2;
$t->{fileCnt}++; $t->{fileCnt}++;
$t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 1 ); $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 1 );
} elsif ( /^\s*tar: dumped (\d+) files/) { } elsif ( /^\s*tar: dumped (\d+) files/ ) {
# MAKSYM 14082016: Updating file count to the likely number # MAKSYM 14082016: Updating file count to the likely number
$t->{xferOK} = 1; $t->{xferOK} = 1;
$t->{fileCnt} = $1; $t->{fileCnt} = $1;
$t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 0 ); $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 0 );
} elsif ( /^\s*tar:\d+\s*Total bytes received: (\d+)/) { } elsif ( /^\s*tar:\d+\s*Total bytes received: (\d+)/ ) {
# MAKSYM 14082016: Updating byte count to the likely number # MAKSYM 14082016: Updating byte count to the likely number
$t->{xferOK} = 1; $t->{xferOK} = 1;
$t->{byteCnt} = $1; $t->{byteCnt} = $1;
$t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 0 ); $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 0 );
} elsif ( /^\s*tar: restored \d+ files/ } elsif ( /^\s*tar: restored \d+ files/ || /^\s*tar:\d+\s*tar_process do
|| /^\s*tar:\d+\s*tar_process done, err = 0/ ) { ne, err = 0/ ) {
$t->{xferOK} = 1; $t->{xferOK} = 1;
$t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 0 ); $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 0 );
} elsif ( /^\s*read_socket_with_timeout: timeout read. /i ) { } elsif ( /^\s*read_socket_with_timeout: timeout read. /i ) {
$t->{hostAbort} = 1; $t->{hostAbort} = 1;
$t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 0 ); $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 0 );
} elsif ( /^code 0 listing / } elsif ( /^code 0 listing /
|| /^\s*code 0 opening / || /^\s*code 0 opening /
|| /^\s*abandoning restore/i || /^\s*abandoning restore/i
|| /^\s*Error: Looping in FIND_NEXT/i || /^\s*Error: Looping in FIND_NEXT/i
|| /^\s*SUCCESS - 0/i || /^\s*SUCCESS - 0/i
|| /^\s*Call timed out: server did not respond/i || /^\s*Call timed out: server did not respond/i
|| /^\s*tree connect failed: ERRDOS - ERRnoaccess \(Access de || /^\s*tree connect failed: ERRDOS - ERRnoaccess \(Access denied\.\
nied\.\)/ )/
|| /^\s*tree connect failed: NT_STATUS_BAD_NETWORK_NAME/ || /^\s*tree connect failed: NT_STATUS_BAD_NETWORK_NAME/
|| /^\s*NT_STATUS_INSUFF_SERVER_RESOURCES listing / || /^\s*session setup failed: NT_STATUS_LOGON_FAILURE/
) { || /^\s*NT_STATUS_INSUFF_SERVER_RESOURCES listing / ) {
if ( $t->{hostError} eq "" ) { if ( $t->{hostError} eq "" ) {
$t->{XferLOG}->write(\"This backup will fail because: $_\n"); $t->{XferLOG}->write(\"This backup will fail because: $_\n");
$t->{hostError} = $_; $t->{hostError} = $_;
} }
$t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 0 ); $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 0 );
} elsif ( /^\s*NT_STATUS_ACCESS_DENIED listing (.*)/ } elsif ( /^\s*NT_STATUS_ACCESS_DENIED listing (.*)/
|| /^\s*ERRDOS - ERRnoaccess \(Access denied\.\) listing (.*)/ ) { || /^\s*ERRDOS - ERRnoaccess \(Access denied\.\) listing (.*)/ ) {
$t->{xferErrCnt}++; $t->{xferErrCnt}++;
my $badDir = $1; my $badDir = $1;
$badDir =~ s{\\}{/}g; $badDir =~ s{\\}{/}g;
$badDir =~ s{/+}{/}g; $badDir =~ s{/+}{/}g;
$badDir =~ s{/\*$}{}; $badDir =~ s{/\*$}{};
if ( $t->{hostError} eq "" if ( $t->{hostError} eq "" && ($badDir eq "" || $t->{fileIncludeHash
&& ($badDir eq "" || $t->{fileIncludeHash}{$badDir}) ) { }{$badDir}) ) {
$t->{XferLOG}->write(\"This backup will fail because: $_\n"); $t->{XferLOG}->write(\"This backup will fail because: $_\n");
$t->{hostError} ||= $_; $t->{hostError} ||= $_;
} }
$t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 0 ); $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 0 );
} elsif ( /^\s*directory \\/i ) { } elsif ( /^\s*directory \\/i ) {
$t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 2 ); $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 2 );
} elsif ( /^tar:\d+ Error opening remote file/i ) { } elsif ( /^tar:\d+ Error opening remote file/i ) {
$t->{xferErrCnt}++; $t->{xferErrCnt}++;
$t->{XferLOG}->write(\"XferErr $_\n") if ( $t->{logLevel} >= 1 ); $t->{XferLOG}->write(\"XferErr $_\n") if ( $t->{logLevel} >= 1 );
} elsif ( /smb: \\>/ } elsif (
|| /^\s*tar:\d+/ # MAKSYM 14082016: ignoring 2 more Samba-4.3 sp /smb: \\>/
ecific lines || /^\s*tar:\d+/ # MAKSYM 14082016: ignoring 2 more Samba-4.3 spe
|| /^\s*WARNING:/i cific lines
|| /^\s*added interface/i || /^\s*WARNING:/i
|| /^\s*tarmode is now/i || /^\s*added interface/i
|| /^\s*Total bytes written/i || /^\s*tarmode is now/i
|| /^\s*Domain=/i || /^\s*Total bytes written/i
|| /^\([\d\.]* kb\/s\) \(average [\d\.]* kb\/s\)$/i || /^\s*Domain=/i
|| /^\s*Getting files newer than/i || /^\([\d\.]* kb\/s\) \(average [\d\.]* kb\/s\)$/i
|| /^\s*restore directory \\/i || /^\s*Getting files newer than/i
|| /^\s*Output is \/dev\/null/i || /^\s*restore directory \\/i
|| /^\s*Timezone is/i || /^\s*Output is \/dev\/null/i
|| /^\s*tar_re_search set/i || /^\s*Timezone is/i
|| /^\s*creating lame (up|low)case table/i || /^\s*tar_re_search set/i
|| /^\s*rlimit_max: increasing rlimit_max/i || /^\s*creating lame (up|low)case table/i
|| /^\s*OS=\[/i || /^\s*rlimit_max: increasing rlimit_max/i
|| /^\s*$/ || /^\s*OS=\[/i
) { || /^\s*$/
) {
# ignore these messages # ignore these messages
$t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 1 ); $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 1 );
} else { } else {
$t->{xferErrCnt}++; $t->{xferErrCnt}++;
$t->{xferBadShareCnt}++ if ( /^ERRDOS - ERRbadshare/ ); $t->{xferBadShareCnt}++ if ( /^ERRDOS - ERRbadshare/ );
$t->{xferBadFileCnt}++ if ( /^ERRDOS - ERRbadfile/ ); $t->{xferBadFileCnt}++ if ( /^ERRDOS - ERRbadfile/ );
if ( $t->{xferErrCnt} > 50000 ) { if ( $t->{xferErrCnt} > 50000 ) {
$t->logMsg( $t->logMsg("Too many smbtar errors ($t->{xferErrCnt})... giving
"Too many smbtar errors ($t->{xferErrCnt})... giving up"); up");
$t->{hostError} = "Too many smbtar errors ($t->{xferErrCnt})"; $t->{hostError} = "Too many smbtar errors ($t->{xferErrCnt})";
return; return;
} }
if ( /^Error reading file (.*)\. Got 0 bytes/ ) { if ( /^Error reading file (.*)\. Got 0 bytes/ ) {
# #
# This happens when a Windoze application has # This happens when a Windoze application has
# locked the file. This is a particular problem # locked the file. This is a particular problem
# with MS-Outlook. smbclient has already written # with MS-Outlook. smbclient has already written
# the tar header to stdout, so all it can do is to # the tar header to stdout, so all it can do is to
# write a dummy file with the correct size, but all # write a dummy file with the correct size, but all
# zeros. BackupPC_tarExtract stores these # zeros. BackupPC_tarExtract stores these
# zero-content files efficiently as a sparse file, # zero-content files efficiently as a sparse file,
# or if compression is on the file will be small # or if compression is on the file will be small
# anyhow. After the dump is done we simply delete # anyhow. After the dump is done we simply delete
# the file (it is no use) and try to link it to same # the file (it is no use) and try to link it to same
# file in any recent backup. # file in any recent backup.
# #
my $badFile = $1; my $badFile = $1;
$badFile =~ s{\\}{/}g; $badFile =~ s{\\}{/}g;
$badFile =~ s{^/}{}; $badFile =~ s{^/}{};
push(@{$t->{badFiles}}, { push(
share => $t->{shareName}, @{$t->{badFiles}},
file => $badFile {
}); share => $t->{shareName},
file => $badFile
}
);
} }
$t->{XferLOG}->write(\"XferErr $_\n") if ( $t->{logLevel} >= 1 ); $t->{XferLOG}->write(\"XferErr $_\n") if ( $t->{logLevel} >= 1 );
} }
} }
return 1; return 1;
} }
sub setSelectMask sub setSelectMask
{ {
my($t, $FDreadRef) = @_; my($t, $FDreadRef) = @_;
 End of changes. 34 change blocks. 
108 lines changed or deleted 117 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)