* Fixed handling of $Conf{HardLinkMax} in BackupPC/Lib.pm. Reported
authorcbarratt <cbarratt>
Sun, 14 Sep 2003 07:01:26 +0000 (07:01 +0000)
committercbarratt <cbarratt>
Sun, 14 Sep 2003 07:01:26 +0000 (07:01 +0000)
  by Ross Skaliotis.

* Updated BackupPC/Xfer/Smb.pm to handle new messages from
  smbclient 3.0.0rc2.

* Fixed $Conf{BackupZeroFilesIsFatal} so that it only applies to full
  dumps, not incrementals.

* Replaced typo $Conf{PingClientPath} with $Conf{PingPath} in configure.pl.

* Removed -T (taint mode) on binaries installed in configure.pl.

ChangeLog
bin/BackupPC_dump
cgi-bin/BackupPC_Admin
configure.pl
doc-src/BackupPC.pod
lib/BackupPC/Lib.pm
lib/BackupPC/Xfer/Smb.pm
makeDist

index 2f617f5..7c67376 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
 # Version __VERSION__, __RELEASEDATE__
 #------------------------------------------------------------------------
 
+* Fixed handling of $Conf{HardLinkMax} in BackupPC/Lib.pm.  Reported
+  by Ross Skaliotis.
+
+* Updated BackupPC/Xfer/Smb.pm to handle new messages from
+  smbclient 3.0.0rc2.
+
+* Fixed $Conf{BackupZeroFilesIsFatal} so that it only applies to full
+  dumps, not incrementals.
+
+* Replaced typo $Conf{PingClientPath} with $Conf{PingPath} in configure.pl.
+
+* Removed -T (taint mode) on binaries installed in configure.pl.
+
+#------------------------------------------------------------------------
+# Version 2.0.1beta0, July 26th, 2003
+#------------------------------------------------------------------------
+
 * In BackupPC_Admin, default REMOTE_USER to $Conf{BackupPCUser}
   if it is not defined.  This allows the CGI interface to work
   when AdminUsers = '*'.  Reported by Quentin Arce.
