John C. Frickson 9 лет назад
Родитель
Сommit
75f5559313

+ 2 - 0
.gitignore

@@ -264,3 +264,5 @@ NP-VERSION-FILE
 /po/quot.sed
 /po/quot.sed
 /po/POTFILES
 /po/POTFILES
 /po/stamp-po
 /po/stamp-po
+
+/tools/build_perl_modules

+ 22 - 0
NEWS

@@ -1,5 +1,27 @@
 This file documents the major additions and syntax changes between releases.
 This file documents the major additions and syntax changes between releases.
 
 
+2.1.3 2016-09-12
+	ENHANCEMENTS
+	SNI support in check_tcp (ddbilik)
+	check_disk_smb.pl: add support for -k for kerberos authentication
+	check_file_age.c: allow wildcard matching
+
+	FIXES
+	check_tcp.c: tools/build_perl_modules hardcodes the perl used
+	check_game.c: reports ping as number of players (Jason Rivers)
+	fix some gcc5 warnings (Mario Trangoni)
+	check_cluster.c: Update wording in comments (Troy Lea)
+	check_nagios.c: could not locate a running nagios process
+	check_swap.c: does not accept threshold of zero
+	check_swap.c: uses inconsistent checks on negative thresholds
+	check_snmp.c: --offset does not appear to do anything (Troy Lea)
+	sslutils.c: output has first line of "SSL Version: xxxxxx"
+	  effects anything using sslutils including check_http, check_dhcp
+	  and others
+	utils_cmd.c: when using ssh (or check-by-ssh) with ControlMaster/ControlPersist,
+	  nagios times out the first time and one gets zombie processes (Gordon Messmer)
+
+
 2.1.2 2016-08-01
 2.1.2 2016-08-01
 	SECURITY FIXES
 	SECURITY FIXES
 
 

+ 1 - 1
NP-VERSION-GEN

@@ -6,7 +6,7 @@
 SRC_ROOT=`dirname $0`
 SRC_ROOT=`dirname $0`
 
 
 NPVF=NP-VERSION-FILE
 NPVF=NP-VERSION-FILE
-DEF_VER=2.1.2.git
+DEF_VER=2.1.3.git
 
 
 LF='
 LF='
 '
 '

+ 4 - 2
configure.ac

@@ -1,9 +1,10 @@
 dnl Process this file with autoconf to produce a configure script.
 dnl Process this file with autoconf to produce a configure script.
 AC_PREREQ(2.59)
 AC_PREREQ(2.59)
-AC_INIT(nagios-plugins,2.1.2)
+AC_INIT(nagios-plugins,2.1.3)
 AC_CONFIG_SRCDIR(NPTest.pm)
 AC_CONFIG_SRCDIR(NPTest.pm)
-AC_CONFIG_FILES([gl/Makefile 
+AC_CONFIG_FILES([gl/Makefile
 	nagios-plugins.spec])
 	nagios-plugins.spec])
+AC_CONFIG_FILES([tools/build_perl_modules],[chmod +x tools/build_perl_modules])
 AC_CONFIG_AUX_DIR(build-aux)
 AC_CONFIG_AUX_DIR(build-aux)
 AM_INIT_AUTOMAKE([1.8.3])
 AM_INIT_AUTOMAKE([1.8.3])
 AM_MAINTAINER_MODE([enable])
 AM_MAINTAINER_MODE([enable])
@@ -1923,3 +1924,4 @@ ACX_FEATURE([with],[cgiurl])
 ACX_FEATURE([with],[trusted-path])
 ACX_FEATURE([with],[trusted-path])
 ACX_FEATURE([enable],[libtap])
 ACX_FEATURE([enable],[libtap])
 
 
+AC_OUTPUT()

+ 7 - 2
lib/utils_cmd.c

@@ -140,7 +140,7 @@ _cmd_open (char *const *argv, int *pfd, int *pfderr)
 	struct rlimit limit;
 	struct rlimit limit;
 #endif
 #endif
 
 
