#
#========================================================================
#
-# Version 2.1.0_CVS, released 8 Feb 2004.
+# Version 3.0.0alpha, released 23 Jan 2006.
#
# See http://backuppc.sourceforge.net.
#
} else {
#
# Turn $conf->{BackupFilesOnly} and $conf->{BackupFilesExclude}
- # into a hash of arrays of files
+ # into a hash of arrays of files, and $conf->{SmbShareName}
+ # to an array
#
- $conf->{SmbShareName} = [ $conf->{SmbShareName} ]
- unless ref($conf->{SmbShareName}) eq "ARRAY";
- foreach my $param qw(BackupFilesOnly BackupFilesExclude) {
- next if ( !defined($conf->{$param}) );
- if ( ref($conf->{$param}) eq "ARRAY" ) {
- $conf->{$param} = {
- $conf->{SmbShareName}[0] => $conf->{$param}
- };
- } elsif ( ref($conf->{$param}) eq "HASH" ) {
- # do nothing
- } else {
- $conf->{$param} = {
- $conf->{SmbShareName}[0] => [ $conf->{$param} ]
- };
- }
- }
+ $bpc->backupFileConfFix($conf, "SmbShareName");
+
$t->{fileIncludeHash} = {};
if ( defined($conf->{BackupFilesOnly}{$t->{shareName}}) ) {
foreach my $file ( @{$conf->{BackupFilesOnly}{$t->{shareName}}} ) {
# ignore the log file time stamps from smbclient introduced
# in version 3.0.0 - don't even write them to the log file.
#
- next if ( m{^\[\d+/\d+/\d+ +\d+:\d+:\d+.*\] +(client/cli|lib/util_unistr).*\(\d+\)} );
- $t->{XferLOG}->write(\"$_\n");
+ if ( m{^\[\d+/\d+/\d+ +\d+:\d+:\d+.*\] +(client/cli|lib/util_unistr).*\(\d+\)} ) {
+ $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 5 );
+ next;
+ }
#
# refresh our inactivity alarm
#
- alarm($conf->{ClientTimeout});
+ alarm($conf->{ClientTimeout}) if ( !$t->{abort} );
$t->{lastOutputLine} = $_ if ( !/^$/ );
#
# This section is highly dependent on the version of smbclient.
$fileName =~ s/^\/*//;
$t->{byteCnt} += $sambaFileSize;
$t->{fileCnt}++;
+ $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 2 );
} elsif ( /restore tar file (.*) of size (\d+) bytes/ ) {
$t->{byteCnt} += $2;
$t->{fileCnt}++;
+ $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 1 );
} elsif ( /^\s*tar: dumped \d+ files/ ) {
$t->{xferOK} = 1;
+ $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 0 );
} elsif ( /^\s*tar: restored \d+ files/ ) {
$t->{xferOK} = 1;
+ $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 0 );
} elsif ( /^\s*read_socket_with_timeout: timeout read. /i ) {
$t->{hostAbort} = 1;
+ $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 0 );
} elsif ( /^code 0 listing /
|| /^\s*code 0 opening /
|| /^\s*abandoning restore/i
$t->{XferLOG}->write(\"This backup will fail because: $_\n");
$t->{hostError} = $_;
}
+ $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 0 );
} elsif ( /^\s*NT_STATUS_ACCESS_DENIED listing (.*)/
|| /^\s*ERRDOS - ERRnoaccess \(Access denied\.\) listing (.*)/ ) {
my $badDir = $1;
$t->{XferLOG}->write(\"This backup will fail because: $_\n");
$t->{hostError} ||= $_;
}
+ $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 0 );
+ } elsif ( /^\s*directory \\/i ) {
+ $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 2 );
} elsif ( /smb: \\>/
|| /^\s*added interface/i
|| /^\s*tarmode is now/i
|| /^\s*Domain=/i
|| /^\([\d\.]* kb\/s\) \(average [\d\.]* kb\/s\)$/i
|| /^\s*Getting files newer than/i
- || /^\s*directory \\/i
|| /^\s*restore directory \\/i
|| /^\s*Output is \/dev\/null/i
|| /^\s*Timezone is/i
+ || /^\s*tar_re_search set/i
|| /^\s*creating lame (up|low)case table/i
) {
# ignore these messages
+ $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 1 );
} else {
$t->{xferErrCnt}++;
$t->{xferBadShareCnt}++ if ( /^ERRDOS - ERRbadshare/ );
file => $badFile
});
}
+ $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 1 );
}
}
return 1;
}
+sub abort
+{
+ my($t, $reason) = @_;
+
+ $t->{abort} = 1;
+ $t->{abortReason} = $reason;
+}
+
sub setSelectMask
{
my($t, $FDreadRef) = @_;