This file is indexed.

/usr/share/fusioninventory/lib/FusionInventory/Agent/Task/Inventory/BSD/Storages.pm is in fusioninventory-agent 1:2.3.10.1-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
package FusionInventory::Agent::Task::Inventory::BSD::Storages;

use strict;
use warnings;

use FusionInventory::Agent::Tools;

sub isEnabled {
    return -r '/etc/fstab';
}

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

    my $inventory = $params{inventory};
    my $logger    = $params{logger};

    # get a list of devices from /etc/fstab
    my @devices = _getDevicesFromFstab(logger => $logger);

    # parse dmesg
    my @lines = getAllLines(
        command => 'dmesg'
    );

    foreach my $device (@devices) {

        foreach my $line (@lines) {
            if ($line =~ /^$device->{DESCRIPTION}.*<(.*)>/) {
                $device->{MODEL} = $1;
            }
            if ($line =~ /^$device->{DESCRIPTION}.*\s+(\d+)\s*MB/) {
                $device->{CAPACITY} = $1;
            }
        }

        if ($device->{MODEL}) {
            if ($device->{MODEL} =~ s/^(SGI|SONY|WDC|ASUS|LG|TEAC|SAMSUNG|PHILIPS|PIONEER|MAXTOR|PLEXTOR|SEAGATE|IBM|SUN|SGI|DEC|FUJITSU|TOSHIBA|YAMAHA|HITACHI|VERITAS)\s*//i) {
                $device->{MANUFACTURER} = $1;
            }

            # clean up the model
            $device->{MODEL} =~ s/^(\s|,)*//;
            $device->{MODEL} =~ s/(\s|,)*$//;
        }

        $inventory->addEntry(
            section => 'STORAGES',
            entry   => $device
        );
    }
}

sub _getDevicesFromFstab {
    my (%params) = (
        file => '/etc/fstab',
        @_
    );

    my $handle = getFileHandle(%params);
    return unless $handle;

    my (@devices, %seen);
    while (my $line = <$handle>) {
        next unless $line =~ m{^/dev/(\S+)};
        next if $seen{$1}++;
        push @devices, { DESCRIPTION => $1 };
    }
    close $handle;

    return @devices;
}

1;