-	int i = 0;
+	int flags, i = 0;
 
 
 	/* if no command was passed, return with no error */
 	/* if no command was passed, return with no error */
 	if (argv == NULL)
 	if (argv == NULL)
@@ -188,6 +188,11 @@ _cmd_open (char *const *argv, int *pfd, int *pfderr)
 	/* close childs descriptors in our address space */
 	/* close childs descriptors in our address space */
 	close (pfd[1]);
 	close (pfd[1]);
 	close (pfderr[1]);
 	close (pfderr[1]);
+	/* don't block on reading stderr from child, to work around
+ 	 * hang when the child has forked.  A blocking read may not
+ 	 * get EOF. */
+	flags = fcntl (pfderr[0], F_GETFL, 0);
+	fcntl (pfderr[0], F_SETFL, flags | O_NONBLOCK);
 
 
 	/* tag our file's entry in the pid-list and return it */
 	/* tag our file's entry in the pid-list and return it */
 	_cmd_pids[pfd[0]] = pid;
 	_cmd_pids[pfd[0]] = pid;
@@ -238,7 +243,7 @@ _cmd_fetch_output (int fd, output * op, int flags)
 		i++;
 		i++;
 	}
 	}
 
 
-	if (ret < 0) {
+	if (ret < 0 && (errno != EAGAIN && errno != EWOULDBLOCK)) {
 		printf ("read() returned %d: %s\n", ret, strerror (errno));
 		printf ("read() returned %d: %s\n", ret, strerror (errno));
 		return ret;
 		return ret;
 	}
 	}

+ 3 - 2
nagios-plugins.spec.in

@@ -182,15 +182,16 @@ rm -rf $RPM_BUILD_ROOT
 
 
 
 
 %files -f %{name}.lang
 %files -f %{name}.lang
-%config(missingok,noreplace) %{_sysconfdir}/command.cfg
 %doc CODING COPYING FAQ INSTALL LEGAL README REQUIREMENTS SUPPORT THANKS
 %doc CODING COPYING FAQ INSTALL LEGAL README REQUIREMENTS SUPPORT THANKS
-%doc ChangeLog command.cfg
+%doc ChangeLog
 %if ! %{isaix}
 %if ! %{isaix}
 %{_datadir}/locale/de/LC_MESSAGES/nagios-plugins.mo
 %{_datadir}/locale/de/LC_MESSAGES/nagios-plugins.mo
 %{_datadir}/locale/fr/LC_MESSAGES/nagios-plugins.mo
 %{_datadir}/locale/fr/LC_MESSAGES/nagios-plugins.mo
 %endif
 %endif
 
 
 %changelog
 %changelog
