File: CVE-2012-3512.2.patch

package info (click to toggle)
munin 1.4.5-3+deb6u1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze-lts
  • size: 4,988 kB
  • ctags: 806
  • sloc: perl: 8,936; sh: 3,105; java: 1,754; makefile: 585; python: 143
file content (292 lines) | stat: -rw-r--r-- 10,075 bytes parent folder | download
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
commit ae71fac4b7512a618a01938c0586d8c3c9ca8ebf
Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
Date:   Tue Jul 22 21:36:49 2014 +0200

    plugins: use runtime $ENV{MUNIN_PLUGSTATE}
    
    [ upstream commit 9f2643c, amend to CVE-2012-3512 ]
    
    Since 780634c4a48fc57b6631d644fca3649f1417d211, the plugin state dir get
    resolved at runtime for security issues. The old behavior was using a
    compile-time resolution.

diff --git a/plugins/lib/Munin/Plugin.pm b/plugins/lib/Munin/Plugin.pm
index 6cad470..1ef7040 100644
--- a/plugins/lib/Munin/Plugin.pm
+++ b/plugins/lib/Munin/Plugin.pm
@@ -88,7 +88,8 @@ our $me = (split '/', $0)[-1];
 =head3 $Munin::Plugin::pluginstatedir
 
 Identical to the environment variable MUNIN_PLUGSTATE (available since
-Munin 1.3.3) or the install time @Z<>@PLUGSTATE@Z<>@ 'constant'.
+Munin 1.3.3)
+
 You can use this if you need to save several different state files.
 But there is also a function to change the state file name so the
 state file support functions can be used for several state files.
diff --git a/plugins/node.d.linux/apt.in b/plugins/node.d.linux/apt.in
index 6a6cf61..ab3bc5d 100755
--- a/plugins/node.d.linux/apt.in
+++ b/plugins/node.d.linux/apt.in
@@ -75,7 +75,7 @@ use strict;
 
 $ENV{'LANG'}="C";
 $ENV{'LC_ALL'}="C";