index 588123a..6982884 100755 (executable)
@@ -126,20 +126,19 @@ if ( $opts{d} ) {
     #
     $hostIP = $client;
     if ( $bpc->CheckHostAlive($hostIP) < 0 ) {
-       print("Exiting because CheckHostAlive($hostIP) failed\n")
+       print(STDERR "Exiting because CheckHostAlive($hostIP) failed\n")
                            if ( $opts{v} );
        exit(1);
     }
     if ( $Conf{NmbLookupCmd} eq "" ) {
-       print("Exiting because \$Conf{NmbLookupCmd} is empty\n")
+       print(STDERR "Exiting because \$Conf{NmbLookupCmd} is empty\n")
                            if ( $opts{v} );
        exit(1);
     }
     ($client, $user) = $bpc->NetBiosInfoGet($hostIP);
     if ( $client !~ /^([\w\.\s-]+)$/ ) {
-       print("Exiting because NetBiosInfoGet($hostIP) returned '$client',"
-           . " an invalid host name\n")
-                           if ( $opts{v} );
+       print(STDERR "Exiting because NetBiosInfoGet($hostIP) returned"
+           . " '$client', an invalid host name\n") if ( $opts{v} );
        exit(1)
     }
     $Hosts = $bpc->HostInfoRead($client);
@@ -148,8 +147,8 @@ if ( $opts{d} ) {
     $Hosts = $bpc->HostInfoRead($client);
 }
 if ( !defined($Hosts->{$client}) ) {
-    print("Exiting because host $client does not exist in the hosts file\n")
-                           if ( $opts{v} );
+    print(STDERR "Exiting because host $client does not exist in the"
+              . " hosts file\n") if ( $opts{v} );
     exit(1)
 }
 
@@ -215,7 +214,7 @@ if ( !$opts{d} ) {
         # Ok, NS doesn't know about it.  Maybe it is a NetBios name
         # instead.
         #
-       print("Name server doesn't know about $host; trying NetBios\n")
+       print(STDERR "Name server doesn't know about $host; trying NetBios\n")
                        if ( $opts{v} );
         if ( !defined($hostIP = $bpc->NetBiosHostIPFind($host)) ) {
            print(LOG $bpc->timeStamp, "Can't find host $host via netbios\n");
@@ -253,7 +252,7 @@ $bpc->ServerDisconnect();
 if ( $opts{d} ) {
     if ( $StatusHost{activeJob} ) {
         # oops, something is already running for this host
-       print("Exiting because backup is already running for $client\n")
+       print(STDERR "Exiting because backup is already running for $client\n")
                        if ( $opts{v} );
         exit(0);
     }
@@ -680,9 +679,9 @@ for my $shareName ( @$ShareNames ) {
 my $lastNum  = -1;
 
 #
-# If any share had zero files then consider the dump bad
+# If this is a full, and any share had zero files then consider the dump bad
 #
-if ( $stat{hostError} eq ""
+if ( $type eq "full" && $stat{hostError} eq ""
        && length($noFilesErr) && $Conf{BackupZeroFilesIsFatal} ) {
     $stat{hostError} = $noFilesErr;
     $stat{xferOK} = 0;
index 8f5e193..bcfaa63 100755 (executable)
@@ -66,16 +66,6 @@ use vars qw ($Lang);
 $Cgi = new CGI;
 %In = $Cgi->Vars;
 
-#
-# We require that Apache pass in $ENV{SCRIPT_NAME} and $ENV{REMOTE_USER}.
-# The latter requires .ht_access style authentication.  Replace this
-# code if you are using some other type of authentication, and have
-# a different way of getting the user name.
-#
-$ENV{REMOTE_USER} = $Conf{BackupPCUser} if ( !defined($ENV{REMOTE_USER}) );
-$MyURL  = $ENV{SCRIPT_NAME};
-$User   = $ENV{REMOTE_USER};
-
 if ( !defined($bpc) ) {
     ErrorExit($Lang->{BackupPC__Lib__new_failed__check_apache_error_log})
        if ( !($bpc = BackupPC::Lib->new(undef, undef, 1)) );
@@ -91,6 +81,16 @@ if ( !defined($bpc) ) {
     $Lang   = $bpc->Lang();
 }
 
+#
+# We require that Apache pass in $ENV{SCRIPT_NAME} and $ENV{REMOTE_USER}.
+# The latter requires .ht_access style authentication.  Replace this
+# code if you are using some other type of authentication, and have
+# a different way of getting the user name.
+#
+$ENV{REMOTE_USER} = $Conf{BackupPCUser} if ( $ENV{REMOTE_USER} eq "" );
+$MyURL  = $ENV{SCRIPT_NAME};
+$User   = $ENV{REMOTE_USER};
+
 #
 # Clean up %ENV for taint checking
 #
@@ -449,7 +449,7 @@ sub Action_View
                         || /^\s+directory \\/
                         || /^Timezone is/
                         || /^\.\//
-                        || /^  /
+                        || /^   /
                            ) {
                    $skipped++;
                    next;
index 0abc9a7..f95ed52 100755 (executable)
@@ -104,7 +104,7 @@ if ( $ConfigPath ne "" && -r $ConfigPath ) {
     %Conf = $bpc->Conf();
     %OrigConf = %Conf;
     $Conf{TopDir} = $topDir;
-    my $err = $bpc->ServerConnect($Conf{ServerHost}, $Conf{ServerPort}, 1);
+    my $err = $bpc->ServerConnect($Conf{ServerHost}, $Conf{ServerPort}, 1); 
     if ( $err eq "" ) {
         print <<EOF;
 
@@ -360,12 +360,8 @@ exit unless prompt("--> Do you want to continue?", "y") =~ /y/i;
 #
 # Create install directories
 #
-foreach my $dir ( qw(bin doc
-                    lib/BackupPC/CGI
-                    lib/BackupPC/Lang
-                    lib/BackupPC/Xfer
-                    lib/BackupPC/Zip
-                ) ) {
+foreach my $dir ( qw(bin lib/BackupPC/Xfer lib/BackupPC/Zip
+                    lib/BackupPC/Lang doc) ) {
     next if ( -d "$Conf{InstallDir}/$dir" );
     mkpath("$Conf{InstallDir}/$dir", 0, 0775);
     if ( !-d "$Conf{InstallDir}/$dir"
@@ -416,35 +412,12 @@ foreach my $prog ( qw(BackupPC BackupPC_dump BackupPC_link BackupPC_nightly
 unlink("$Conf{InstallDir}/bin/BackupPC_queueAll");
 
 printf("Installing library in $Conf{InstallDir}/lib\n");
-foreach my $lib ( qw(
-       BackupPC/Lib.pm
-       BackupPC/FileZIO.pm
-       BackupPC/Attrib.pm
-        BackupPC/PoolWrite.pm
-       BackupPC/View.pm
-       BackupPC/Xfer/Tar.pm
-        BackupPC/Xfer/Smb.pm
-       BackupPC/Xfer/Rsync.pm
-        BackupPC/Xfer/RsyncFileIO.pm
-       BackupPC/Zip/FileMember.pm
-        BackupPC/Lang/en.pm
-       BackupPC/Lang/fr.pm
-       BackupPC/Lang/es.pm
+foreach my $lib ( qw(BackupPC/Lib.pm BackupPC/FileZIO.pm BackupPC/Attrib.pm
+        BackupPC/PoolWrite.pm BackupPC/View.pm BackupPC/Xfer/Tar.pm
+        BackupPC/Xfer/Smb.pm BackupPC/Xfer/Rsync.pm
+        BackupPC/Xfer/RsyncFileIO.pm BackupPC/Zip/FileMember.pm
+        BackupPC/Lang/en.pm BackupPC/Lang/fr.pm BackupPC/Lang/es.pm
         BackupPC/Lang/de.pm
-       BackupPC/CGI/Browse.pm
-       BackupPC/CGI/DirHistory.pm
-       BackupPC/CGI/EmailSummary.pm
-       BackupPC/CGI/GeneralInfo.pm
-       BackupPC/CGI/HostInfo.pm
-       BackupPC/CGI/Lib.pm
-       BackupPC/CGI/LOGlist.pm
-       BackupPC/CGI/Queue.pm
-       BackupPC/CGI/RestoreFile.pm
-       BackupPC/CGI/RestoreInfo.pm
-       BackupPC/CGI/Restore.pm
-       BackupPC/CGI/StartStopBackup.pm
-       BackupPC/CGI/Summary.pm
-       BackupPC/CGI/View.pm
     ) ) {
     InstallFile("lib/$lib", "$Conf{InstallDir}/lib/$lib", 0444);
 }
@@ -532,7 +505,7 @@ if ( defined($Conf{PingArgs}) ) {
     if ( $^O eq "solaris" || $^O eq "sunos" ) {
        $Conf{PingCmd} = '$pingPath -s $host 56 1';
     } elsif ( ($^O eq "linux" || $^O eq "openbsd" || $^O eq "netbsd")
-           && !system("$Conf{PingClientPath} -c 1 -w 3 localhost") ) {
+           && !system("$Conf{PingPath} -c 1 -w 3 localhost") ) {
        $Conf{PingCmd} = '$pingPath -c 1 -w 3 $host';
     } else {
        $Conf{PingCmd} = '$pingPath -c 1 $host';
@@ -675,18 +648,10 @@ sub InstallFile
            s/__BACKUPPCUSER__/$Conf{BackupPCUser}/g;
            s/__CGIDIR__/$Conf{CgiDir}/g;
            if ( $first && /^#.*bin\/perl/ ) {
-               if ( $Perl56 ) {
-                   #
-                   # perl56 and later is taint ok
-                   #
-                   print OUT "#!$Conf{PerlPath} -T\n";
-               } else {
-                   #
-                   # prior to perl56, File::Find fails taint checks,
-                   # so we run without -T.  It's still safe.
-                   #
-                   print OUT "#!$Conf{PerlPath}\n";
-               }
+               #
+               # Fill in correct path to perl (no taint for >= 2.0.1).
+               #
+               print OUT "#!$Conf{PerlPath}\n";
            } else {
                print OUT;
            }
index e8e8c0a..5d94a40 100644 (file)
@@ -435,6 +435,18 @@ fetch and compile samba, and just grab smbclient and nmblookup, without
 doing the installation. Alternatively, L<http://www.samba.org> has binary
 distributions for most platforms.
 
+Note: samba version 3.0.0rc2 (the latest version as of 9/1/03) still
+has several smbclient bugs.  If you want to use samba 3.0.0, be sure
+to use the latest release.  If that's still rc2, please apply the
+following patches:
+
+    https://bugzilla.samba.org/show_bug.cgi?id=308
+    https://bugzilla.samba.org/show_bug.cgi?id=388
+    https://bugzilla.samba.org/show_bug.cgi?id=389
+
+Hopefully any release after 3.0.0rc2 will have all these patches
+applied.
+
 =item *
 
 If you are using tar to backup linux/unix machines you should have version
index e3748ad..99530e4 100644 (file)
@@ -705,7 +705,8 @@ sub MakeFileLink
         return -2 if ( !defined($rawFile = $bpc->MD52Path($d, $compress)) );
         $rawFile .= "_$i" if ( $i >= 0 );
         if ( -f $rawFile ) {
-            if ( !compare($name, $rawFile) ) {
+            if ( (stat(_))[3] < $bpc->{Conf}{HardLinkMax}
+                    && !compare($name, $rawFile) ) {
                 unlink($name);
                 return -3 if ( !link($rawFile, $name) );
                 return 1;
index 08d9c6a..27fe7ae 100644 (file)
@@ -226,6 +226,11 @@ sub readOutput
     while ( $t->{smbOut} =~ /(.*?)[\n\r]+(.*)/s ) {
         $_ = $1;
         $t->{smbOut} = $2;
+       #
+       # 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.*\(\d+\)} );
         $t->{XferLOG}->write(\"$_\n");
         #
         # refresh our inactivity alarm
@@ -247,27 +252,27 @@ sub readOutput
         } elsif ( /restore tar file (.*) of size (\d+) bytes/ ) {
             $t->{byteCnt} += $2;
             $t->{fileCnt}++;
-        } elsif ( /tar: dumped \d+ files/ ) {
+        } elsif ( /^\s*tar: dumped \d+ files/ ) {
             $t->{xferOK} = 1;
-        } elsif ( /^tar: restored \d+ files/ ) {
+        } elsif ( /^\s*tar: restored \d+ files/ ) {
             $t->{xferOK} = 1;
-        } elsif ( /^read_socket_with_timeout: timeout read. /i ) {
+        } elsif ( /^\s*read_socket_with_timeout: timeout read. /i ) {
             $t->{hostAbort} = 1;
         } elsif ( /^code 0 listing /
-                    || /^code 0 opening /
-                    || /^abandoning restore/i
-                    || /^Error: Looping in FIND_NEXT/i
-                    || /^SUCCESS - 0/i
-                    || /^Call timed out: server did not respond/i
-                   || /^tree connect failed: ERRDOS - ERRnoaccess \(Access denied\.\)/
-                   || /^tree connect failed: NT_STATUS_BAD_NETWORK_NAME/
+                    || /^\s*code 0 opening /
+                    || /^\s*abandoning restore/i
+                    || /^\s*Error: Looping in FIND_NEXT/i
+                    || /^\s*SUCCESS - 0/i
+                    || /^\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/
                  ) {
            if ( $t->{hostError} eq "" ) {
                $t->{XferLOG}->write(\"This backup will fail because: $_\n");
                $t->{hostError} = $_;
            }
-        } elsif ( /^NT_STATUS_ACCESS_DENIED listing (.*)/
-              || /^ERRDOS - ERRnoaccess \(Access denied\.\) listing (.*)/ ) {
+        } elsif ( /^\s*NT_STATUS_ACCESS_DENIED listing (.*)/
+              || /^\s*ERRDOS - ERRnoaccess \(Access denied\.\) listing (.*)/ ) {
            my $badDir = $1;
            $badDir =~ s{\\}{/}g;
            $badDir =~ s{/+}{/}g;
@@ -278,15 +283,16 @@ sub readOutput
                $t->{hostError} ||= $_;
            }
         } elsif ( /smb: \\>/
-                || /^added interface/i
-                || /^tarmode is now/i
-                || /^Total bytes written/i
-                || /^Domain=/i
+                || /^\s*added interface/i
+                || /^\s*tarmode is now/i
+                || /^\s*Total bytes written/i
+                || /^\s*Domain=/i
                 || /^\([\d\.]* kb\/s\) \(average [\d\.]* kb\/s\)$/i
-                || /^Getting files newer than/i
-                || /^\s+directory \\/i
-                || /^Output is \/dev\/null/i
-                || /^Timezone is/i ) {
+                || /^\s*Getting files newer than/i
+                || /^\s*directory \\/i
+                || /^\s*restore directory \\/i
+                || /^\s*Output is \/dev\/null/i
+                || /^\s*Timezone is/i ) {
             # ignore these messages
         } else {
             $t->{xferErrCnt}++;
index eff0fc4..88fc9d9 100755 (executable)
--- a/makeDist
+++ b/makeDist
@@ -41,8 +41,8 @@ use File::Copy;
 
 umask(0022);
 
-my $Version     = "2.0.1beta0";
-my $ReleaseDate = "26 Jul 2003";
+my $Version     = "2.0.1beta1";
+my $ReleaseDate = "13 Sep 2003";
 my $DistDir     = "dist/BackupPC-$Version";
 
 my @PerlSrc = qw(