This file is indexed.

/usr/share/perl5/Grabcd/ReadConfig.pm is in libgrabcd-readconfig-perl 0009-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
#!/usr/bin/perl -w
#
# 2005 (c) by Christian Garbs <mitch@cgarbs.de>
# utility function to read a simple config file
# if not all keywords are found, an error is raised
# $filename is searched for as "~/.$filename" and "/etc/$filename.conf"
# file format is:
# # comment
# KEY=value

use strict;

package Grabcd::ReadConfig;

sub read_config($@)
# $_[0]    = Configuration file name
# $_[1..n] = must-have configuration keys
# result is a hash of the configuration
{
    my $filename = shift;
    my @keys = @_;

    my $result = {};

    my $file = "$ENV{HOME}/.$filename";

    if (! -r $file) {
	$file = "/etc/$filename.conf";
    }

    die "ERROR: configuration file <$file> does not exist.\n" unless -e $file;
    die "ERROR: configuration file <$file> is not readable.\n" unless -r _;

    open CONF, '<', $file or die "can't open <$file>: $!\n";
    while (my $line = <CONF>) {
	chomp $line;
	next if $line =~ /^\s*#/;
	next if $line =~ /^\s*$/;
	if ($line =~ /^\s*([A-Z_+-]+)=(.+)\s*$/) {
	    $result->{uc $1} = $2;
	} else {
	    warn "unparseable line $. in configuration file\n";
	}
    }
    close CONF or die "can't close <$file>: $!\n";

    foreach my $key (@keys) {
	$key = uc $key;
	die "ERROR: configuration option $key is not set.\n" unless exists $result->{$key};
    }

    return $result;
}

1;