+* Thu Aug 18 2016 John Frickson jfrickson<@>nagios.com
+- Removed references to the 'command.cfg' file, which no longer exists
 * Mon May 23 2005 Sean Finney <seanius@seanius.net> - cvs head
 * Mon May 23 2005 Sean Finney <seanius@seanius.net> - cvs head
 - just include the nagios plugins directory, which will automatically include
 - just include the nagios plugins directory, which will automatically include
   all generated plugins (which keeps the build from failing on systems that
   all generated plugins (which keeps the build from failing on systems that

+ 3 - 1
plugins-scripts/check_disk_smb.pl

@@ -22,7 +22,7 @@ require 5.004;
 use POSIX;
 use POSIX;
 use strict;
 use strict;
 use Getopt::Long;
 use Getopt::Long;
-use vars qw($opt_P $opt_V $opt_h $opt_H $opt_s $opt_W $opt_u $opt_p $opt_w $opt_c $opt_a $verbose);
+use vars qw($opt_P $opt_V $opt_h $opt_H $opt_k $opt_s $opt_W $opt_u $opt_p $opt_w $opt_c $opt_a $verbose);
 use vars qw($PROGNAME);
 use vars qw($PROGNAME);
 use FindBin;
 use FindBin;
 use lib "$FindBin::Bin";
 use lib "$FindBin::Bin";
@@ -44,6 +44,7 @@ GetOptions
 	 "P=s" => \$opt_P, "port=s"     => \$opt_P,
 	 "P=s" => \$opt_P, "port=s"     => \$opt_P,
 	 "V"   => \$opt_V, "version"    => \$opt_V,
 	 "V"   => \$opt_V, "version"    => \$opt_V,
 	 "h"   => \$opt_h, "help"       => \$opt_h,
 	 "h"   => \$opt_h, "help"       => \$opt_h,
+	 "k"   => \$opt_k, "kerberos"   => \$opt_k,
 	 "w=s" => \$opt_w, "warning=s"  => \$opt_w,
 	 "w=s" => \$opt_w, "warning=s"  => \$opt_w,
 	 "c=s" => \$opt_c, "critical=s" => \$opt_c,
 	 "c=s" => \$opt_c, "critical=s" => \$opt_c,
 	 "p=s" => \$opt_p, "password=s" => \$opt_p,
 	 "p=s" => \$opt_p, "password=s" => \$opt_p,
@@ -189,6 +190,7 @@ my @cmd = (
 	defined($workgroup) ? ("-W", $workgroup) : (),
 	defined($workgroup) ? ("-W", $workgroup) : (),
 	defined($address) ? ("-I", $address) : (),
 	defined($address) ? ("-I", $address) : (),
 	defined($opt_P) ? ("-p", $opt_P) : (),
 	defined($opt_P) ? ("-p", $opt_P) : (),
+	defined($opt_k) ? ("-k") : (),
 	"-c", "du"
 	"-c", "du"
 );
 );
 
 

+ 32 - 23
plugins-scripts/check_file_age.pl

@@ -35,7 +35,7 @@ sub print_help ();
 sub print_usage ();
 sub print_usage ();
 
 
 my ($opt_c, $opt_f, $opt_w, $opt_C, $opt_W, $opt_h, $opt_V, $opt_i);
 my ($opt_c, $opt_f, $opt_w, $opt_C, $opt_W, $opt_h, $opt_V, $opt_i);
-my ($result, $message, $age, $size, $st, $perfdata);
+my ($result, $message, $age, $size, $st, $perfdata, $output, @filelist, $filename);
 
 
 $PROGNAME="check_file_age";
 $PROGNAME="check_file_age";
 
 
@@ -77,35 +77,44 @@ if (! $opt_f) {
 	exit $ERRORS{'UNKNOWN'};
 	exit $ERRORS{'UNKNOWN'};
 }
 }
 
 
-# Check that file exists (can be directory or link)
-unless (-e $opt_f) {
-	if ($opt_i) {
-		$result = 'OK';
-		print "FILE_AGE $result: $opt_f doesn't exist, but ignore-missing was set\n";
-		exit $ERRORS{$result};
-
-	} else {
-		print "FILE_AGE CRITICAL: File not found - $opt_f\n";
-		exit $ERRORS{'CRITICAL'};
+# Check that file(s) exists (can be directory or link)
+$perfdata = "";
+$output = "";
+@filelist = glob($opt_f);
+
+foreach $filename (@filelist) {
+	unless (-e $filename) {
+		if ($opt_i) {
+			$result = 'OK';
+			print "FILE_AGE $result: $filename doesn't exist, but ignore-missing was set\n";
+			exit $ERRORS{$result};
+
+		} else {
+			print "FILE_AGE CRITICAL: File not found - $filename\n";
+			exit $ERRORS{'CRITICAL'};
+		}
 	}
 	}
-}
 
 
-$st = File::stat::stat($opt_f);
-$age = time - $st->mtime;
-$size = $st->size;
-$perfdata = "age=${age}s;${opt_w};${opt_c} size=${size}B;${opt_W};${opt_C};0";
+	$st = File::stat::stat($filename);
+	$age = time - $st->mtime;
+	$size = $st->size;
+	$perfdata = $perfdata . "age=${age}s;${opt_w};${opt_c} size=${size}B;${opt_W};${opt_C};0 ";
 
 
+	$result = 'OK';
 
 
-$result = 'OK';
+	if (($opt_c and $age > $opt_c) or ($opt_C and $size < $opt_C)) {
+		$result = 'CRITICAL';
+	}
+	elsif (($opt_w and $age > $opt_w) or ($opt_W and $size < $opt_W)) {
+		$result = 'WARNING';
+	}
+
+	$output = $output . "FILE_AGE $result: $filename is $age seconds old and $size bytes ";
 
 
-if (($opt_c and $age > $opt_c) or ($opt_C and $size < $opt_C)) {
-	$result = 'CRITICAL';
-}
-elsif (($opt_w and $age > $opt_w) or ($opt_W and $size < $opt_W)) {
-	$result = 'WARNING';
 }
 }
 
 
