summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2014-02-28 12:28:33 (GMT)
committerHolger Weiss <holger@zedat.fu-berlin.de>2014-02-28 12:28:33 (GMT)
commitc08d6a429ba0e0cd3642ba2c2fe85687472ee22f (patch)
tree396a37ae462543f0e28f36501c30796b3eb91249
parente260efb25690b13002a0bf432507f66bdad90f02 (diff)
downloadmonitoring-plugins-c08d6a4.tar.gz
Replace "plugins-scripts/subst.in" foo
Remove the buggy and complex awk(1) magic in "plugins-scripts/subst.in" in favor of simple sed(1) substitutions. The plugins in the "plugins-scripts" directory now always use the PATH specified via "./configure --trusted-path", or the default PATH hard-coded in "configure.ac". Fixes #1242.
-rw-r--r--NEWS2
-rw-r--r--configure.ac5
-rw-r--r--plugins-scripts/Makefile.am9
-rwxr-xr-xplugins-scripts/check_breeze.pl4
-rwxr-xr-xplugins-scripts/check_disk_smb.pl4
-rwxr-xr-xplugins-scripts/check_file_age.pl4
-rwxr-xr-xplugins-scripts/check_flexlm.pl4
-rwxr-xr-xplugins-scripts/check_ifoperstatus.pl4
-rwxr-xr-xplugins-scripts/check_ifstatus.pl4
-rwxr-xr-xplugins-scripts/check_ircd.pl4
-rwxr-xr-xplugins-scripts/check_log.sh28
-rwxr-xr-xplugins-scripts/check_mailq.pl4
-rwxr-xr-xplugins-scripts/check_mssql.pl4
-rwxr-xr-xplugins-scripts/check_netdns.pl4
-rwxr-xr-xplugins-scripts/check_ntp.pl4
-rwxr-xr-xplugins-scripts/check_oracle.sh2
-rwxr-xr-xplugins-scripts/check_rpc.pl4
-rwxr-xr-xplugins-scripts/check_sensors.sh5
-rwxr-xr-xplugins-scripts/check_wave.pl4
-rw-r--r--plugins-scripts/subst.in53
20 files changed, 53 insertions, 103 deletions
diff --git a/NEWS b/NEWS
index 42ac42a..c0c9d11 100644
--- a/NEWS
+++ b/NEWS
@@ -25,6 +25,8 @@ This file documents the major additions and syntax changes between releases.
25 renamed MP_STATE_DIRECTORY. The old variable will continue to work in v1.6.x 25 renamed MP_STATE_DIRECTORY. The old variable will continue to work in v1.6.x
26 check_swap used to allow returning OK on a system without swap when only percent thresholds 26 check_swap used to allow returning OK on a system without swap when only percent thresholds
27 were used. This is no longer the case and one must now use -n/--no-swap=<state> 27 were used. This is no longer the case and one must now use -n/--no-swap=<state>
28 The Perl and Shell plugins now use the PATH specified via ./configure's --trusted-path
29 option, or "/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" by default
28 30
291.5 2nd October 2013 311.5 2nd October 2013
30 ENHANCEMENTS 32 ENHANCEMENTS
diff --git a/configure.ac b/configure.ac
index 5759e60..a1ef445 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10,6 +10,7 @@ AM_MAINTAINER_MODE([enable])
10AC_CONFIG_HEADERS([config.h]) 10AC_CONFIG_HEADERS([config.h])
11AC_CANONICAL_HOST 11AC_CANONICAL_HOST
12 12
13DEFAULT_PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
13RELEASE=1 14RELEASE=1
14AC_SUBST(RELEASE) 15AC_SUBST(RELEASE)
15 16
@@ -75,7 +76,8 @@ AC_DEFINE_UNQUOTED(CGIURL,"$CGIURL",[URL of CGI programs])
75AC_ARG_WITH(trusted_path, 76AC_ARG_WITH(trusted_path,
76 ACX_HELP_STRING([--with-trusted-path=PATH], 77 ACX_HELP_STRING([--with-trusted-path=PATH],
77 [sets trusted path for executables called by scripts]), 78 [sets trusted path for executables called by scripts]),
78 with_trusted_path=$withval) 79 with_trusted_path=$withval,
80 with_trusted_path=$DEFAULT_PATH)
79AC_SUBST(with_trusted_path) 81AC_SUBST(with_trusted_path)
80 82
81EXTRAS= 83EXTRAS=
@@ -1781,7 +1783,6 @@ AC_OUTPUT(
1781 lib/tests/Makefile 1783 lib/tests/Makefile
1782 plugins-root/Makefile 1784 plugins-root/Makefile
1783 plugins-scripts/Makefile 1785 plugins-scripts/Makefile
1784 plugins-scripts/subst
1785 plugins-scripts/utils.pm 1786 plugins-scripts/utils.pm
1786 plugins-scripts/utils.sh 1787 plugins-scripts/utils.sh
1787 perlmods/Makefile 1788 perlmods/Makefile
diff --git a/plugins-scripts/Makefile.am b/plugins-scripts/Makefile.am
index 4ea262a..78a950c 100644
--- a/plugins-scripts/Makefile.am
+++ b/plugins-scripts/Makefile.am
@@ -23,6 +23,11 @@ EXTRA_DIST=check_breeze.pl check_disk_smb.pl check_flexlm.pl check_ircd.pl \
23 check_ifstatus.pl check_ifoperstatus.pl check_wave.pl check_mailq.pl check_file_age.pl \ 23 check_ifstatus.pl check_ifoperstatus.pl check_wave.pl check_mailq.pl check_file_age.pl \
24 utils.sh.in utils.pm.in t 24 utils.sh.in utils.pm.in t
25 25
26EDIT = sed \
27 -e 's|[@]NP_VERSION[@]|$(NP_VERSION)|g' \
28 -e 's|[@]TRUSTED_PATH[@]|$(with_trusted_path)|g' \
29 -e 's|[@]PERL[@]|$(PERL)|g'
30
26TESTS_ENVIRONMENT=perl -I $(top_builddir) -I $(top_srcdir) 31TESTS_ENVIRONMENT=perl -I $(top_builddir) -I $(top_srcdir)
27 32
28TESTS = @SCRIPT_TEST@ 33TESTS = @SCRIPT_TEST@
@@ -38,11 +43,11 @@ test-debug:
38CLEANFILES=$(libexec_SCRIPTS) 43CLEANFILES=$(libexec_SCRIPTS)
39 44
40.pl : 45.pl :
41 NP_VERSION=$(NP_VERSION) $(AWK) -f ./subst $< > $@ 46 $(EDIT) $< > $@
42 chmod +x $@ 47 chmod +x $@
43 48
44.sh : 49.sh :
45 NP_VERSION=$(NP_VERSION) $(AWK) -f ./subst $< > $@ 50 $(EDIT) $< > $@
46 chmod +x $@ 51 chmod +x $@
47 52
48clean-local: 53clean-local:
diff --git a/plugins-scripts/check_breeze.pl b/plugins-scripts/check_breeze.pl
index 917a1c6..38badeb 100755
--- a/plugins-scripts/check_breeze.pl
+++ b/plugins-scripts/check_breeze.pl
@@ -1,4 +1,4 @@
1#!/usr/bin/perl -wT 1#!@PERL@ -wT
2 2
3 3
4use strict; 4use strict;
@@ -13,7 +13,7 @@ $PROGNAME = "check_breeze";
13sub print_help (); 13sub print_help ();
14sub print_usage (); 14sub print_usage ();
15 15
16$ENV{'PATH'}='@trusted_path@'; 16$ENV{'PATH'}='@TRUSTED_PATH@';
17$ENV{'BASH_ENV'}=''; 17$ENV{'BASH_ENV'}='';
18$ENV{'ENV'}=''; 18$ENV{'ENV'}='';
19 19
diff --git a/plugins-scripts/check_disk_smb.pl b/plugins-scripts/check_disk_smb.pl
index 36259d5..99948a4 100755
--- a/plugins-scripts/check_disk_smb.pl
+++ b/plugins-scripts/check_disk_smb.pl
@@ -1,4 +1,4 @@
1#!/usr/bin/perl -w 1#!@PERL@ -w
2# 2#
3# 3#
4# check_disk.pl <host> <share> <user> <pass> [warn] [critical] [port] 4# check_disk.pl <host> <share> <user> <pass> [warn] [critical] [port]
@@ -33,7 +33,7 @@ sub print_usage ();
33 33
34$PROGNAME = "check_disk_smb"; 34$PROGNAME = "check_disk_smb";
35 35
36$ENV{'PATH'}='@trusted_path@'; 36$ENV{'PATH'}='@TRUSTED_PATH@';
37$ENV{'BASH_ENV'}=''; 37$ENV{'BASH_ENV'}='';
38$ENV{'ENV'}=''; 38$ENV{'ENV'}='';
39 39
diff --git a/plugins-scripts/check_file_age.pl b/plugins-scripts/check_file_age.pl
index e028038..5e062de 100755
--- a/plugins-scripts/check_file_age.pl
+++ b/plugins-scripts/check_file_age.pl
@@ -1,4 +1,4 @@
1#!/bin/perl -w 1#!@PERL@ -w
2 2
3# check_file_age.pl Copyright (C) 2003 Steven Grimm <koreth-nagios@midwinter.com> 3# check_file_age.pl Copyright (C) 2003 Steven Grimm <koreth-nagios@midwinter.com>
4# 4#
@@ -36,7 +36,7 @@ my ($result, $message, $age, $size, $st);
36 36
37$PROGNAME="check_file_age"; 37$PROGNAME="check_file_age";
38 38
39$ENV{'PATH'}='@trusted_path@'; 39$ENV{'PATH'}='@TRUSTED_PATH@';
40$ENV{'BASH_ENV'}=''; 40$ENV{'BASH_ENV'}='';
41$ENV{'ENV'}=''; 41$ENV{'ENV'}='';
42 42
diff --git a/plugins-scripts/check_flexlm.pl b/plugins-scripts/check_flexlm.pl
index de63d3a..49d674d 100755
--- a/plugins-scripts/check_flexlm.pl
+++ b/plugins-scripts/check_flexlm.pl
@@ -1,4 +1,4 @@
1#!/usr/bin/perl -w 1#!@PERL@ -w
2# 2#
3# usage: 3# usage:
4# check_flexlm.pl license_file 4# check_flexlm.pl license_file
@@ -44,7 +44,7 @@ $PROGNAME="check_flexlm";
44sub print_help (); 44sub print_help ();
45sub print_usage (); 45sub print_usage ();
46 46
47$ENV{'PATH'}='@trusted_path@'; 47$ENV{'PATH'}='@TRUSTED_PATH@';
48$ENV{'BASH_ENV'}=''; 48$ENV{'BASH_ENV'}='';
49$ENV{'ENV'}=''; 49$ENV{'ENV'}='';
50 50
diff --git a/plugins-scripts/check_ifoperstatus.pl b/plugins-scripts/check_ifoperstatus.pl
index 159eb62..1a7fbba 100755
--- a/plugins-scripts/check_ifoperstatus.pl
+++ b/plugins-scripts/check_ifoperstatus.pl
@@ -1,4 +1,4 @@
1#!/usr/local/bin/perl -w 1#!@PERL@ -w
2# 2#
3# check_ifoperstatus.pl - monitoring plugin 3# check_ifoperstatus.pl - monitoring plugin
4# 4#
@@ -49,7 +49,7 @@ sub usage ($);
49sub print_usage (); 49sub print_usage ();
50sub process_arguments (); 50sub process_arguments ();
51 51
52$ENV{'PATH'}='@trusted_path@'; 52$ENV{'PATH'}='@TRUSTED_PATH@';
53$ENV{'BASH_ENV'}=''; 53$ENV{'BASH_ENV'}='';
54$ENV{'ENV'}=''; 54$ENV{'ENV'}='';
55 55
diff --git a/plugins-scripts/check_ifstatus.pl b/plugins-scripts/check_ifstatus.pl
index 4760a28..e9e6214 100755
--- a/plugins-scripts/check_ifstatus.pl
+++ b/plugins-scripts/check_ifstatus.pl
@@ -1,4 +1,4 @@
1#!/usr/local/bin/perl -w 1#!@PERL@ -w
2# 2#
3# check_ifstatus.pl - monitoring plugin 3# check_ifstatus.pl - monitoring plugin
4# 4#
@@ -47,7 +47,7 @@ sub usage ($);
47sub print_usage (); 47sub print_usage ();
48sub process_arguments (); 48sub process_arguments ();
49 49
50$ENV{'PATH'}='@trusted_path@'; 50$ENV{'PATH'}='@TRUSTED_PATH@';
51$ENV{'BASH_ENV'}=''; 51$ENV{'BASH_ENV'}='';
52$ENV{'ENV'}=''; 52$ENV{'ENV'}='';
53 53
diff --git a/plugins-scripts/check_ircd.pl b/plugins-scripts/check_ircd.pl
index dab6595..c14980c 100755
--- a/plugins-scripts/check_ircd.pl
+++ b/plugins-scripts/check_ircd.pl
@@ -1,4 +1,4 @@
1#!/usr/bin/perl -wT 1#!@PERL@ -wT
2 2
3# ----------------------------------------------------------------------------- 3# -----------------------------------------------------------------------------
4# File Name: check_ircd.pl 4# File Name: check_ircd.pl
@@ -62,7 +62,7 @@ sub bindRemote ($$);
62 62
63# -------------------------------------------------------------[ Enviroment ]-- 63# -------------------------------------------------------------[ Enviroment ]--
64 64
65$ENV{'PATH'}='@trusted_path@'; 65$ENV{'PATH'}='@TRUSTED_PATH@';
66$ENV{'BASH_ENV'}=''; 66$ENV{'BASH_ENV'}='';
67$ENV{'ENV'}=''; 67$ENV{'ENV'}='';
68 68
diff --git a/plugins-scripts/check_log.sh b/plugins-scripts/check_log.sh
index be4c7be..8653a5e 100755
--- a/plugins-scripts/check_log.sh
+++ b/plugins-scripts/check_log.sh
@@ -58,18 +58,12 @@
58# Paths to commands used in this script. These 58# Paths to commands used in this script. These
59# may have to be modified to match your system setup. 59# may have to be modified to match your system setup.
60 60
61GREP="/bin/egrep"
62DIFF="/bin/diff"
63TAIL="/bin/tail"
64CAT="/bin/cat"
65RM="/bin/rm"
66CHMOD="/bin/chmod"
67TOUCH="/bin/touch"
68
69PROGNAME=`/bin/basename $0` 61PROGNAME=`/bin/basename $0`
70PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'` 62PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
71REVISION="@NP_VERSION@" 63REVISION="@NP_VERSION@"
72PATH="@trusted_path@" 64PATH="@TRUSTED_PATH@"
65
66export PATH
73 67
74. $PROGPATH/utils.sh 68. $PROGPATH/utils.sh
75 69
@@ -177,7 +171,7 @@ fi
177# the old diff file and exit 171# the old diff file and exit
178 172
179if [ ! -e $oldlog ]; then 173if [ ! -e $oldlog ]; then
180 $CAT $logfile > $oldlog 174 cat $logfile > $oldlog
181 echo "Log check data initialized..." 175 echo "Log check data initialized..."
182 exit $STATE_OK 176 exit $STATE_OK
183fi 177fi
@@ -191,20 +185,20 @@ if [ -x /bin/mktemp ]; then
191else 185else
192 tempdiff=`/bin/date '+%H%M%S'` 186 tempdiff=`/bin/date '+%H%M%S'`
193 tempdiff="/tmp/check_log.${tempdiff}" 187 tempdiff="/tmp/check_log.${tempdiff}"
194 $TOUCH $tempdiff 188 touch $tempdiff
195 $CHMOD 600 $tempdiff 189 chmod 600 $tempdiff
196fi 190fi
197 191
198$DIFF $logfile $oldlog | $GREP -v "^>" > $tempdiff 192diff $logfile $oldlog | grep -v "^>" > $tempdiff
199 193
200# Count the number of matching log entries we have 194# Count the number of matching log entries we have
201count=`$GREP -c "$query" $tempdiff` 195count=`grep -c "$query" $tempdiff`
202 196
203# Get the last matching entry in the diff file 197# Get the last matching entry in the diff file
204lastentry=`$GREP "$query" $tempdiff | $TAIL -1` 198lastentry=`grep "$query" $tempdiff | tail -1`
205 199
206$RM -f $tempdiff 200rm -f $tempdiff
207$CAT $logfile > $oldlog 201cat $logfile > $oldlog
208 202
209if [ "$count" = "0" ]; then # no matches, exit with no error 203if [ "$count" = "0" ]; then # no matches, exit with no error
210 echo "Log check ok - 0 pattern matches found" 204 echo "Log check ok - 0 pattern matches found"
diff --git a/plugins-scripts/check_mailq.pl b/plugins-scripts/check_mailq.pl
index 488cf2f..df1385d 100755
--- a/plugins-scripts/check_mailq.pl
+++ b/plugins-scripts/check_mailq.pl
@@ -1,4 +1,4 @@
1#!/usr/local/bin/perl -w 1#!@PERL@ -w
2 2
3# check_mailq - check to see how many messages are in the smtp queue awating 3# check_mailq - check to see how many messages are in the smtp queue awating
4# transmittal. 4# transmittal.
@@ -40,7 +40,7 @@ sub print_help ();
40sub print_usage (); 40sub print_usage ();
41sub process_arguments (); 41sub process_arguments ();
42 42
43$ENV{'PATH'}='@trusted_path@'; 43$ENV{'PATH'}='@TRUSTED_PATH@';
44$ENV{'BASH_ENV'}=''; 44$ENV{'BASH_ENV'}='';
45$ENV{'ENV'}=''; 45$ENV{'ENV'}='';
46$PROGNAME = "check_mailq"; 46$PROGNAME = "check_mailq";
diff --git a/plugins-scripts/check_mssql.pl b/plugins-scripts/check_mssql.pl
index cf23ae8..652a12a 100755
--- a/plugins-scripts/check_mssql.pl
+++ b/plugins-scripts/check_mssql.pl
@@ -1,4 +1,4 @@
1#!/usr/bin/perl -w 1#!@PERL@ -w
2 2
3# 3#
4# Copyright 2003 Roy Sigurd Karlsbakk 4# Copyright 2003 Roy Sigurd Karlsbakk
@@ -35,7 +35,7 @@ use strict;
35 35
36my $PROGNAME = "check_mssql"; 36my $PROGNAME = "check_mssql";
37 37
38$ENV{'PATH'}='@trusted_path@'; 38$ENV{'PATH'}='@TRUSTED_PATH@';
39$ENV{'BASH_ENV'}=''; 39$ENV{'BASH_ENV'}='';
40$ENV{'ENV'}=''; 40$ENV{'ENV'}='';
41 41
diff --git a/plugins-scripts/check_netdns.pl b/plugins-scripts/check_netdns.pl
index 6e0d02d..82939bf 100755
--- a/plugins-scripts/check_netdns.pl
+++ b/plugins-scripts/check_netdns.pl
@@ -1,4 +1,4 @@
1#!/usr/bin/perl -w 1#!@PERL@ -w
2 2
3# Perl version of check_dns plugin which calls DNS directly instead of 3# Perl version of check_dns plugin which calls DNS directly instead of
4# relying on nslookup (which has bugs) 4# relying on nslookup (which has bugs)
@@ -33,7 +33,7 @@ use utils ;
33 33
34my $PROGNAME = "check_netdns"; 34my $PROGNAME = "check_netdns";
35 35
36$ENV{'PATH'}='@trusted_path@'; 36$ENV{'PATH'}='@TRUSTED_PATH@';
37$ENV{'BASH_ENV'}=''; 37$ENV{'BASH_ENV'}='';
38$ENV{'ENV'}=''; 38$ENV{'ENV'}='';
39 39
diff --git a/plugins-scripts/check_ntp.pl b/plugins-scripts/check_ntp.pl
index cdcbffa..13da939 100755
--- a/plugins-scripts/check_ntp.pl
+++ b/plugins-scripts/check_ntp.pl
@@ -1,4 +1,4 @@
1#!/usr/bin/perl -w 1#!@PERL@ -w
2# 2#
3# (c)1999 Ian Cass, Knowledge Matters Ltd. 3# (c)1999 Ian Cass, Knowledge Matters Ltd.
4# Read the GNU copyright stuff for all the legalese 4# Read the GNU copyright stuff for all the legalese
@@ -69,7 +69,7 @@ $PROGNAME="check_ntp";
69sub print_help (); 69sub print_help ();
70sub print_usage (); 70sub print_usage ();
71 71
72$ENV{'PATH'}='@trusted_path@'; 72$ENV{'PATH'}='@TRUSTED_PATH@';
73$ENV{'BASH_ENV'}=''; 73$ENV{'BASH_ENV'}='';
74$ENV{'ENV'}=''; 74$ENV{'ENV'}='';
75 75
diff --git a/plugins-scripts/check_oracle.sh b/plugins-scripts/check_oracle.sh
index efa1df1..ceac95d 100755
--- a/plugins-scripts/check_oracle.sh
+++ b/plugins-scripts/check_oracle.sh
@@ -9,7 +9,7 @@
9PROGNAME=`basename $0` 9PROGNAME=`basename $0`
10PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'` 10PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
11REVISION="@NP_VERSION@" 11REVISION="@NP_VERSION@"
12PATH="@trusted_path@" 12PATH="@TRUSTED_PATH@"
13 13
14. $PROGPATH/utils.sh 14. $PROGPATH/utils.sh
15 15
diff --git a/plugins-scripts/check_rpc.pl b/plugins-scripts/check_rpc.pl
index f7fe032..cbdeceb 100755
--- a/plugins-scripts/check_rpc.pl
+++ b/plugins-scripts/check_rpc.pl
@@ -1,4 +1,4 @@
1#!/usr/local/bin/perl -w 1#!@PERL@ -w
2# 2#
3# check_rpc plugin for monitoring 3# check_rpc plugin for monitoring
4# 4#
@@ -37,7 +37,7 @@ sub print_help ();
37sub print_usage (); 37sub print_usage ();
38sub in ($$); 38sub in ($$);
39 39
40$ENV{'PATH'}='@trusted_path@'; 40$ENV{'PATH'}='@TRUSTED_PATH@';
41$ENV{'BASH_ENV'}=''; 41$ENV{'BASH_ENV'}='';
42$ENV{'ENV'}=''; 42$ENV{'ENV'}='';
43$ENV{'LC_ALL'}='C'; 43$ENV{'LC_ALL'}='C';
diff --git a/plugins-scripts/check_sensors.sh b/plugins-scripts/check_sensors.sh
index 53db9b4..05c64c4 100755
--- a/plugins-scripts/check_sensors.sh
+++ b/plugins-scripts/check_sensors.sh
@@ -3,8 +3,9 @@
3PROGNAME=`basename $0` 3PROGNAME=`basename $0`
4PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'` 4PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
5REVISION="@NP_VERSION@" 5REVISION="@NP_VERSION@"
6TRUSTED_PATH="@trusted_path@" 6PATH="@TRUSTED_PATH@"
7PATH=${TRUSTED_PATH:-"/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"} 7
8export PATH
8 9
9. $PROGPATH/utils.sh 10. $PROGPATH/utils.sh
10 11
diff --git a/plugins-scripts/check_wave.pl b/plugins-scripts/check_wave.pl
index 5192753..5fa78e3 100755
--- a/plugins-scripts/check_wave.pl
+++ b/plugins-scripts/check_wave.pl
@@ -1,4 +1,4 @@
1#!/usr/bin/perl -wT 1#!@PERL@ -wT
2# 2#
3 3
4 4
@@ -16,7 +16,7 @@ $PROGNAME = "check_wave";
16sub print_help (); 16sub print_help ();
17sub print_usage (); 17sub print_usage ();
18 18
19$ENV{'PATH'}='@trusted_path@'; 19$ENV{'PATH'}='@TRUSTED_PATH@';
20$ENV{'BASH_ENV'}=''; 20$ENV{'BASH_ENV'}='';
21$ENV{'ENV'}=''; 21$ENV{'ENV'}='';
22 22
diff --git a/plugins-scripts/subst.in b/plugins-scripts/subst.in
deleted file mode 100644
index c730b77..0000000
--- a/plugins-scripts/subst.in
+++ /dev/null
@@ -1,53 +0,0 @@
1#!/usr/bin/awk
2
3function which(c,path) {
4 cmd = "test -x " c;
5
6 if (system(cmd)==0) {
7 return c;
8 }
9
10 sub(/\/.*\//,"",c);
11 for (dir in path) {
12 cmd = "test -x " path[dir] "/" c;
13 if (system(cmd)==0) {
14 return path[dir] "/" c;
15 }
16 }
17
18
19 return c;
20}
21
22BEGIN {
23 split(ENVIRON["PATH"] ":/sbin:/usr/sbin",path,/:/);
24
25}
26
27# Plugin revision
28/@NP_VERSION@/ {sub(/@NP_VERSION@/,ENVIRON["NP_VERSION"]);}
29
30# scripting language (first line)
31
32/^#! ?\/.*\/python/ {sub(/^#! ?\/.*\/python/,"#! @PYTHON@");}
33/^#! ?\/.*\/perl/ {sub(/^#! ?\/.*\/perl/,"#! @PERL@");}
34/^#! ?\/.*\/[a-z]{0,2}awk/ {sub(/^#! ?\/.*\/[a-z]{0,2}awk/,"#! @AWK@");}
35/^#! ?\/.*\/sh/ {sub(/^#! ?\/.*\/sh/,"#! @SHELL@");}
36
37# If a script contains a reference to a fully qualified command,
38# subst will replace the fully qualified command with whatever is
39# returned from the which subroutine. run before changes to INC to add libexecdir
40# FIXME: Prepend executables with a substitution keyword instead.
41#
42/^[^#]/ && /(\/.*)?\/(bin|sbin|lib|libexec)\// {
43 match($0,/(\/.*)?\/(bin|sbin|lib|libexec)\/[-_a-zA-Z0-9]+/);
44 c=substr($0,RSTART,RLENGTH);
45 sub(c,which(c,path));
46}
47
48# Trusted path mechanism
49/@trusted_path@/ {sub(/@trusted_path@/,"@with_trusted_path@");}
50
51{
52 print;
53}