X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=lib%2FBackupPC%2FXfer%2FSmb.pm;h=acfe195f7748759c2c3dabf7966a3f0d287a7da3;hp=9a8919c4aa002f5b7a02b525548d8010dd5b2b7c;hb=fda25dc88a63ccac1c80efa2e4994bf0725ca9b7;hpb=79e0593c501fd58046feeca20c315cc4ac283435 diff --git a/lib/BackupPC/Xfer/Smb.pm b/lib/BackupPC/Xfer/Smb.pm index 9a8919c..acfe195 100644 --- a/lib/BackupPC/Xfer/Smb.pm +++ b/lib/BackupPC/Xfer/Smb.pm @@ -11,7 +11,7 @@ # Craig Barratt # # COPYRIGHT -# Copyright (C) 2001-2003 Craig Barratt +# Copyright (C) 2001-2007 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 @@ -29,7 +29,7 @@ # #======================================================================== # -# Version 2.1.0beta2, released 23 May 2004. +# Version 3.1.0, released 25 Nov 2007. # # See http://backuppc.sourceforge.net. # @@ -38,6 +38,7 @@ package BackupPC::Xfer::Smb; use strict; +use Encode qw/from_to encode/; sub new { @@ -111,12 +112,16 @@ sub start $t->{fileIncludeHash} = {}; if ( defined($conf->{BackupFilesOnly}{$t->{shareName}}) ) { foreach my $file ( @{$conf->{BackupFilesOnly}{$t->{shareName}}} ) { + $file = encode($conf->{ClientCharset}, $file) + if ( $conf->{ClientCharset} ne "" ); push(@fileList, $file); $t->{fileIncludeHash}{$file} = 1; } } elsif ( defined($conf->{BackupFilesExclude}{$t->{shareName}}) ) { foreach my $file ( @{$conf->{BackupFilesExclude}{$t->{shareName}}} ) { + $file = encode($conf->{ClientCharset}, $file) + if ( $conf->{ClientCharset} ne "" ); push(@fileList, $file); } # @@ -130,11 +135,13 @@ sub start } else { $timeStampFile = "$t->{outDir}/timeStamp.level0"; open(LEV0, ">", $timeStampFile) && close(LEV0); - utime($t->{lastFull} - 3600, $t->{lastFull} - 3600, $timeStampFile); + utime($t->{incrBaseTime} - 3600, $t->{incrBaseTime} - 3600, + $timeStampFile); $smbClientCmd = $conf->{SmbClientIncrCmd}; $logMsg = "incr backup started back to " - . $bpc->timeStamp($t->{lastFull} - 3600, 0) - . "for share $t->{shareName}"; + . $bpc->timeStamp($t->{incrBaseTime} - 3600, 0) + . " (backup #$t->{incrBaseBkupNum}) for share" + . " $t->{shareName}"; } } my $args = { @@ -149,6 +156,8 @@ sub start X_option => $X_option, timeStampFile => $timeStampFile, }; + from_to($args->{shareName}, "utf8", $conf->{ClientCharset}) + if ( $conf->{ClientCharset} ne "" ); $smbClientCmd = $bpc->cmdVarSubstitute($smbClientCmd, $args); if ( !defined($t->{xferPid} = open(SMB, "-|")) ) { @@ -191,6 +200,8 @@ sub start return; } my $str = "Running: " . $bpc->execCmd2ShellCmd(@$smbClientCmd) . "\n"; + from_to($str, $conf->{ClientCharset}, "utf8") + if ( $conf->{ClientCharset} ne "" ); $t->{XferLOG}->write(\$str); alarm($conf->{ClientTimeout}); $t->{_errStr} = undef; @@ -227,6 +238,9 @@ sub readOutput # alarm($conf->{ClientTimeout}) if ( !$t->{abort} ); $t->{lastOutputLine} = $_ if ( !/^$/ ); + + from_to($_, $conf->{ClientCharset}, "utf8") + if ( $conf->{ClientCharset} ne "" ); # # This section is highly dependent on the version of smbclient. # If you upgrade Samba, make sure that these regexp are still valid. @@ -261,6 +275,7 @@ sub readOutput || /^\s*Call timed out: server did not respond/i || /^\s*tree connect failed: ERRDOS - ERRnoaccess \(Access denied\.\)/ || /^\s*tree connect failed: NT_STATUS_BAD_NETWORK_NAME/ + || /^\s*NT_STATUS_INSUFF_SERVER_RESOURCES listing / ) { if ( $t->{hostError} eq "" ) { $t->{XferLOG}->write(\"This backup will fail because: $_\n");