-print "FILE_AGE $result: $opt_f is $age seconds old and $size bytes | $perfdata\n";
+print "$output | $perfdata\n";
+
 exit $ERRORS{$result};
 exit $ERRORS{$result};
 
 
 sub print_usage () {
 sub print_usage () {

+ 1 - 1
plugins/check_cluster.c

@@ -1,6 +1,6 @@
 /*****************************************************************************
 /*****************************************************************************
 * 
 * 
-* check_cluster.c - Host and Service Cluster Plugin for Nagios 2.x
+* check_cluster.c - Host and Service Cluster Plugin for Nagios Core
 * 
 * 
 * License: GPL
 * License: GPL
 * Copyright (c) 2000-2004 Ethan Galstad (nagios@nagios.org)
 * Copyright (c) 2000-2004 Ethan Galstad (nagios@nagios.org)

+ 1 - 1
plugins/check_dns.c

@@ -496,7 +496,7 @@ process_arguments (int argc, char **argv)
     case 'q': /* querytype -- A or AAAA or ANY or SRV or TXT, etc. */
     case 'q': /* querytype -- A or AAAA or ANY or SRV or TXT, etc. */
       if (strlen (optarg) < 1 || strlen (optarg) > 5)
       if (strlen (optarg) < 1 || strlen (optarg) > 5)
 	die (STATE_UNKNOWN, "%s\n", _("Missing valid querytype parameter.  Try using 'A' or 'AAAA' or 'SRV'"));
 	die (STATE_UNKNOWN, "%s\n", _("Missing valid querytype parameter.  Try using 'A' or 'AAAA' or 'SRV'"));
-      strntoupper(optarg, sizeof(optarg));
+      strntoupper(optarg, strlen(optarg));
       strcpy(query_type, "-querytype=");
       strcpy(query_type, "-querytype=");
       strcat(query_type, optarg);
       strcat(query_type, optarg);
       query_set = TRUE;
       query_set = TRUE;

+ 1 - 1
plugins/check_game.c

@@ -280,7 +280,7 @@ validate_arguments (void)
     qstat_map_field = 3;
     qstat_map_field = 3;
 
 
   if (qstat_ping_field < 0)
   if (qstat_ping_field < 0)
-    qstat_ping_field = 5;
+    qstat_ping_field = 6;
 
 
   return OK;
   return OK;
 }
 }

+ 1 - 1
plugins/check_nagios.c

@@ -66,7 +66,7 @@ main (int argc, char **argv)
 	int procppid = 0;
 	int procppid = 0;
 	int procvsz = 0;
 	int procvsz = 0;
 	int procrss = 0;
 	int procrss = 0;
-	char *proc_cgroup_hierarchy;
+	char proc_cgroup_hierarchy[MAX_INPUT_BUFFER];
 	float procpcpu = 0;
 	float procpcpu = 0;
 	char procstat[8];
 	char procstat[8];
 #ifdef PS_USES_PROCETIME
 #ifdef PS_USES_PROCETIME

+ 1 - 1
plugins/check_snmp.c

