1 commit d94c29b7397362857b81d8c877a989fdb28490d8
2 Author: Kjetil Orbekk <kjetil.orbekk@gmail.com>
3 Date: Tue Nov 21 15:37:42 2017 -0500
5 Keep environment variables instead of overwriting them.
7 diff --git a/common/lib/Munin/Common/Defaults.pm b/common/lib/Munin/Common/Defaults.pm
8 index 131f52c0..bbf42697 100644
9 --- a/common/lib/Munin/Common/Defaults.pm
10 +++ b/common/lib/Munin/Common/Defaults.pm
11 @@ -71,7 +71,7 @@ sub export_to_environment {
13 my %defaults = %{$class->get_defaults()};
14 while (my ($k, $v) = each %defaults) {
16 + $ENV{$k} = $ENV{$k} || $v;
20 diff --git a/node/lib/Munin/Node/Service.pm b/node/lib/Munin/Node/Service.pm
21 index 1b4f6114..be58bd77 100644
22 --- a/node/lib/Munin/Node/Service.pm
23 +++ b/node/lib/Munin/Node/Service.pm
24 @@ -122,7 +122,7 @@ sub export_service_environment {
25 # We append the USER to the MUNIN_PLUGSTATE, to avoid CVE-2012-3512
26 my $uid = $self->_resolve_uid($service);
27 my $user = getpwuid($uid);
28 - $ENV{MUNIN_PLUGSTATE} = "$Munin::Common::Defaults::MUNIN_PLUGSTATE/$user";
29 + $ENV{MUNIN_PLUGSTATE} = "$ENV{MUNIN_PLUGSTATE}/$user";
31 # Provide a consistent default state-file.
32 $ENV{MUNIN_STATEFILE} = "$ENV{MUNIN_PLUGSTATE}/$service-$ENV{MUNIN_MASTER_IP}";
33 @@ -243,7 +243,7 @@ sub exec_service
35 # XXX - Create the statedir for the user
36 my $uid = $self->_resolve_uid($service);
37 - Munin::Node::OS->mkdir_subdir("$Munin::Common::Defaults::MUNIN_PLUGSTATE", $uid);
38 + Munin::Node::OS->mkdir_subdir("$ENV{MUNIN_PLUGSTATE}", $uid);
40 $self->change_real_and_effective_user_and_group($service);