This file is indexed.

/usr/lib/amanda/perl/Amanda/Extract.pm is in amanda-common 1:3.3.6-4.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# vim:ft=perl
# Copyright (c) 2008-2013 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
# 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
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
#
# Contact information: Zmanda Inc, 465 S. Mathilda Ave., Suite 300
# Sunnyvale, CA 94086, USA, or: http://www.zmanda.com

package Amanda::Extract;

use strict;
use warnings;
use IPC::Open3;

use Amanda::Debug qw( :logging );
use Amanda::Paths;

=head1 NAME

Amanda::Extract - perl utilities to run scripts and applications

=head1 SYNOPSIS

  use Amanda::Extract;

  my (@bsu, @err)= Amanda::Extract::BSU(application => $application,
					config      => $config,
					host        => $host,
					disk        => $disk,
					device      => $device);
  my (@bsu, @err)= Amanda::Extract::Run($application_name, \@g_options,
					$hdr, @properties);

=cut

sub BSU {
    my (%params) = @_;

    my %bsu;
    my @err;
    my @command;

    push @command, $Amanda::Paths::APPLICATION_DIR . '/' . $params{'application'};
    push @command, "support";
    push @command, "--config", $params{'config'} if $params{'config'};
    push @command, "--host"  , $params{'host'}   if $params{'host'};
    push @command, "--disk"  , $params{'disk'}   if $params{'disk'};
    push @command, "--device", $params{'device'} if $params{'device'};
    debug("Running: " . join(' ', @command));

    my $in;
    my $out;
    my $err = Symbol::gensym;
    my $pid = open3($in, $out, $err, @command);

    close($in);
    while (my $line = <$out>) {
	chomp $line;
	debug("support: $line");
	my ($name, $value) = split ' ', $line;

	$name = lc($name);

	if ($name eq 'config' ||
	    $name eq 'host' ||
	    $name eq 'disk' ||
	    $name eq 'index-line' ||
	    $name eq 'index-xml' ||
	    $name eq 'message-line' ||
	    $name eq 'message-xml' ||
	    $name eq 'record' ||
	    $name eq 'include-file' ||
	    $name eq 'include-list' ||
	    $name eq 'include-list-glob' ||
	    $name eq 'include-optional' ||
	    $name eq 'exclude-file' ||
	    $name eq 'exclude-list' ||
	    $name eq 'exclude-list-glob' ||
	    $name eq 'exclude-optional' ||
	    $name eq 'collection' ||
	    $name eq 'caclsize' ||
	    $name eq 'client-estimate' ||
	    $name eq 'multi-estimate' ||
	    $name eq 'amfeatures' ||
	    $name eq 'recover-dump-state-file') {
	    $bsu{$name} = ($value eq "YES");
	} elsif ($name eq 'max-level') {
	    $bsu{$name} = $value;
	} elsif ($name eq 'recover-mode') {
	    $bsu{'smb-recover-mode'} = $value eq 'SMB';
	} elsif ($name eq 'recover-path') {
	    $bsu{'recover-path-cwd'} = $value eq 'CWD';
	    $bsu{'recover-path-remote'} = $value eq 'REMOTE';
	} elsif ($name eq 'data-path') {
	    if ($value eq 'AMANDA') {
		$bsu{'data-path-amanda'} = 1;
	    } elsif ($value eq 'DIRECTTCP') {
		$bsu{'data-path-directtcp'} = 1;
	    }
	}
    }
    close($out);

    while (my $line = <$err>) {
	chomp($line);
	next if $line == '';
	push @err, $line;
    }
    close($err);

    waitpid($pid, 0);
    my $child_exit_status = $? >> 8;

    if ($child_exit_status != 0) {
	push @err, "exited with status $child_exit_status";
    }
    return (\%bsu, \@err);
}

1;