lintian doesn't like orphan packages with uploaders...
[debian/amanda] / server-src / amidxtaped.pl
index c156a000b52039ad9d38bc3c9788ca91f4583262..79ea978767e1bf74ca760ccc1c764e323dbd39cd 100644 (file)
@@ -1,9 +1,10 @@
 #! @PERL@
-# Copyright (c) 2010 Zmanda, Inc.  All Rights Reserved.
+# Copyright (c) 2010-2012 Zmanda, Inc.  All Rights Reserved.
 #
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 as published
-# by the Free Software Foundation.
+# 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 the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
 #
 # This program is distributed in the hope that it will be useful, but
 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
@@ -118,7 +119,7 @@ use Sys::Hostname;
 
 use Amanda::Debug qw( debug info warning );
 use Amanda::MainLoop qw( :GIOCondition );
-use Amanda::Util qw( :constants );
+use Amanda::Util qw( :constants match_disk match_host );
 use Amanda::Feature;
 use Amanda::Config qw( :init :getconf );
 use Amanda::Changer;
@@ -130,7 +131,6 @@ use Amanda::Recovery::Planner;
 use Amanda::Recovery::Scan;
 use Amanda::DB::Catalog;
 use Amanda::Disklist;
-use Amanda::Logfile qw( match_disk match_host );
 
 # Note that this class performs its control IO synchronously.  This is adequate
 # for this service, as it never receives unsolicited input from the remote
@@ -404,6 +404,7 @@ sub make_plan {
 
        return Amanda::Recovery::Planner::make_plan(
            filelist => $filelist,
+           chg => $chg,
            $spec? (dumpspec => $spec) : (),
            plan_cb => sub { $self->plan_cb(@_); });
     }
@@ -547,7 +548,6 @@ sub xfer_src_cb {
     if ($header->{'compressed'}) {
        # need to uncompress this file
        debug("..with decompression applied");
-       my $dle = $header->get_dle();
 
        if ($header->{'srvcompprog'}) {
            # TODO: this assumes that srvcompprog takes "-d" to decrypt
@@ -570,9 +570,11 @@ sub xfer_src_cb {
                $header->{'clntcompprog'} = '';
            }
        } else {
-           if (!$self->{'their_features'}->has($Amanda::Feature::fe_amrecover_receive_unfiltered) ||
-               $dle->{'compress'} == $Amanda::Config::COMP_SERVER_FAST ||
-               $dle->{'compress'} == $Amanda::Config::COMP_SERVER_BEST) {
+           my $dle = $header->get_dle();
+           if ($dle &&
+               (!$self->{'their_features'}->has($Amanda::Feature::fe_amrecover_receive_unfiltered) ||
+                $dle->{'compress'} == $Amanda::Config::COMP_SERVER_FAST ||
+                $dle->{'compress'} == $Amanda::Config::COMP_SERVER_BEST)) {
                push @filters,
                    Amanda::Xfer::Filter::Process->new(
                        [ $Amanda::Constants::UNCOMPRESS_PATH,
@@ -602,6 +604,10 @@ sub send_header {
     # filter out some things the remote might not be able to process
     if (!$self->{'their_features'}->has($Amanda::Feature::fe_amrecover_dle_in_header)) {
        $header->{'dle_str'} = undef;
+    } else {
+       $header->{'dle_str'} =
+           Amanda::Disklist::clean_dle_str_for_client($header->{'dle_str'},
+                  Amanda::Feature::am_features($self->{'their_features'}));
     }
     if (!$self->{'their_features'}->has($Amanda::Feature::fe_amrecover_origsize_in_header)) {
        $header->{'orig_size'} = 0;