This file is indexed.

/usr/lib/obs/server/BSConfiguration.pm is in obs-server 2.7.1-10.

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
#
# Copyright (c) 2013 Adrian Schroeter, SUSE Linux Products GmbH.
#
# 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 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 (see the file COPYING); if not, write to the
# Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#
################################################################
#
# Generic configuration handler for /configuration.xml and BSConfig.pm settings
#

package BSConfiguration;

use strict;

use BSConfig;
use BSUtil;
use BSXML;

# old values from BSConfig.pm are winning, remember which have been set
my %bsconfigvalues;
$bsconfigvalues{'obsname'} = 1 if defined $BSConfig::obsname;
$bsconfigvalues{'proxy'} = 1 if defined $BSConfig::proxy;
$bsconfigvalues{'noproxy'} = 1 if defined $BSConfig::noproxy;
$bsconfigvalues{'repodownload'} = 1 if defined $BSConfig::repodownload;
$bsconfigvalues{'enable_download_on_demand'} = 1 if defined $BSConfig::enable_download_on_demand;
$bsconfigvalues{'forceprojectkeys'} = 1 if defined $BSConfig::forceprojectkeys;


my $configurationid = '';
my $configuration_file = "$BSConfig::bsdir/configuration.xml";
my $confiuration_checked_once;

sub update_from_configuration {
  my @s = stat($configuration_file);
  $configurationid = @s ? "$s[9]/$s[7]/$s[1]" : '';
  my $xml = readxml($configuration_file, $BSXML::configuration, 1) || {};
  $BSConfig::obsname = $xml->{'name'} unless $bsconfigvalues{'obsname'};
  $BSConfig::proxy = $xml->{'http_proxy'} unless $bsconfigvalues{'proxy'};
  $BSConfig::noproxy = $xml->{'no_proxy'} unless $bsconfigvalues{'noproxy'};
  $BSConfig::repodownload  = $xml->{'download_url'} unless $bsconfigvalues{'repodownload'};
  if (!$bsconfigvalues{'enable_download_on_demand'}) {
    $BSConfig::enable_download_on_demand = ($xml->{'download_on_demand'} || '') eq 'on' ? 1 : 0;
  }
  if (!$bsconfigvalues{'forceprojectkeys'}) {
    $BSConfig::forceprojectkeys = ($xml->{'enforce_project_keys'} || '') eq 'on' ? 1 : 0;
  }
  $BSConfig::obsname = "build.some.where" unless defined $BSConfig::obsname;
}

sub check_configuration {
  my @s = stat($configuration_file);
  my $id = @s ? "$s[9]/$s[7]/$s[1]" : '';
  update_from_configuration() if $configurationid ne $id;
}

# useful for BSServer where we fork for every request
sub check_configuration_once {
  return if $confiuration_checked_once;
  $confiuration_checked_once = 1;
  check_configuration();
}

update_from_configuration();

1;