Package: release.debian.org
Severity: normal
Tags: jessie
User: release.debian....@packages.debian.org
Usertags: pu

Hi!

Backuppc is a backup service that can be used to backup SMB shares with
the help of smbclient.

Unfortunately, a security update of Samba, from 2:4.1.17+dfsg-2+deb8u2
to 2:4.2.10+dfsg-0+deb8u2, broke Backuppc backups and restores 
because smbclient was completely rewritten with the 4.2 release.
Backuppc relied on messages output by smbclient 4.1 to confirm that
file transfers were ok.

This patch add new regexps in Backuppc, to provide compatibility with
smbclient 4.2 and more.

Of course, the best would be maybe to patch smbclient, and add some
code that was removed in the 4.2 release, since this update may have
broken other file backup programs.

Best regards,

    Ludovic

-- System Information:
Debian Release: 8.4

-- Debdiff

diff -u backuppc-3.3.0/lib/BackupPC/CGI/View.pm 
backuppc-3.3.0/lib/BackupPC/CGI/View.pm
--- backuppc-3.3.0/lib/BackupPC/CGI/View.pm
+++ backuppc-3.3.0/lib/BackupPC/CGI/View.pm
@@ -136,6 +136,10 @@
                    }
                    $s =~ s/[\n\r]+//g;
                    if ( $s =~ /smb: \\>/
+                           || $s =~ /^tar:\d+\s/
+                           || $s =~ /^  NTLMSSP_/
+                           || $s =~ /^GENSEC backend /
+                           || $s =~ /^doing parameter /
                            || $s =~ /^\s*(\d+) \(\s*\d+\.\d kb\/s\) (.*)$/
                            || $s =~ /^tar: dumped \d+ files/
                            || $s =~ /^\s*added interface/i
diff -u backuppc-3.3.0/debian/changelog backuppc-3.3.0/debian/changelog
--- backuppc-3.3.0/debian/changelog
+++ backuppc-3.3.0/debian/changelog
@@ -1,3 +1,13 @@
+backuppc (3.3.0-2+deb8u1) stable; urgency=medium
+
+  * Regexps fix for smbclient >= 4.2 to avoid failing SMB backups
+    and set $Conf{BackupZeroFilesIsFatal} = 0 in the default config.pl.
+    Workaround for SMB restores: '-d' 5 is now the default for smbclient.
+    Added some cleanup regexps for SMB backup logs.
+    Closes: #820963
+
+ -- Ludovic Drolez <ldro...@debian.org>  Mon, 23 May 2016 6:05:17 +0200
+
 backuppc (3.3.0-2) unstable; urgency=low
 
   * Depends on apache2-utils
diff -u backuppc-3.3.0/debian/config.pl.diff 
backuppc-3.3.0/debian/config.pl.diff
--- backuppc-3.3.0/debian/config.pl.diff
+++ backuppc-3.3.0/debian/config.pl.diff
@@ -1,5 +1,5 @@
---- config.pl  2005-03-03 23:39:20.000000000 +0100
-+++ debian/backuppc/etc/backuppc/config.pl     2005-03-03 18:55:02.000000000 
+0100
+--- config.pl  2016-05-25 19:39:59.558740903 +0200
++++ debian/backuppc/etc/backuppc/config.pl     2016-01-06 11:49:00.000000000 
+0100
 @@ -41,7 +41,10 @@
  #
  # Host name on which the BackupPC server is running.
@@ -12,7 +12,7 @@
  
  #
  # TCP port number on which the BackupPC server listens for and accepts
-@@ -218,7 +218,7 @@
+@@ -224,7 +227,7 @@
  # Full path to various commands for archiving
  #
  $Conf{SplitPath} = '/usr/bin/split';
@@ -21,7 +21,25 @@
  $Conf{CatPath}   = '/bin/cat';
  $Conf{GzipPath}  = '/bin/gzip';
  $Conf{Bzip2Path} = '/bin/bzip2';
-@@ -1462,7 +1462,7 @@
+@@ -836,7 +839,7 @@
+ # backed up.  If you have shares that might be empty (and therefore an
+ # empty backup is valid) you should set this flag to 0.
+ #
+-$Conf{BackupZeroFilesIsFatal} = 1;
++$Conf{BackupZeroFilesIsFatal} = 0;
+ 
+ ###########################################################################
+ # How to backup a client
+@@ -1021,7 +1021,7 @@
+ # redirection and pipes; put that in a script if you need it.
+ #
+ $Conf{SmbClientRestoreCmd} = '$smbClientPath \\\\$host\\$shareName'
+-            . ' $I_option -U $userName -E -d 1'
++            . ' $I_option -U $userName -E -d 5'
+             . ' -c tarmode\\ full -Tx -';
+
+ ###########################################################################
+@@ -1572,7 +1575,7 @@
  # Full path for ssh. Security caution: normal users should not
  # allowed to write to this file or directory.
  #
@@ -30,7 +48,7 @@
  
  #
  # Full path for nmblookup. Security caution: normal users should not
-@@ -1919,8 +1919,8 @@
+@@ -2028,13 +2031,13 @@
  #    $Conf{CgiAdminUsers}     = 'craig celia';
  #    --> administrative users are only craig and celia'.
  #
@@ -41,16 +59,13 @@
  
  #
  # URL of the BackupPC_Admin CGI script.  Used for email messages.
-@@ -1925,7 +1925,7 @@
- #
- # URL of the BackupPC_Admin CGI script.  Used for email messages.
  #
 -$Conf{CgiURL} = 'http://XXXXXX/backuppc/index.cgi';
 +$Conf{CgiURL} = 'http://'.$Conf{ServerHost}.'/backuppc/index.cgi';
  
  #   
  # Language to use.  See lib/BackupPC/Lang for the list of supported
-@@ -2063,7 +2066,7 @@
+@@ -2076,7 +2079,7 @@
  # dates (MM/DD), a value of 2 uses full YYYY-MM-DD format, and zero
  # for international dates (DD/MM).
  #
only in patch2:
unchanged:
--- backuppc-3.3.0.orig/lib/BackupPC/CGI/Browse.pm
+++ backuppc-3.3.0/lib/BackupPC/CGI/Browse.pm
@@ -65,7 +65,7 @@
     #
     # default to the newest backup
     #
-    if ( !defined($In{num}) && defined(@Backups) && @Backups > 0 ) {
+    if ( !defined($In{num}) && @Backups && @Backups > 0 ) {
         $i = @Backups - 1;
         $num = $Backups[$i]{num};
     }
only in patch2:
unchanged:
--- backuppc-3.3.0.orig/lib/BackupPC/Xfer/Smb.pm
+++ backuppc-3.3.0/lib/BackupPC/Xfer/Smb.pm
@@ -217,7 +217,7 @@
         # This section is highly dependent on the version of smbclient.
         # If you upgrade Samba, make sure that these regexp are still valid.
         #
-        if ( /^\s*(-?\d+) \(\s*\d+[.,]\d kb\/s\) (.*)$/ ) {
+        if ( /^\s*(-?\d+) \(\s*\d+[.,]\d kb\/s\) (.*)$/ || 
/^tar:(\d+)\s+\+\+\+ (.*)$/ ) {
             my $sambaFileSize = $1;
             my $pcFileName    = $2;
             (my $fileName = $pcFileName) =~ s/\\/\//g;
@@ -230,7 +230,9 @@
             $t->{byteCnt} += $2;
             $t->{fileCnt}++;
             $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 1 );
-        } elsif ( /^\s*tar: dumped \d+ files/ ) {
+        } elsif ( /^\s*tar: dumped \d+ files/
+                    || /Total bytes received: \d+/i 
+                   || /tar_process done, err = 0/ ) {
             $t->{xferOK} = 1;
             $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 0 );
         } elsif ( /^\s*tar: restored \d+ files/ ) {
@@ -270,6 +272,10 @@
         } elsif ( /^\s*directory \\/i ) {
             $t->{XferLOG}->write(\"$_\n") if ( $t->{logLevel} >= 2 );
         } elsif ( /smb: \\>/
+               || /^tar:\d+\s/
+               || /^  NTLMSSP_/
+               || /^GENSEC backend /
+                || /^doing parameter /
                 || /^\s*added interface/i
                 || /^\s*tarmode is now/i
                 || /^\s*Total bytes written/i

Reply via email to