X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=lib%2FBackupPC%2FXfer%2FSmb.pm;h=baaeccbd8036f9c841ebf03563a86a3d5a8eb0de;hp=3a68d144f33610cd41622f8dbd3a04b6825b9050;hb=2441b9094f3f6e4f2a3a4fe67781780e6f6890bd;hpb=b81d2da5e16975674f011e4833337ac0fa24e0ea diff --git a/lib/BackupPC/Xfer/Smb.pm b/lib/BackupPC/Xfer/Smb.pm index 3a68d14..baaeccb 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 3.0.0beta2, released 11 Nov 2006. +# Version 3.1.0, released 25 Nov 2007. # # See http://backuppc.sourceforge.net. # @@ -39,35 +39,7 @@ package BackupPC::Xfer::Smb; use strict; use Encode qw/from_to encode/; - -sub new -{ - my($class, $bpc, $args) = @_; - - $args ||= {}; - my $t = bless { - bpc => $bpc, - conf => { $bpc->Conf }, - host => "", - hostIP => "", - shareName => "", - pipeRH => undef, - pipeWH => undef, - badFiles => [], - %$args, - }, $class; - - return $t; -} - -sub args -{ - my($t, $args) = @_; - - foreach my $arg ( keys(%$args) ) { - $t->{$arg} = $args->{$arg}; - } -} +use base qw(BackupPC::Xfer::Protocol); sub useTar { @@ -284,6 +256,7 @@ sub readOutput $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 0 ); } elsif ( /^\s*NT_STATUS_ACCESS_DENIED listing (.*)/ || /^\s*ERRDOS - ERRnoaccess \(Access denied\.\) listing (.*)/ ) { + $t->{xferErrCnt}++; my $badDir = $1; $badDir =~ s{\\}{/}g; $badDir =~ s{/+}{/}g; @@ -349,14 +322,6 @@ sub readOutput return 1; } -sub abort -{ - my($t, $reason) = @_; - - $t->{abort} = 1; - $t->{abortReason} = $reason; -} - sub setSelectMask { my($t, $FDreadRef) = @_; @@ -364,53 +329,4 @@ sub setSelectMask vec($$FDreadRef, fileno($t->{pipeSMB}), 1) = 1; } -sub errStr -{ - my($t) = @_; - - return $t->{_errStr}; -} - -sub xferPid -{ - my($t) = @_; - - return ($t->{xferPid}); -} - -sub logMsg -{ - my($t, $msg) = @_; - - push(@{$t->{_logMsg}}, $msg); -} - -sub logMsgGet -{ - my($t) = @_; - - return shift(@{$t->{_logMsg}}); -} - -# -# Returns a hash ref giving various status information about -# the transfer. -# -sub getStats -{ - my($t) = @_; - - return { map { $_ => $t->{$_} } - qw(byteCnt fileCnt xferErrCnt xferBadShareCnt xferBadFileCnt - xferOK hostAbort hostError lastOutputLine) - }; -} - -sub getBadFiles -{ - my($t) = @_; - - return @{$t->{badFiles}}; -} - 1;