@@ -485,7 +485,7 @@ main (int argc, char **argv)
 
 
 		/* Process this block for numeric comparisons */
 		/* Process this block for numeric comparisons */
 		/* Make some special values,like Timeticks numeric only if a threshold is defined */
 		/* Make some special values,like Timeticks numeric only if a threshold is defined */
-		if (thlds[i]->warning || thlds[i]->critical || calculate_rate || is_ticks) {
+		if (thlds[i]->warning || thlds[i]->critical || calculate_rate || is_ticks || offset != 0.0) {
 			ptr = strpbrk (show, "-0123456789");
 			ptr = strpbrk (show, "-0123456789");
 			if (ptr == NULL)
 			if (ptr == NULL)
 				die (STATE_UNKNOWN,_("No valid data returned (%s)\n"), show);
 				die (STATE_UNKNOWN,_("No valid data returned (%s)\n"), show);

+ 12 - 2
plugins/check_swap.c

@@ -57,6 +57,8 @@ int validate_arguments (void);
 void print_usage (void);
 void print_usage (void);
 void print_help (void);
 void print_help (void);
 
 
+int have_warn = 0;
+int have_crit = 0;
 int warn_percent = 0;
 int warn_percent = 0;
 int crit_percent = 0;
 int crit_percent = 0;
 float warn_size_bytes = 0;
 float warn_size_bytes = 0;
@@ -423,16 +425,19 @@ process_arguments (int argc, char **argv)
 		case 'w':									/* warning size threshold */
 		case 'w':									/* warning size threshold */
 			if (is_intnonneg (optarg)) {
 			if (is_intnonneg (optarg)) {
 				warn_size_bytes = (float) atoi (optarg);
 				warn_size_bytes = (float) atoi (optarg);
+				have_warn = TRUE;
 				break;
 				break;
 			}
 			}
 			else if (strstr (optarg, ",") &&
 			else if (strstr (optarg, ",") &&
 							 strstr (optarg, "%") &&
 							 strstr (optarg, "%") &&
 							 sscanf (optarg, "%f,%d%%", &warn_size_bytes, &warn_percent) == 2) {
 							 sscanf (optarg, "%f,%d%%", &warn_size_bytes, &warn_percent) == 2) {
 				warn_size_bytes = floorf(warn_size_bytes);
 				warn_size_bytes = floorf(warn_size_bytes);
+				have_warn = TRUE;
 				break;
 				break;
 			}
 			}
 			else if (strstr (optarg, "%") &&
 			else if (strstr (optarg, "%") &&
 							 sscanf (optarg, "%d%%", &warn_percent) == 1) {
 							 sscanf (optarg, "%d%%", &warn_percent) == 1) {
+				have_warn = TRUE;
 				break;
 				break;
 			}
 			}
 			else {
 			else {
@@ -441,16 +446,19 @@ process_arguments (int argc, char **argv)
 		case 'c':									/* critical size threshold */
 		case 'c':									/* critical size threshold */
 			if (is_intnonneg (optarg)) {
 			if (is_intnonneg (optarg)) {
 				crit_size_bytes = (float) atoi (optarg);
 				crit_size_bytes = (float) atoi (optarg);
+				have_crit = TRUE;
 				break;
 				break;
 			}
 			}
 			else if (strstr (optarg, ",") &&
 			else if (strstr (optarg, ",") &&
 							 strstr (optarg, "%") &&
 							 strstr (optarg, "%") &&
 							 sscanf (optarg, "%f,%d%%", &crit_size_bytes, &crit_percent) == 2) {
 							 sscanf (optarg, "%f,%d%%", &crit_size_bytes, &crit_percent) == 2) {
 				crit_size_bytes = floorf(crit_size_bytes);
 				crit_size_bytes = floorf(crit_size_bytes);
+				have_crit = TRUE;
 				break;
 				break;
 			}
 			}
 			else if (strstr (optarg, "%") &&
 			else if (strstr (optarg, "%") &&
 							 sscanf (optarg, "%d%%", &crit_percent) == 1) {
 							 sscanf (optarg, "%d%%", &crit_percent) == 1) {
+				have_crit = TRUE;
 				break;
 				break;
 			}
 			}
 			else {
 			else {
@@ -502,8 +510,10 @@ process_arguments (int argc, char **argv)
 int
 int
 validate_arguments (void)
 validate_arguments (void)
 {
 {
-	if (warn_percent == 0 && crit_percent == 0 && warn_size_bytes == 0
-			&& crit_size_bytes == 0) {
+	if (have_crit == FALSE && have_warn == FALSE)
+		return ERROR;
+	else if (warn_percent < 0 || crit_percent < 0 || warn_size_bytes < 0
+			|| crit_size_bytes < 0) {
 		return ERROR;
 		return ERROR;
 	}
 	}
 	else if (warn_percent < crit_percent) {
 	else if (warn_percent < crit_percent) {

+ 7 - 2
plugins/check_tcp.c

@@ -65,6 +65,7 @@ static int READ_TIMEOUT = 2;
 
 
 static int server_port = 0;
 static int server_port = 0;
 static char *server_address = NULL;
 static char *server_address = NULL;
+static char *server_name = NULL;
 static int host_specified = FALSE;
 static int host_specified = FALSE;
 static char *server_send = NULL;
 static char *server_send = NULL;
 static char *server_quit = NULL;
 static char *server_quit = NULL;
@@ -241,7 +242,7 @@ main (int argc, char **argv)
 
 
 #ifdef HAVE_SSL
 #ifdef HAVE_SSL
 	if (flags & FLAG_SSL){
 	if (flags & FLAG_SSL){
-		result = np_net_ssl_init(sd);
+		result = np_net_ssl_init_with_hostname(sd, server_name);
 		if (result == STATE_OK && check_cert == TRUE) {
 		if (result == STATE_OK && check_cert == TRUE) {
 			result = np_net_ssl_check_cert(days_till_exp_warn, days_till_exp_crit);
 			result = np_net_ssl_check_cert(days_till_exp_warn, days_till_exp_crit);
 		}
 		}
@@ -452,7 +453,7 @@ process_arguments (int argc, char **argv)
 	}
 	}
 
 
 	while (1) {
 	while (1) {
-		c = getopt_long (argc, argv, "+hVv46EAH:s:e:q:m:c:w:t:p:C:W:d:Sr:jD:M:",
+		c = getopt_long (argc, argv, "+hVv46EAH:s:e:q:m:c:w:t:p:C:W:d:Sr:jD:M:N:",
 		                 longopts, &option);
 		                 longopts, &option);
 
 
 		if (c == -1 || c == EOF || c == 1)
 		if (c == -1 || c == EOF || c == 1)
@@ -603,6 +604,9 @@ process_arguments (int argc, char **argv)
 		case 'A':
 		case 'A':
 			match_flags |= NP_MATCH_ALL;
 			match_flags |= NP_MATCH_ALL;
 			break;
 			break;
+		case 'N':                 /* Server Name Indication */
+			server_name = optarg;
+			break;
 		}
 		}
 	}
 	}
 
 
@@ -687,4 +691,5 @@ print_usage (void)
   printf ("[-e <expect string>] [-q <quit string>][-m <maximum bytes>] [-d <delay>]\n");
   printf ("[-e <expect string>] [-q <quit string>][-m <maximum bytes>] [-d <delay>]\n");
   printf ("[-t <timeout seconds>] [-r <refuse state>] [-M <mismatch state>] [-v] [-4|-6] [-j]\n");
   printf ("[-t <timeout seconds>] [-r <refuse state>] [-M <mismatch state>] [-v] [-4|-6] [-j]\n");
   printf ("[-D <warn days cert expire>[,<crit days cert expire>]] [-S <use SSL>] [-E]\n");
   printf ("[-D <warn days cert expire>[,<crit days cert expire>]] [-S <use SSL>] [-E]\n");
+  printf ("[-N <server name indication>]\n");
 }
 }

+ 2 - 0
plugins/check_uptime.c

@@ -37,6 +37,8 @@ char *copyright = "2014";
 char *developer = "Andy Brist";
 char *developer = "Andy Brist";
 
 
 static int process_arguments (int, char **);
 static int process_arguments (int, char **);
+int validate_arguments (void);
+int getuptime (void);
 void print_help (void);
 void print_help (void);
 void print_usage (void);
 void print_usage (void);
 int verbose = 0;
 int verbose = 0;

+ 0 - 1
plugins/sslutils.c

@@ -157,7 +157,6 @@ int np_net_ssl_init_with_hostname_version_and_cert(int sd, char *host_name, int
 #endif
 #endif
 		SSL_set_fd(s, sd);
 		SSL_set_fd(s, sd);
 		if (SSL_connect(s) == 1) {
 		if (SSL_connect(s) == 1) {
-printf("SSL Version: %s\n", SSL_get_version(s));
 			return OK;
 			return OK;
 		} else {
 		} else {
 			printf("%s\n", _("CRITICAL - Cannot make SSL connection."));
 			printf("%s\n", _("CRITICAL - Cannot make SSL connection."));

+ 2 - 0
plugins/utils.h

@@ -91,6 +91,8 @@ void usage_va(const char *fmt, ...) __attribute__((noreturn));
 
 
 const char *state_text (int);
 const char *state_text (int);
 
 
+int parse_timeout_string (char *timeout_str);
+
 #define max(a,b) (((a)>(b))?(a):(b))
 #define max(a,b) (((a)>(b))?(a):(b))
 #define min(a,b) (((a)<(b))?(a):(b))
 #define min(a,b) (((a)<(b))?(a):(b))
 
 

+ 3 - 3
tools/build_perl_modules → tools/build_perl_modules.in

@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!@PERL@
 # SYNTAX:
 # SYNTAX:
 #	build_perl_modules -d dest_dir [-c] [-m] [-t] [-i] [-s <section>] tarball_dir
 #	build_perl_modules -d dest_dir [-c] [-m] [-t] [-i] [-s <section>] tarball_dir
 #
 #
@@ -221,11 +221,11 @@ foreach my $tarball (@tarballs) {
 
 
             my $command;
             my $command;
             if ( -f "Build.PL" && $have_module_build ) {
             if ( -f "Build.PL" && $have_module_build ) {
-                open( CMD, "|-", "perl Build.PL $mb_destdir --install_base=$prefix --install_path lib=$prefix/lib  --install_path arch=$prefix/lib/$Config{archname} --install_path bin=$prefix/bin --install_path script=$prefix/bin --install_path bindoc=$prefix/man/man1 --install_path libdoc=$prefix/man/man3" ) || die "Can't run perl Build.PL";
+                open( CMD, "|-", "@PERL@ Build.PL $mb_destdir --install_base=$prefix --install_path lib=$prefix/lib  --install_path arch=$prefix/lib/$Config{archname} --install_path bin=$prefix/bin --install_path script=$prefix/bin --install_path bindoc=$prefix/man/man1 --install_path libdoc=$prefix/man/man3" ) || die "Can't run perl Build.PL";
                 $command = "./Build";
                 $command = "./Build";
             }
             }
             elsif ( -f 'Makefile.PL' ) {
             elsif ( -f 'Makefile.PL' ) {
-                open( CMD, "|-", "perl Makefile.PL $mm_destdir INSTALL_BASE=$prefix INSTALLDIRS=site INSTALLSITELIB=$prefix/lib INSTALLSITEARCH=$prefix/lib/$Config{archname} $extra_args" ) || die "Can't run perl Makefile.PL";
+                open( CMD, "|-", "@PERL@ Makefile.PL $mm_destdir INSTALL_BASE=$prefix INSTALLDIRS=site INSTALLSITELIB=$prefix/lib INSTALLSITEARCH=$prefix/lib/$Config{archname} $extra_args" ) || die "Can't run perl Makefile.PL";
                 $command = "make";
                 $command = "make";
             }
             }
             else {
             else {