-my $statefile = "@@PLUGSTATE@@/plugin-apt.state";
+my $statefile = "$ENV{MUNIN_PLUGSTATE}/plugin-apt.state";
 
 sub update_state() {
 	if(-l $statefile) {
diff --git a/plugins/node.d.linux/apt_all.in b/plugins/node.d.linux/apt_all.in
index e6973c4..0c491f8 100644
--- a/plugins/node.d.linux/apt_all.in
+++ b/plugins/node.d.linux/apt_all.in
@@ -52,7 +52,7 @@ use strict;
 $ENV{'LANG'}="C";
 $ENV{'LC_ALL'}="C";
 
-my $statefile = "@@PLUGSTATE@@/plugin-apt.state";
+my $statefile = "$ENV{MUNIN_PLUGSTATE}/plugin-apt.state";
 my @releases = ("stable", "testing","unstable");
 
 
diff --git a/plugins/node.d.linux/iostat_ios.in b/plugins/node.d.linux/iostat_ios.in
index 90ce450..776472f 100644
--- a/plugins/node.d.linux/iostat_ios.in
+++ b/plugins/node.d.linux/iostat_ios.in
@@ -60,7 +60,7 @@ use IO::File;
 use Storable qw(store retrieve);
 use Munin::Plugin;
 
-use constant STATEFILE => '@@PLUGSTATE@@/iostat-ios.state';
+use constant STATEFILE => "$ENV{MUNIN_PLUGSTATE}/iostat-ios.state";
 
 if (defined($ARGV[0]) and $ARGV[0] eq 'autoconf') {
     if (-r "/proc/diskstats" or -r "/proc/partitions") {
diff --git a/plugins/node.d.linux/port_.in b/plugins/node.d.linux/port_.in
index 20c9631..fb0946d 100755
--- a/plugins/node.d.linux/port_.in
+++ b/plugins/node.d.linux/port_.in
@@ -66,7 +66,7 @@ sub cache_open
 {
     my ($fd, $file) = @_;
 
-    my $cache_dir = "@@PLUGSTATE@@";
+    my $cache_dir = "$ENV{MUNIN_PLUGSTATE}";
     my $cache = $file;
     $cache =~ s:/:_:g;
     $cache = "$cache_dir/$cache";
diff --git a/plugins/node.d.linux/yum.in b/plugins/node.d.linux/yum.in
index ffd2b5a..6a33ee0 100644
--- a/plugins/node.d.linux/yum.in
+++ b/plugins/node.d.linux/yum.in
@@ -27,9 +27,8 @@ Unknown license
 =cut
 
 use strict;
-use Munin::Common::Defaults;
 
-my $statefile = "$Munin::Common::Defaults::MUNIN_PLUGSTATE/yum.state";
+my $statefile = "$ENV{MUNIN_PLUGSTATE}/yum.state";
 
 sub update {
     if (-l $statefile) {
diff --git a/plugins/node.d/courier_.in b/plugins/node.d/courier_.in
index a3aae46..b663fc7 100644
--- a/plugins/node.d/courier_.in
+++ b/plugins/node.d/courier_.in
@@ -54,7 +54,7 @@ Unknown
 # Set the location of the courier logs
 COURIER_LOG=${logfile:-/var/log/mail.log}
 SERVICE=${service:-`basename $0 | sed 's/^courier_//g'`}
-OFFSET_FILE=@@PLUGSTATE@@/courier_${SERVICE}.offset
+OFFSET_FILE=${MUNIN_PLUGSTATE}/courier_${SERVICE}.offset
 LOGTAIL=${logtail:-/usr/sbin/logtail}
 
 mktempfile () {
diff --git a/plugins/node.d/courier_mta_mailstats.in b/plugins/node.d/courier_mta_mailstats.in
index 0563af7..360631e 100644
--- a/plugins/node.d/courier_mta_mailstats.in
+++ b/plugins/node.d/courier_mta_mailstats.in
@@ -29,7 +29,7 @@ Unknown
 
 =cut
 
-my $statefile = "@@PLUGSTATE@@/munin-plugin-courier_mta_mailstats.state";
+my $statefile = "$ENV{MUNIN_PLUGSTATE}/munin-plugin-courier_mta_mailstats.state";
 my $pos   = undef;
 my $delivered = 0;
 my $rejects = {};
diff --git a/plugins/node.d/courier_mta_mailvolume.in b/plugins/node.d/courier_mta_mailvolume.in
index 350c80d..0ee837f 100644
--- a/plugins/node.d/courier_mta_mailvolume.in
+++ b/plugins/node.d/courier_mta_mailvolume.in
@@ -28,7 +28,7 @@ Unknown license
 
 =cut
 
-my $statefile = "@@PLUGSTATE@@/munin-plugin-courier_mta_mailvolume.state";
+my $statefile = "$ENV{MUNIN_PLUGSTATE}/munin-plugin-courier_mta_mailvolume.state";
 my $pos       = undef;
 my $volume    = 0;
 my $LOGDIR    = $ENV{'logdir'}  || '/var/log';
diff --git a/plugins/node.d/cupsys_pages.in b/plugins/node.d/cupsys_pages.in
index 1715774..c6ada53 100644
--- a/plugins/node.d/cupsys_pages.in
+++ b/plugins/node.d/cupsys_pages.in
@@ -32,7 +32,7 @@ Unknown license
 use strict;
 use Munin::Plugin;
 
-my $statefile = "@@PLUGSTATE@@/munin-cupsys-pages.state";
+my $statefile = "$ENV{MUNIN_PLUGSTATE}/munin-cupsys-pages.state";
 my $pos       = undef;
 my %printers  = ();
 
diff --git a/plugins/node.d/ipmi_sensor_.in b/plugins/node.d/ipmi_sensor_.in
index 0512777..f3c9419 100644
--- a/plugins/node.d/ipmi_sensor_.in
+++ b/plugins/node.d/ipmi_sensor_.in
@@ -70,7 +70,7 @@ from time import time
 import sys
 import re
 
-CACHEDIR = "@@PLUGSTATE@@"
+CACHEDIR = os.environ['MUNIN_PLUGSTATE']
 CACHEFILE = "plugin-ipmi_sensor.cache"
 CACHEAGE = 120
 CONFIG = '@@CONFDIR@@/ipmi'
diff --git a/plugins/node.d/loggrep.in b/plugins/node.d/loggrep.in
index 2c87298..16bab42 100755
--- a/plugins/node.d/loggrep.in
+++ b/plugins/node.d/loggrep.in
@@ -79,7 +79,7 @@ for my $key (map {/^regex_(.+)/} keys %ENV) {
 
 die("No regexes specified") unless keys %regex;
 
-my $statefile = "@@PLUGSTATE@@/$name.state";
+my $statefile = "$ENV{MUNIN_PLUGSTATE}/$name.state";
 
 if ($ARGV[0] and $ARGV[0] eq 'config') {
     my $title = $ENV{title} || "Entries in $logfile";
diff --git a/plugins/node.d/mailman.in b/plugins/node.d/mailman.in
index bd8af07..0592b7a 100755
--- a/plugins/node.d/mailman.in
+++ b/plugins/node.d/mailman.in
@@ -24,9 +24,7 @@ License unknown
 
 =cut
 
-use Munin::Common::Defaults;
-
-$statefile = "$Munin::Common::Defaults::MUNIN_PLUGSTATE/munin-mailman-log.state";
+$statefile = "$ENV{MUNIN_PLUGSTATE}/munin-mailman-log.state";
 $pos = undef;
 $posts = 0;
 $members = 0;
diff --git a/plugins/node.d/mailscanner.in b/plugins/node.d/mailscanner.in
index ca32242..3a8433d 100644
--- a/plugins/node.d/mailscanner.in
+++ b/plugins/node.d/mailscanner.in
@@ -43,7 +43,7 @@ use strict;
 
 my $logfile = '/var/log/mail.log';
 my $logtail = '/usr/sbin/logtail';
-my $offsetfile = "@@PLUGSTATE@@/munin-mailscanner.offset";
+my $offsetfile = "$ENV{MUNIN_PLUGSTATE}/munin-mailscanner.offset";
 my ($clean, $viruses, $spams, $others, $total) = (0, 0, 0, 0, 0);
 my $cmd = (defined($ARGV[0])) ? $ARGV[0] : '';
 
diff --git a/plugins/node.d/mhttping.in b/plugins/node.d/mhttping.in
index 69ecaf5..35d823c 100644
--- a/plugins/node.d/mhttping.in
+++ b/plugins/node.d/mhttping.in
@@ -36,7 +36,7 @@ use strict ;
 
 ############################## STUFF YOU MIGHT NEED TO CHANGE
 
-my $datafile = "@@PLUGSTATE@@/mhttping.data" ;
+my $datafile = "$ENV{MUNIN_PLUGSTATE}/mhttping.data" ;
 my $resultsdir = "/home/gconnor/mhttping/results/" ;
 my $httping = "/usr/local/bin/httping" ;
 my $timeout = 30 ;
diff --git a/plugins/node.d/mysql_isam_space_.in b/plugins/node.d/mysql_isam_space_.in
index 236def3..9d1da78 100755
--- a/plugins/node.d/mysql_isam_space_.in
+++ b/plugins/node.d/mysql_isam_space_.in
@@ -21,7 +21,7 @@ if you need to override the defaults below:
 
  [mysql_isam_space_*]
   env.mysqlopts
-  env.statefile @@PLUGSTATE@@/plugin-mysql_isam_space.state
+  env.statefile $ENV{MUNIN_PLUGSTATE}/plugin-mysql_isam_space.state
   env.ignore
   env.absolute 0
 
@@ -50,7 +50,7 @@ munin-node.
 
 my $DB = `basename $0 | sed 's/^mysql_isam_space_//g' | tr '_' '-'` ;
 chomp $DB;
-my $STATEFILE = $ENV{'statefile'} || "@@PLUGSTATE@@/plugin-mysql_isam_space.state";
+my $STATEFILE = $ENV{'statefile'} || "$ENV{MUNIN_PLUGSTATE}/plugin-mysql_isam_space.state";
 my $MYSQLSHOW = $ENV{'mysqlshow'} || `which mysqlshow`;
 my $ABSOLUTE  = $ENV{'absolute'} || 0;
 my @mysql_opts = ();
diff --git a/plugins/node.d/perdition.in b/plugins/node.d/perdition.in
index 90ecbb9..0f12d81 100644
--- a/plugins/node.d/perdition.in
+++ b/plugins/node.d/perdition.in
@@ -55,7 +55,7 @@ mktempfile () {
 
 # Set the location of the perdition logs
 PERDITION_LOG=${logfile:-/var/log/perdition.log}
-OFFSET_FILE=@@PLUGSTATE@@/perdition.offset
+OFFSET_FILE=${MUNIN_PLUGSTATE}/perdition.offset
 LOGTAIL=${logtail:-/usr/sbin/logtail}
 
 case $1 in
diff --git a/plugins/node.d/pop_stats.in b/plugins/node.d/pop_stats.in
index 26e713e..fb45d24 100755
--- a/plugins/node.d/pop_stats.in
+++ b/plugins/node.d/pop_stats.in
@@ -4,7 +4,7 @@
 
 #%# family=contrib
 
-$pop{'statefile'} = "@@PLUGSTATE@@/munin-pop-log.state";
+$pop{'statefile'} = "$ENV{MUNIN_PLUGSTATE}/munin-pop-log.state";
 $pos   = undef;
 $logons = 0;
 
diff --git a/plugins/node.d/smart_.in b/plugins/node.d/smart_.in
index e09094a..961753a 100755
--- a/plugins/node.d/smart_.in
+++ b/plugins/node.d/smart_.in
@@ -87,13 +87,12 @@
 verbose=False
 # Suppress SMART warnings (True/False)
 report_warnings=True
-# Modify to your needs:
-statefiledir='@@PLUGSTATE@@'
 # You may not modify anything below this line
 
 import os, sys, string, pickle
 from math import log
 plugin_version="2.0"
+statefiledir=os.environ['MUNIN_PLUGSTATE']
 
 def verboselog(s):
     global plugin_name
diff --git a/plugins/node.d/spamstats.in b/plugins/node.d/spamstats.in
index 509fcf9..e95a346 100755
--- a/plugins/node.d/spamstats.in
+++ b/plugins/node.d/spamstats.in
@@ -24,7 +24,7 @@ Unknown license
 =cut
 
 
-$statefile = $ENV{statefile} || "@@PLUGSTATE@@/munin-spamstats.state";
+$statefile = $ENV{statefile} || "$ENV{MUNIN_PLUGSTATE}/munin-spamstats.state";
 $pos   = undef;
 $ham = 0;
 $spam = 0;