summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 01:20:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 01:20:09 +0000
commit018433a6da60c6395baaaa0833d5c50ac6645552 (patch)
tree2012deeff2f98b267c0c10425c1d4a054190b73f
parentInitial commit. (diff)
downloadnagios-nrpe-018433a6da60c6395baaaa0833d5c50ac6645552.tar.xz
nagios-nrpe-018433a6da60c6395baaaa0833d5c50ac6645552.zip
Adding upstream version 3.2.1.upstream/3.2.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--.gitignore41
-rw-r--r--.travis.yml10
-rw-r--r--CHANGELOG.md503
-rw-r--r--LEGAL10
-rw-r--r--LICENSE.md264
-rw-r--r--Makefile.in201
-rw-r--r--README.SSL.md290
-rw-r--r--README.md292
-rw-r--r--SECURITY.md123
-rw-r--r--THANKS54
-rwxr-xr-xaclocal.m47
-rwxr-xr-xbuild-aux/config.guess1431
-rwxr-xr-xbuild-aux/config.sub1807
-rwxr-xr-xbuild-aux/custom_help.m4131
-rwxr-xr-xbuild-aux/install-sh501
-rwxr-xr-xconfigure9113
-rw-r--r--configure.ac397
-rw-r--r--contrib/README.nrpe_check_control64
-rw-r--r--contrib/nrpe_check_control.c121
-rw-r--r--docs/NRPE.odtbin0 -> 114906 bytes
-rw-r--r--docs/NRPE.pdfbin0 -> 221212 bytes
-rw-r--r--include/acl.h73
-rw-r--r--include/common.h.in106
-rw-r--r--include/config.h.in354
-rw-r--r--include/nrpe.h69
-rw-r--r--include/utils.h53
-rw-r--r--macros/.gitignore1
-rw-r--r--macros/CHANGELOG.md7
-rw-r--r--macros/LICENSE264
l---------macros/LICENSE.md1
-rw-r--r--macros/README.md199
-rwxr-xr-xmacros/add_group_user140
-rw-r--r--macros/ax_nagios_get_distrib160
-rw-r--r--macros/ax_nagios_get_files131
-rw-r--r--macros/ax_nagios_get_inetd146
-rw-r--r--macros/ax_nagios_get_init200
-rw-r--r--macros/ax_nagios_get_os101
-rw-r--r--macros/ax_nagios_get_paths738
-rw-r--r--macros/ax_nagios_get_ssl303
-rw-r--r--nrpe.spec.in208
-rwxr-xr-xpaths.in85
-rw-r--r--sample-config/nrpe.cfg.in361
-rw-r--r--src/Makefile.in87
-rw-r--r--src/acl.c705
-rw-r--r--src/check_nrpe.c1633
-rw-r--r--src/nrpe.c2907
-rw-r--r--src/snprintf.c1452
-rw-r--r--src/utils.c590
-rw-r--r--startup/bsd-init.in90
-rw-r--r--startup/debian-init.in47
-rw-r--r--startup/default-inetd.in5
-rw-r--r--startup/default-init.in157
-rw-r--r--startup/default-service.in24
-rw-r--r--startup/default-socket-svc.in16
-rw-r--r--startup/default-socket.in12
-rw-r--r--startup/default-xinetd.in15
-rw-r--r--startup/gentoo-init.in49
-rw-r--r--startup/mac-inetd.plist.in40
-rw-r--r--startup/mac-init.plist.in32
-rw-r--r--startup/newbsd-init.in35
-rw-r--r--startup/openbsd-init.in18
-rw-r--r--startup/openrc-conf.in7
-rw-r--r--startup/openrc-init.in17
-rw-r--r--startup/rh-upstart-init.in17
-rw-r--r--startup/solaris-inetd.xml.in90
-rw-r--r--startup/solaris-init.xml.in143
-rw-r--r--startup/tmpfile.conf.in2
-rw-r--r--startup/upstart-init.in19
-rwxr-xr-xtest-wrapper3
-rwxr-xr-xtravis-test-134
-rwxr-xr-xuninstall.in417
-rwxr-xr-xupdate-cfg.pl144
-rwxr-xr-xupdate-version83
73 files changed, 27950 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..ae5bfca
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,41 @@
+Makefile
+config.log
+config.status
+include/config.h
+include/common.h
+include/dh.h
+nrpe.spec
+paths
+uninstall
+.cproject
+.project
+nrpe.cbp
+nrpe.layout
+package/solaris/Makefile
+sample-config/nrpe.cfg
+src/Makefile
+src/check_nrpe
+src/nrpe
+autom4te.cache/
+nbproject/
+.settings/
+startup/bsd-init
+startup/debian-init
+startup/default-inetd
+startup/default-init
+startup/default-service
+startup/default-socket
+startup/default-socket-svc
+startup/default-xinetd
+startup/mac-init.plist
+startup/mac-inetd.plist
+startup/newbsd-init
+startup/openbsd-init
+startup/openrc-conf
+startup/openrc-init
+startup/rh-upstart-init
+startup/solaris-inetd.xml
+startup/solaris-init.xml
+startup/tmpfile.conf
+startup/upstart-init
+
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..1496fc0
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,10 @@
+
+
+language: c
+sudo: enabled
+dist:
+ - trusty
+compiler:
+ - clang
+ - gcc
+script: ./configure && make all && sudo ./test-wrapper
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..1029755
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,503 @@
+NRPE Changelog
+==============
+
+[3.2.1](https://github.com/NagiosEnterprises/nrpe/releases/tag/nrpe-3.2.1) - 2017-08-31
+---------------------------------------------------------------------------------------
+**FIXES**
+* Change seteuid error messages to warning/debug (Bryan Heden)
+* Fix segfault when no nrpe_user is specified (Stephen Smoogen, Bryan Heden)
+* Added additional strings to error messages to remove duplicates (Bryan Heden)
+* Fix nrpe.spec for rpmbuild (Bryan Heden)
+* Fix error for drop_privileges when using inetd (xalasys-luc, Bryan Heden)
+
+
+[3.2.0](https://github.com/NagiosEnterprises/nrpe/releases/tag/nrpe-3.2.0) - 2017-06-26
+---------------------------------------------------------------------------------------
+**ENHANCEMENTS**
+* Added max_commands definition to nrpe.cfg to rate limit simultaneous fork()ed children (Bryan Heden)
+* Added -E, --stderr-to-stdout options for check_nrpe to redirect output (Bryan Heden)
+* Added support for Gentoo init (Troy Lea @box293)
+* Cleaned up code a bit, updated readmes and comments across the board (Bryan Heden)
+* Added -V, --version to nrpe and fixed the output (Bryan Heden)
+* Added different SSL error messages to be able to pinpoint where some SSL errors occured (Bryan Heden)
+* Updated logic in al parse_allowed_hosts (Bryan Heden)
+* Added builtin OpenSSL Engine support where available (Bryan Heden + @skrueger8)
+* Clean up compilation warnings (Bryan Heden)
+* Added more commented commands in nrpe.cfg (Bryan Heden)
+
+**FIXES**
+* Undefined check returns UNKNOWN (Bryan Heden)
+* Fix incompatibility with OpenSSL 1.1.0 via SECLEVEL distinction (Bryan Heden)
+* Fix ipv4 error in logfile even if address is ipv6 (Bryan Heden)
+* Fix improper valid/invalid certificate warnings (Bryan Heden)
+
+[3.1.1](https://github.com/NagiosEnterprises/nrpe/releases/tag/nrpe-3.1.1) - 2017-05-24
+---------------------------------------------------------------------------------------
+**FIXES**
+* The '--log-file=' or '-g' option is missing from the help (John Frickson)
+* check_nrpe = segfault when specifying a config file (John Frickson)
+* Alternate log file not being used soon enough (John Frickson)
+* Unable to compile v3.1.0rc1 with new SSL checks on rh5 (John Frickson)
+* Unable to compile nrpe-3.1.0 - undefined references to va_start, va_end (John Frickson)
+* Can't build on Debian Stretch, openssl 1.1.0c (John Frickson)
+* Fix build failure with -Werror=format-security (Bas Couwenberg)
+* Fixed a typo in `nrpe.spec.in` (John Frickson)
+* More detailed error logging for SSL (John Frickson)
+* Fix infinite loop when unresolvable host is in allowed_hosts (Nick / John Frickson)
+
+[3.1.0](https://github.com/NagiosEnterprises/nrpe/releases/tag/nrpe-3.1.0) - 2017-04-17
+---------------------------------------------------------------------------------------
+**ENHANCEMENTS**
+* Added option to nrpe.cfg.in that can override hard-coded NASTY_METACHARS (John Frickson)
+* While processing 'include_dir' statement, sort the files (Philippe Kueck / John Frickson)
+* nrpe can now write to a log file using 'log_file=' in nrpe.cfg (John Frickson)
+* check_nrpe can now write to a log file using '--log-file=' or '-g' options (John Frickson)
+
+**FIXES**
+* Added missing debugging syslog entries, and changed printf()'s to syslog()'s. (Jobst Schmalenbach)
+* Fix help output for ssl option (configure) (Ruben Kerkhof)
+* Fixes to README.SSL.md and SECURITY.md (Elan Ruusamäe)
+* Changed the 'check_load' command in nrpe.cfg.in (minusdavid)
+* Cleanup of config.h.in suggested by Ruben Kerkhof
+* Minor change to logging in check_nrpe (John Frickson)
+* Solaris 11 detection is broken in configure (John Frickson)
+* Removed function `b64_decode` which wasn't being used (John Frickson)
+* check_nrpe ignores -a option when -f option is specified (John Frickson)
+* Added missing LICENSE file (John Frickson)
+* Off-by-one BO in my_system() (John Frickson)
+* Got rid of some compiler warnings (Stefan Krüger / John Frickson)
+* Add SOURCE_DATE_EPOCH specification support for reproducible builds. (Bas Couwenberg)
+* nrpe 3.0.1 allows TLSv1 and TLSv1.1 when I configure for TLSv1.2+ (John Frickson)
+* "Remote %s accepted a Version %s Packet", please add to debug (John Frickson)
+* nrpe 3.0.1 segfaults when key and/or cert are broken symlinks (John Frickson)
+* Fixed a couple of typos in docs/NRPE.* files (Ludmil Meltchev)
+* Changed release date to ISO format (yyyy-mm-dd) (John Frickson)
+* Fix systemd unit description (Bas Couwenberg)
+* Add reload command to systemd service file (Bas Couwenberg)
+* fix file not found error when updating version (Sven Nierlein)
+* Spelling fixes (Josh Soref)
+* Return UNKNOWN when check_nrpe cannot communicate with nrpe and -u set (John Frickson)
+* xinetd.d parameter causes many messages in log file (John Frickson)
+* Fixes for openssl 1.1.x (Stephen Smoogen / John Frickson)
+* PATH and other environment variables not set with numeric nrpe_user (John Frickson)
+* rpmbuild -ta nrpe-3.0.1.tar.gz failed File not found: /etc/init.d/nrpe (bvandi / John Frickson)
+
+[3.0.1](https://github.com/NagiosEnterprises/nrpe/releases/tag/nrpe-3.0.1) - 2016-09-08
+---------------------------------------------------------------------------------------
+**FIXES**
+* _set_rc: command not found reported by init script (John Frickson)
+* Version string contains name (John Frickson)
+* Changes to get 'rpmbuild' to work - nrpe.spec file outdated (John Frickson)
+* typo in startup/default-xinetd.in (Philippe Kueck)
+* debug output missing command name (Philippe Kueck)
+* /usr/lib/tmpfiles.d/ndo2db.conf should have 'd' type, not 'D' (John Frickson)
+* Fixes in parse_allowed_hosts() and called functions (Jobst Schmalenbach / John Frickson)
+* nrpe.cfg: 'debug' statement needs to be first in file (Jobst Schmalenbach / John Frickson)
+
+[3.0.0](https://github.com/NagiosEnterprises/nrpe/releases/tag/nrpe-3.0.0) - 2016-08-01
+---------------------------------------------------------------------------------------
+**SECURITY**
+* Fix for CVE-2014-2913
+* Added function to clean the environment before forking. (John Frickson)
+
+**ENHANCEMENTS**
+* Added support for optional config file to check_nrpe. With the new SSL
+ parameters, the line was getting long. The config file is specified with
+ --config-file=<path> or -f <path> parameters. The config file must look
+ like command line options, but the options can be on separate lines. It
+ MUST NOT include --config-file (-f), --command (-c) or --args (-a). If any
+ options are in both the config file and on the command line, the command line
+ options are used.
+* make can now add users and groups using "make install-groups-users" (John Frickson)
+* Added "nrpe-uninstall" script to the same directory nrpe get installed to (John Frickson)
+* Updated code so configure && make will work on AIX, HP-UX, Solaris, OS X.
+ There should be no errors or warnings. Let me know if any errors or
+ warning appear (John Frickson)
+* Added command-line option to prevent forking, since some of the init
+ replacements (such as systemd, etc.) don't want daemons to fork (John Frickson)
+* Added autoconf macros and additional files to better support multi-platform
+ config and compile. The default will still set up to install to
+ /usr/local/nagios but I added a new configure option:
+ '--enable-install-method=<method>'. If <method> is 'opt', everything will
+ install to '/opt/nagios'. If <method> is 'os', installation will be to O/S-
+ and distribution-specific locations, such as /usr/sbin, /usr/lib/nagios,
+ /etc/nagios, and so on.
+* Added additional init and inetd config files to support more systems,
+ including SuSE, Debian, Slackware, Gentoo, *BSD, AIX, HP-UX, Solaris, OS X.
+* Added listen_queue_size as configuration option (Vadim Antipov, Kaspersky Lab)
+* Reworked SSL/TLS. See the README.SSL.md file for full info. (John Frickson)
+* Added support for version 3 variable sized packets up to 64KB. nrpe will
+ accept either version from check_nrpe. check_nrpe will try to send a
+ version 3 packet first, and fall back to version 2. check_nrpe can be forced
+ to only send version 2 packets if the switch `-2` is used. (John Frickson)
+* Added extended timeout syntax in the -t <secs>:<status> format. (ABrist)
+
+**FIXES**
+* Fixed configure to check more places for SSL headers/libs. (John Frickson)
+* Added ifdefs for complete_SSL_shutdown to compile without SSL. (Matthew L. Daniel)
+* Renamed configure.in to configure.ac and added check for sigaction (John Frickson)
+* Replaced all instances of signal() with sigaction() + blocking (John Frickson)
+* check_nrpe does not parse passed arguments correctly (John Frickson)
+* NRPE should not start if cannot write pid file (John Frickson)
+* Fixed out-of-bounds error (return code 255) for some failures (John Frickson)
+* Connection Timeout and Connection Refused messages need a new line (Andrew Widdersheim)
+* allowed_hosts doesn't work, if one of the hostnames can't be resolved by dns (John Frickson)
+* allowed_hosts doesn't work with a hostname resolving to an IPv6 address (John Frickson)
+* Return UNKNOWN when issues occur (Andrew Widdersheim)
+* NRPE returns OK if check can't be executed (Andrew Widdersheim)
+* nrpe 2.15 [regression in Added SRC support on AIX - 2.14] (frphoebus)
+* compile nrpe - Solaris 9 doesn't have isblank() (lilo, John Frickson)
+* sample configuration for check_load has crazy sample load avg (ernestoongaro)
+
+
+2.15 - 09/06/2013
+-----------------
+* Now compiles on HP-UX (Grant Byers)
+* Added support for IPv6 (Leo Baltus, Eric Stanley)
+
+
+
+2.14 - 12/21/2012
+-----------------
+* Added configure option to allow bash command substitutions, disabled by default [bug #400] (Eric Stanley)
+* Patched to shutdown SSL connection completely (Jari Takkala)
+* Added SRC support on AIX (Thierry Bertaud)
+* Updated RPM SPEC file to support creating RPMs on AIX (Eric Stanley)
+* Updated logging to support compiling on AIX (Eric Stanley)
+
+
+
+2.13 - 11/11/2011
+-----------------
+* Applied Kaspersky Labs supplied patch for extending allowed_hosts (Konstantin Malov)
+* Fixed bug in allowed_hosts parsing (Eric Stanley)
+* Updated to support compiling on Solaris 10 (thanks to Kevin Pendleton)
+
+
+
+2.12 - 03/10/2008
+-----------------
+* Fix for unterminated multiline plugin (garbage) output (Krzysztof Oledzki)
+
+
+
+2.11 - 12/26/2007
+-----------------
+* Added lib64 library paths to configure script for 64-bit systems (John Maag)
+* Added --with-ssl-lib configure script option
+* Added --with-log-facility option to control syslog logging (Ryan Ordway and Brian Seklecki)
+
+
+
+2.10 - 10/19/2007
+-----------------
+* Moved PDF docs to docs/ subdirectory, added OpenOffice source document
+* A critical result is now returned for child processed that die due to a signal (Klas Lindfors)
+
+
+
+2.9 - 08/13/2007
+----------------
+* Fixed bug with --with-nrpe-group configure script option (Graham Collinson)
+* Fixed bug with check_disk thresholds in sample config file (Patric Wust)
+* Added NRPE_PROGRAMVERSION and NRPE_MULTILINESUPPORT environment variables
+ for scripts that need to detect NRPE version and capabilities (Gerhard Lausser)
+* Added asprintf() support for systems that are missing it (Samba team)
+
+
+
+2.8.1 - 05/10/2007
+-----------------
+* Fixed configure script error with user-specified NRPE group
+
+
+
+2.8 - 05/08/2007
+---------------
+* Added support for multiline plugin output (limited to 1KB at the moment) (Matthias Flacke)
+
+
+
+2.8b1 - 03/14/2007
+-----------------
+* Changes to sample config files
+* Added ';' as an additional prohibited metachar for command arguments
+* Updated documentation and added easier installation commands
+
+
+
+2.7.1 - 03/08/2007
+------------------
+* Changed C++ style comment to C style to fix compilation errors on AIX (Ryan McGarry)
+
+
+
+2.7 - 02/18/2007
+----------------
+* Patches for detection SSL header and library locations (Andrew Boyce-Lewis)
+* NRPE daemon will now partially ignore non-fatal configuration file errors and attempt to startup (Andrew Boyce-Lewis)
+
+
+
+2.6 - 12/11/2006
+----------------
+* Added -u option to check_nrpe to return UNKNOWN states on socket timeouts (Bjoern Beutel)
+* Added connection_timeout variable to NRPE daemon to catch dead client connections (Ton Voon)
+* Added graceful timeout to check_nrpe to ensure connection to NRPE daemon is properly closed (Mark Plaksin)
+
+
+
+2.5.2 - 06/30/2006
+------------------
+* Fixed incorrect service name in sample xinetd config file
+* Added note on how to restart inetd for OpenBSD users (Robert Peaslee)
+* Fix for nonblocking accept()s on systems that define EAGAIN differently than EWOULDBLOCK (Gerhard Lausser)
+* Fix to (re)allow week random seed (Gerhard Lausser)
+
+
+
+2.5.1 - 04/09/2006
+------------------
+* Patch to fix segfault if --no-ssl option is used (Sean Finney/Peter Palfrader)
+
+
+
+2.5 - 04/06/2006
+----------------
+* (Re)added allowed_hosts option for systems that don't support TCP wrappers
+* Fix for SSL errors under Solaris 8 (Niels Endres)
+* Fix for config file directory inclusion on ReiserFS (Gerhard Lausser)
+
+
+
+2.4 - 02/22/2006
+----------------
+* Added option to allow week random seed (Gerhard Lausser)
+* Added optional command line prefix (Sean Finney)
+* Added ability to reload config file with SIGHUP
+* Fixed bug with location of dh.h include file
+* Fixed bug with disconnect message in debug mode
+
+
+
+2.3 - 01/23/2006
+----------------
+* Spec file fixes
+* Removed errant PID file debugging code
+* Fixed problem with trimming command definitions
+
+
+
+2.2 - 01/22/2006
+----------------
+* Spec file fix
+* Patch to add Tru64 and IRIX support (Ton Voon)
+* Updated config.sub and config.guess
+* Fixed bug with config file lines with only whitespace
+* Fixed bug with missing getopt() command line option for -V
+* Removed sample FreeBSD init script (now maintained by FreeBSD port)
+* Added config file option for writing a PID file
+
+
+
+2.1 - 01/19/2004
+----------------
+* Replaced host access list with TCP wrapper support
+* Removed length restrictions for command names and command lines
+* Configure script patch for getopt_long on Solaris
+* Bug fixes for accept() on HP-UX 11.0
+* Init script for SUSE Linux (Subhendu Ghosh)
+* SSL protocol used is now limited to TLSv1
+* Any output from plugins after first line is now ignored before
+ plugin process is closed
+
+
+
+2.0 - 09/08/2003
+----------------
+* Added support for passing arguments to command
+* NRPE daemon can no longer be run as root user/group
+* Added getopt support
+* Added 'include' variable to config file to allow inclusion
+ of external config files
+* Added 'include_dir' variable to allow inclusion of external
+ config files in directories (with recursion)
+* Added native SSL support (Derrick Bennett)
+* Added my_strsep(), as Solaris doesn't have strsep()
+* Added license exemption for use with OpenSSL
+
+
+
+1.8 - 01/16/2003
+----------------
+* Daemon now closes stdio/out/err properly (James Peterson)
+* Makefile changes (James Peterson)
+* Mode command line option bug fix in daemon
+* Fixed incorrect command line options in check_nrpe plugin
+
+
+
+1.7 - 01/08/2003
+----------------
+* Spec file updates and minor bug fixes (James Peterson)
+* Bug fix with default nrpe port definition
+* Added sample xinetd config file (nrpe.xinetd)
+* Bug fix for command_timeout variable (James Peterson)
+
+
+
+1.6 - 12/30/2002
+----------------
+* Updated sample commands to match new plugin argument format
+* Added sample init scripts for FreeBSD and Debian (Andrew Ryder)
+* Syntax changes (-H option specifies host name in check_nrpe,
+ -c option specifies config file in nrpe)
+* Added command_timeout directive to config file to allow user
+ to specify timeout for executing plugins
+* Added spec file and misc patches for building RPMs (James Peterson)
+* Added --with-nrpe-port config directive (James Peterson)
+
+
+
+1.5 - 06/03/2002
+----------------
+* Added setuid/setgid option to config file (suggested by Marek Cervenka)
+
+
+
+1.4 - 06/01/2002
+----------------
+* Changed STATE_UNKNOWN to value of 3 instead of -1 (old style)
+* Minor doc and sample config file changes
+
+
+
+1.3 - 02/21/2002
+----------------
+* Name and version change
+* Ignore SIGHUP, minor cleanup (Jon Andrews)
+
+
+
+1.2.5 - 12/22/2001
+------------------
+* Implemented Beej's sendall() to handle partial send()s
+* Added instructions on running under xinetd to README
+* Removed some old crud
+
+
+
+1.2.4 - 02/22/2001
+------------------
+* I forgot what changes I made. Go figure...
+
+
+
+1.2.3 - 12/21/2000
+------------------
+* A bit more documentation on configuring command definitions for the plugin
+
+
+
+1.2.2 - 06/05/2000
+------------------
+* Fixed error in docs for running under inetd using TCP wrappers
+* Replaced old email address in src/netutils.h with new one
+
+
+
+1.2.1 - 05/07/2000
+------------------
+* Removed trapping of SIGCHLD
+* Changed wait4() to waitpid() to allow compilation on HP-UX and AIX
+
+
+
+1.2.0 - 04/18/2000
+------------------
+* Server forks twice after accepting a client connection, so as to prevent the
+ creation of zombies
+
+
+
+1.1.5 - 04/07/2000
+------------------
+* Fixed a small bug where one debug message was not getting logged properly
+
+
+
+1.1.4 - 03/30/2000
+------------------
+* Added option to disable/enable debug messages using the debug option in the
+ config file
+
+
+
+1.1.3 - 03/11/2000
+------------------
+* Changed config file to use an absolute path
+* Changed all debug output to use syslog (Rene Klootwijk)
+* No convert all data to network order before sending it and convert it back to
+ host order when receiving it. This makes it possible to mix Solaris and Linux,
+ e.g. running check_nrpe on Linux and nrpe on Solaris. (Rene Klootwijk)
+
+
+
+1.1.2 - 03/07/2000
+------------------
+* Removed unnecessary code in signal handler routine
+* Unused signals are no longer trapper
+
+
+
+1.1.1 - 02/28/2000 - RKL
+---------------------------
+* Modified syslog code to include string describing the error code.
+* Changed hardcoded number in signal handler to its name. This prevented nrpe
+ to run on Solaris.
+* Fixed race condition in accept loop. The result of accept should also be
+ checked for EINTR.
+* Modified recv and send function calls to compile without warnings on Solaris.
+* Modified configure.in,configure and Makefile.in to include nsl and socket libs
+ for Solaris.
+* Modified the signal handler to reestablish itself after being called.
+
+
+
+1.1 - 02/24/2000 - Rene Klootwijk <rene@klootwijk.org>
+-----------------
+* Added ability to bind nrpe to a specific interface by specifying the address
+ of this interface in the nrpe.cfg file (e.g. server_address=192.168.2.3)
+
+
+
+1.0 - 02/16/2000
+------------------
+* Added ability to run as a service under inetd
+
+
+
+1.0b6 - 02/01/2000
+------------------
+* Added configure script
+* Netutils functions from the NetSaint plugins is now used
+* Reset SIGCHLD to default behavior before calling popen() to
+ prevent race condition with pclose() (Reported by Rene Klootwijk)
+* Cleaned up code
+
+
+
+1.0b5 - 01/10/2000
+------------------
+* Added init script contributed by Jacob L
+* Incorporated syslog code and other patches contributed by Jacob L
+
+
+
+1.0b4 - 11/04/1999
+------------------
+* Changed 'allowed_ip' option in configuration file to
+ 'allowed_hosts' and added support for multiple hosts
+* Minor buffer overflow protection fixes
+* main() returned STATE_UNKNOWN on successful launch, changed to STATE_OK (jaclu@grm.se)
+* Added syslog support (jaclu@grm.se)
diff --git a/LEGAL b/LEGAL
new file mode 100644
index 0000000..ed59a7d
--- /dev/null
+++ b/LEGAL
@@ -0,0 +1,10 @@
+
+All source code, binaries, documentation, and information contained
+in this distribution are provided AS IS with NO WARRANTY OF ANY KIND,
+INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY, AND FITNESS FOR
+A PARTICULAR PURPOSE.
+
+Nagios and the Nagios logo are registered trademarks of Nagios Enterprises.
+All other trademarks, servicemarks, registered trademarks, and
+registered servicemarks are the property of their respective owner(s).
+
diff --git a/LICENSE.md b/LICENSE.md
new file mode 100644
index 0000000..a983462
--- /dev/null
+++ b/LICENSE.md
@@ -0,0 +1,264 @@
+The GNU General Public License, Version 2, June 1991 (GPLv2)
+============================================================
+
+> Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+> 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+Everyone is permitted to copy and distribute verbatim copies of this license
+document, but changing it is not allowed.
+
+
+Preamble
+--------
+
+The licenses for most software are designed to take away your freedom to share
+and change it. By contrast, the GNU General Public License is intended to
+guarantee your freedom to share and change free software--to make sure the
+software is free for all its users. This General Public License applies to most
+of the Free Software Foundation's software and to any other program whose
+authors commit to using it. (Some other Free Software Foundation software is
+covered by the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+When we speak of free software, we are referring to freedom, not price. Our
+General Public Licenses are designed to make sure that you have the freedom to
+distribute copies of free software (and charge for this service if you wish),
+that you receive source code or can get it if you want it, that you can change
+the software or use pieces of it in new free programs; and that you know you can
+do these things.
+
+To protect your rights, we need to make restrictions that forbid anyone to deny
+you these rights or to ask you to surrender the rights. These restrictions
+translate to certain responsibilities for you if you distribute copies of the
+software, or if you modify it.
+
+For example, if you distribute copies of such a program, whether gratis or for a
+fee, you must give the recipients all the rights that you have. You must make
+sure that they, too, receive or can get the source code. And you must show them
+these terms so they know their rights.
+
+We protect your rights with two steps: (1) copyright the software, and (2) offer
+you this license which gives you legal permission to copy, distribute and/or
+modify the software.
+
+Also, for each author's protection and ours, we want to make certain that
+everyone understands that there is no warranty for this free software. If the
+software is modified by someone else and passed on, we want its recipients to
+know that what they have is not the original, so that any problems introduced by
+others will not reflect on the original authors' reputations.
+
+Finally, any free program is threatened constantly by software patents. We wish
+to avoid the danger that redistributors of a free program will individually
+obtain patent licenses, in effect making the program proprietary. To prevent
+this, we have made it clear that any patent must be licensed for everyone's free
+use or not licensed at all.
+
+The precise terms and conditions for copying, distribution and modification
+follow.
+
+
+Terms And Conditions For Copying, Distribution And Modification
+---------------------------------------------------------------
+
+**0.** This License applies to any program or other work which contains a notice
+placed by the copyright holder saying it may be distributed under the terms of
+this General Public License. The "Program", below, refers to any such program or
+work, and a "work based on the Program" means either the Program or any
+derivative work under copyright law: that is to say, a work containing the
+Program or a portion of it, either verbatim or with modifications and/or
+translated into another language. (Hereinafter, translation is included without
+limitation in the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not covered by
+this License; they are outside its scope. The act of running the Program is not
+restricted, and the output from the Program is covered only if its contents
+constitute a work based on the Program (independent of having been made by
+running the Program). Whether that is true depends on what the Program does.
+
+**1.** You may copy and distribute verbatim copies of the Program's source code
+as you receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice and
+disclaimer of warranty; keep intact all the notices that refer to this License
+and to the absence of any warranty; and give any other recipients of the Program
+a copy of this License along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and you may at
+your option offer warranty protection in exchange for a fee.
+
+**2.** You may modify your copy or copies of the Program or any portion of it,
+thus forming a work based on the Program, and copy and distribute such
+modifications or work under the terms of Section 1 above, provided that you also
+meet all of these conditions:
+
+* **a)** You must cause the modified files to carry prominent notices stating
+ that you changed the files and the date of any change.
+
+* **b)** You must cause any work that you distribute or publish, that in whole
+ or in part contains or is derived from the Program or any part thereof, to
+ be licensed as a whole at no charge to all third parties under the terms of
+ this License.
+
+* **c)** If the modified program normally reads commands interactively when
+ run, you must cause it, when started running for such interactive use in the
+ most ordinary way, to print or display an announcement including an
+ appropriate copyright notice and a notice that there is no warranty (or
+ else, saying that you provide a warranty) and that users may redistribute
+ the program under these conditions, and telling the user how to view a copy
+ of this License. (Exception: if the Program itself is interactive but does
+ not normally print such an announcement, your work based on the Program is
+ not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If identifiable
+sections of that work are not derived from the Program, and can be reasonably
+considered independent and separate works in themselves, then this License, and
+its terms, do not apply to those sections when you distribute them as separate
+works. But when you distribute the same sections as part of a whole which is a
+work based on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the entire whole,
+and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest your
+rights to work written entirely by you; rather, the intent is to exercise the
+right to control the distribution of derivative or collective works based on the
+Program.
+
+In addition, mere aggregation of another work not based on the Program with the
+Program (or with a work based on the Program) on a volume of a storage or
+distribution medium does not bring the other work under the scope of this
+License.
+
+**3.** You may copy and distribute the Program (or a work based on it, under
+Section 2) in object code or executable form under the terms of Sections 1 and 2
+above provided that you also do one of the following:
+
+* **a)** Accompany it with the complete corresponding machine-readable source
+ code, which must be distributed under the terms of Sections 1 and 2 above on
+ a medium customarily used for software interchange; or,
+
+* **b)** Accompany it with a written offer, valid for at least three years, to
+ give any third party, for a charge no more than your cost of physically
+ performing source distribution, a complete machine-readable copy of the
+ corresponding source code, to be distributed under the terms of Sections 1
+ and 2 above on a medium customarily used for software interchange; or,
+
+* **c)** Accompany it with the information you received as to the offer to
+ distribute corresponding source code. (This alternative is allowed only for
+ noncommercial distribution and only if you received the program in object
+ code or executable form with such an offer, in accord with Subsection b
+ above.)
+
+The source code for a work means the preferred form of the work for making
+modifications to it. For an executable work, complete source code means all the
+source code for all modules it contains, plus any associated interface
+definition files, plus the scripts used to control compilation and installation
+of the executable. However, as a special exception, the source code distributed
+need not include anything that is normally distributed (in either source or
+binary form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component itself
+accompanies the executable.
+
+If distribution of executable or object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the source code
+from the same place counts as distribution of the source code, even though third
+parties are not compelled to copy the source along with the object code.
+
+**4.** You may not copy, modify, sublicense, or distribute the Program except as
+expressly provided under this License. Any attempt otherwise to copy, modify,
+sublicense or distribute the Program is void, and will automatically terminate
+your rights under this License. However, parties who have received copies, or
+rights, from you under this License will not have their licenses terminated so
+long as such parties remain in full compliance.
+
+**5.** You are not required to accept this License, since you have not signed
+it. However, nothing else grants you permission to modify or distribute the
+Program or its derivative works. These actions are prohibited by law if you do
+not accept this License. Therefore, by modifying or distributing the Program (or
+any work based on the Program), you indicate your acceptance of this License to
+do so, and all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+**6.** Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the original
+licensor to copy, distribute or modify the Program subject to these terms and
+conditions. You may not impose any further restrictions on the recipients'
+exercise of the rights granted herein. You are not responsible for enforcing
+compliance by third parties to this License.
+
+**7.** If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues), conditions
+are imposed on you (whether by court order, agreement or otherwise) that
+contradict the conditions of this License, they do not excuse you from the
+conditions of this License. If you cannot distribute so as to satisfy
+simultaneously your obligations under this License and any other pertinent
+obligations, then as a consequence you may not distribute the Program at all.
+For example, if a patent license would not permit royalty-free redistribution of
+the Program by all those who receive copies directly or indirectly through you,
+then the only way you could satisfy both it and this License would be to refrain
+entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply and the
+section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any patents or
+other property right claims or to contest validity of any such claims; this
+section has the sole purpose of protecting the integrity of the free software
+distribution system, which is implemented by public license practices. Many
+people have made generous contributions to the wide range of software
+distributed through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing to
+distribute software through any other system and a licensee cannot impose that
+choice.
+
+This section is intended to make thoroughly clear what is believed to be a
+consequence of the rest of this License.
+
+**8.** If the distribution and/or use of the Program is restricted in certain
+countries either by patents or by copyrighted interfaces, the original copyright
+holder who places the Program under this License may add an explicit
+geographical distribution limitation excluding those countries, so that
+distribution is permitted only in or among countries not thus excluded. In such
+case, this License incorporates the limitation as if written in the body of this
+License.
+
+**9.** The Free Software Foundation may publish revised and/or new versions of
+the General Public License from time to time. Such new versions will be similar
+in spirit to the present version, but may differ in detail to address new
+problems or concerns.
+
+Each version is given a distinguishing version number. If the Program specifies
+a version number of this License which applies to it and "any later version",
+you have the option of following the terms and conditions either of that version
+or of any later version published by the Free Software Foundation. If the
+Program does not specify a version number of this License, you may choose any
+version ever published by the Free Software Foundation.
+
+**10.** If you wish to incorporate parts of the Program into other free programs
+whose distribution conditions are different, write to the author to ask for
+permission. For software which is copyrighted by the Free Software Foundation,
+write to the Free Software Foundation; we sometimes make exceptions for this.
+Our decision will be guided by the two goals of preserving the free status of
+all derivatives of our free software and of promoting the sharing and reuse of
+software generally.
+
+
+No Warranty
+-----------
+
+**11.** BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
+THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
+STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM
+"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+**12.** IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
+INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
+BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER
+OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. \ No newline at end of file
diff --git a/Makefile.in b/Makefile.in
new file mode 100644
index 0000000..60b7d13
--- /dev/null
+++ b/Makefile.in
@@ -0,0 +1,201 @@
+###############################
+#
+# NRPE Makefile
+#
+###############################
+
+# Source code directories
+SRC_BASE=./src/
+SRC_INCLUDE=./include/
+
+# Mainly used for rpmbuild
+# DESTDIR=
+
+CC=@CC@
+CFLAGS=@CFLAGS@ @DEFS@
+LDFLAGS=@LDFLAGS@ @LIBS@
+
+INSTALL=@INSTALL@
+GREP=@GREP@
+EGREP=@EGREP@
+
+prefix=$(DESTDIR)@prefix@
+exec_prefix=$(DESTDIR)@exec_prefix@
+CFGDIR=$(DESTDIR)@pkgsysconfdir@
+BINDIR=$(DESTDIR)@bindir@
+SBINDIR=$(DESTDIR)@sbindir@
+LIBEXECDIR=$(DESTDIR)@libexecdir@
+NAGIOS_INSTALL_OPTS=@NAGIOS_INSTALL_OPTS@
+NRPE_INSTALL_OPTS=@NRPE_INSTALL_OPTS@
+OPSYS=@opsys@
+DIST=@dist_type@
+NRPE_USER=@nrpe_user@
+NRPE_GROUP=@nrpe_group@
+NAGIOS_USER=@nagios_user@
+NAGIOS_GROUP=@nagios_group@
+
+INIT_TYPE=@init_type@
+INIT_DIR=$(DESTDIR)@initdir@
+INIT_OPTS=-o root -g root
+INIT_FILE=@initname@
+INETD_TYPE=@inetd_type@
+INETD_DIR=$(DESTDIR)@inetddir@
+INETD_FILE=@inetdname@
+SRC_INETD=@src_inetd@
+SRC_INIT=@src_init@
+
+
+default:
+ @echo;\
+ echo Please enter 'make [option]' where [option] is one of:;\
+ echo;\
+ echo " all builds nrpe and check_nrpe";\
+ echo " nrpe builds nrpe only";\
+ echo " check_nrpe builds check_nrpe only";\
+ echo " install-groups-users add the users and groups if they do not exist";\
+ echo " install install nrpe and check_nrpe";\
+ echo " install-plugin install the check_nrpe plugin";\
+ echo " install-daemon install the nrpe daemon";\
+ echo " install-config install the nrpe configuration file";\
+ echo " install-inetd install the startup files for inetd, launchd, etc.";\
+ echo " install-init install the startup files for init, systemd, etc.";\
+ echo
+
+all:
+ cd $(SRC_BASE); $(MAKE)
+
+ @echo "";\
+ echo "*** Compile finished ***";\
+ echo "";\
+ echo "You can now continue with the installation or upgrade process.";\
+ echo "";\
+ echo "Read the PDF documentation (docs/NRPE.pdf) for information on the next";\
+ echo "steps you should take to complete the installation or upgrade.";\
+ echo ""
+
+nrpe:
+ cd $(SRC_BASE); $(MAKE)
+
+check_nrpe:
+ cd $(SRC_BASE); $(MAKE)
+
+install-plugin:
+ cd $(SRC_BASE); $(MAKE) $@
+
+install-daemon:
+ cd $(SRC_BASE); $(MAKE) $@
+
+install:
+ cd $(SRC_BASE); $(MAKE) $@
+
+install-init:
+ @if test $(SRC_INIT) = unknown; then \
+ echo No init file to install; \
+ exit 1; \
+ fi
+ @if test $(INIT_TYPE) = upstart; then\
+ echo $(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
+ $(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
+ echo initctl reload-configuration; \
+ initctl reload-configuration; \
+ elif test $(INIT_TYPE) = systemd; then\
+ echo $(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
+ $(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
+ elif test $(INIT_TYPE) = smf10 -o $(INIT_TYPE) = smf11; then \
+ echo $(INSTALL) -m 775 -g sys -d $(INIT_DIR);\
+ $(INSTALL) -m 775 -g sys -d $(INIT_DIR);\
+ echo $(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
+ $(INSTALL) -m 644 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
+ echo svccfg import $(INIT_DIR)/$(INIT_FILE); \
+ svccfg import $(INIT_DIR)/$(INIT_FILE); \
+ echo "*** Run 'svcadm enable nrpe' to start it"; \
+ elif test $(INIT_TYPE) = gentoo; then\
+ $(INSTALL) -m 755 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
+ echo rc-update add nrpe default; \
+ rc-update add nrpe default; \
+ else\
+ echo $(INSTALL) -m 755 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
+ $(INSTALL) -m 755 startup/$(SRC_INIT) $(INIT_DIR)/$(INIT_FILE); \
+ if test $(INIT_TYPE) = newbsd; then\
+ if test $(DIST) = openbsd; then\
+ echo "# nrpe@bsd_enable@=NO" >> /etc/rc.conf;\
+ echo "nrpe@bsd_enable@=\"-d -c $(CFGDIR)/nrpe.cfg\"" >> /etc/rc.conf;\
+ echo "Make sure to enable the nrpe daemon";\
+ else\
+ echo "nrpe@bsd_enable@=YES" >> /etc/rc.conf;\
+ echo "nrpe_configfile=$(CFGDIR)/nrpe.cfg" >> /etc/rc.conf;\
+ fi;\
+ elif test $(INIT_TYPE) = launchd; then\
+ launchctl load $(INIT_DIR)/$(INIT_FILE); \
+ else\
+ if test -f /sbin/chkconfig ; then \
+ case "$(DESTDIR)" in */rpmbuild/*) break;; \
+ *)/sbin/chkconfig nrpe on;; \
+ esac; \
+ else\
+ echo "Make sure to enable the nrpe daemon";\
+ fi;\
+ fi;\
+ fi
+
+install-inetd:
+ @if test $(SRC_INETD) = unknown; then \
+ echo No inetd file to install; \
+ exit 1; \
+ fi
+ @if test $(INETD_TYPE) = inetd; then \
+ $(EGREP) -q "^\W*nrpe\s+" $(INETD_DIR)/$(INETD_FILE) 2>/dev/null || \
+ cat startup/$(SRC_INETD) >> $(INETD_DIR)/$(INETD_FILE); \
+ elif test $(INETD_TYPE) = systemd; then \
+ SRC_INETD_FILE=`echo "$(SRC_INETD)" | sed -e 's/socket/socket-svc/'`; \
+ echo $(INSTALL) -m 644 startup/$$SRC_INETD_FILE $(INETD_DIR)/$(INIT_FILE); \
+ $(INSTALL) -m 644 startup/$$SRC_INETD_FILE $(INETD_DIR)/$(INIT_FILE); \
+ elif test $(INETD_TYPE) = smf10 -o $(INETD_TYPE) = smf11; then \
+ echo $(INSTALL) -m 775 -g sys -d $(INETD_DIR);\
+ $(INSTALL) -m 775 -g sys -d $(INETD_DIR);\
+ echo $(INSTALL) -m 644 startup/$(SRC_INETD) $(INETD_DIR)/$(INETD_FILE); \
+ $(INSTALL) -m 644 startup/$(SRC_INETD) $(INETD_DIR)/$(INETD_FILE); \
+ $(INSTALL) -m 775 -d $(INETD_DIR);\
+ echo svccfg import $(INETD_DIR)/$(INETD_FILE); \
+ svccfg import $(INETD_DIR)/$(INETD_FILE); \
+ echo "*** Run 'svcadm enable nrpe' to start it"; \
+ elif test $(INIT_TYPE) = launchd; then\
+ $(INSTALL) -m 644 startup/$(SRC_INETD) $(INETD_DIR)/$(INETD_FILE); \
+ launchctl load $(INETD_DIR)/$(INETD_FILE); \
+ else\
+ echo $(INSTALL) -m 644 startup/$(SRC_INETD) $(INETD_DIR)/$(INETD_FILE); \
+ $(INSTALL) -m 644 startup/$(SRC_INETD) $(INETD_DIR)/$(INETD_FILE); \
+ fi
+ @$(EGREP) -q "^nrpe[\t ]+@nrpe_port@/tcp" /etc/services || \
+ echo "***** MAKE SURE 'nrpe @nrpe_port@/tcp' IS IN YOUR /etc/services FILE"
+
+install-config:
+ $(INSTALL) -m 775 $(NAGIOS_INSTALL_OPTS) -d $(CFGDIR)
+ $(INSTALL) -m 644 $(NRPE_INSTALL_OPTS) sample-config/nrpe.cfg $(CFGDIR)
+
+install-groups-users:
+ @macros/add_group_user $(DIST) $(NAGIOS_USER) $(NAGIOS_GROUP)
+ @if test "$(NAGIOS_USER)" != "$(NRPE_USER)" -o "$(NAGIOS_GROUP)" != "$(NRPE_GROUP)"; then\
+ macros/add_group_user $(DIST) $(NRPE_USER) $(NRPE_GROUP);\
+ fi
+
+clean:
+ cd $(SRC_BASE); $(MAKE) $@; cd ..
+ rm -f core
+ rm -f *~ */*~
+
+distclean: clean
+ cd $(SRC_BASE); $(MAKE) $@; cd ..
+ rm -rf autom4te.cache
+ rm -f config.log config.status config.cache sample-config/nrpe.cfg $(SRC_INCLUDE)/config.h
+ rm -f startup/bsd-init startup/debian-init startup/default-init startup/default-inetd
+ rm -f startup/default-service startup/default-socket startup/default-socket-svc
+ rm -f startup/default-xinetd startup/mac-init.plist startup/mac-inetd.plist
+ rm -f startup/newbsd-init startup/openbsd-init startup/openrc-conf
+ rm -f startup/openrc-init startup/rh-upstart-init startup/solaris-init.xml
+ rm -f startup/solaris-inetd.xml startup/tmpfile.conf startup/upstart-init
+ rm -f nrpe.spec uninstall include/common.h
+ rm -f Makefile
+
+devclean: distclean
+
diff --git a/README.SSL.md b/README.SSL.md
new file mode 100644
index 0000000..9f30613
--- /dev/null
+++ b/README.SSL.md
@@ -0,0 +1,290 @@
+NRPE With SSL/TLS
+=================
+
+This document covers the different methods of SSL transport
+that NRPE allows for.
+
+If there was a TL;DR here, it is these:
+
+### Don't use NRPE without encryption
+
+and
+
+### Use Public Key Encryption
+
+Contents
+--------
+
+1. [Introduction](#introduction)
+2. [NRPE Changes](#nrpe-changes)
+3. [check_nrpe Changes](#check_nrpe-changes)
+4. [Certificate Generation Example](#certificate-generation-example)
+
+
+Introduction
+------------
+
+NRPE has had basic support for SSL/TLS for some time now, but it was
+severely lacking. It only allowed anonymous Diffie Hellman (ADH) key
+exchange, it used a fixed 512-bit key (generated at `./configure`
+time and extremely insecure) and originally allowed SSLv2. In 2004,
+SSLv2 and SSLv3 support was disabled.
+
+`nrpe` and `check_nrpe` have been updated to offer much more secure
+encryption and more options. And the updates are done in a backward-
+compatible way, allowing you to migrate to the newer versions
+without having to do it all at once, and possibly miss updating some
+machines, causing lost reporting.
+
+
+
+NRPE Changes
+------------
+
+Running `./configure` will now create a 2048-bit DH key instead
+of the old 512-bit key. The most current versions of openSSL will
+still not allow it. In my testing, openSSL 1.0.1e allowed DH keys
+of 512 bits, and 1.0.1k would not allow 2048 bit keys. In addition
+we now call `SSL_CTX_set_options(ctx, SSL_OP_SINGLE_DH_USE)` so a
+new key is generated on each connection, based on the 2048-bit
+key generated.
+
+The NRPE configuration file has added new SSL/TLS options. The
+defaults currently will allow old check_nrpe plugins to continue to
+connect to the nrpe daemon, but can report on "old style"
+connections, or enforce more secure communication as your migration
+progresses. The new options are in the "SSL/TLS OPTIONS" section of
+nrpe.cfg, about two-thirds of the way down.
+
+If you are upgrading NRPE from a prior version, you can run the
+`update-cfg.pl` script to add the new parameters to your nrpe.cfg.
+
+The `ssl_version` directive lets you set which versions of SSL/TLS
+you want to allow. SSLv2, SSLv3, TLSv1, TLSv1.1 and TLSv1.2 are
+allowed, or those litereals with a `+` after them (as in TLSv1.1+).
+Without the `+`, *that version only* will be used. With the `+`,
+that *version or above* will be used. openSSL will always negotiate
+the highest available allowed version available on both ends. This
+directive currently defaults to `TLSv1+`.
+
+The `ssl_use_adh` directive is **DEPRECATED**, even though it is new.
+Possible values are `0` to not allow ADH at all, `1` to allow ADH,
+and `2` to require ADH. The `2` should never be required, but it's
+there just in case it's needed, for whatever reason. `1` is currently
+the default, which allows older `check_nrpe` plugins to connect using
+ADH. When all the plugins are migrated to the newer version, it
+should be set to `0`. In an upcoming version of NRPE, ADH will no
+longer be allowed at all. Note that if you use a `2` here, NRPE will
+override any `ssl_cipher_list` entries (below) to *only* allow ADH.
+
+The `ssl_cipher_list` directive lets you specify which ciphers you
+want to allow. It currently defaults to `ALL:!MD5:@STRENGTH` but can
+take any value allowed by openSSL. In an upcoming version of NRPE, it
+will be changed to something more secure, something like
+`ALL:!aNULL:!eNULL:!SSLv2:!LOW:!EXP:!RC4:!MD5:@STRENGTH`. Note that
+if you have `ssl_use_adh=2`, this string will be overridden with
+`ADH` which only only allow ADH.
+
+The `ssl_cacert_file`, `ssl_cert_file` and `ssl_privatekey_file`
+directives are used to specify which *.pem files are to be used for
+Public-Key Encryption (PKE). Setting these will allow clients to use
+PKE to communicate with the server, similar to how the HTTPS
+protocol works.
+
+The `ssl_client_certs` directive specifies whether or not a client
+certificate will be requested when a client tries to connect. A value
+of `0` means the nrpe daemon will not ask for or require a client
+certificate. A `1` will cause it to ask for a client certificate, but
+not require one. A `2` will require the client to present a valid
+certificate. This currently defaults to `0`. If you want to use
+client certificates and are upgrading the clients over time, you can
+set this to `1` once many have been upgraded, then set to `2` to
+force the use of client certs. Note that the client certs _must_ be
+signed by the CA cert specified in the `ssl_cacert_file` directive.
+
+The `ssl_logging` directive allows you to log some additional data
+to syslog. OR (or add) values together to have more than one option
+enabled. Values are `0` for no additional logging (the default),
+`1` to log startup SSL/TLS parameters from the nrpe.cfg file, `2` to
+log the SSL/TLS version of connections, `4` to log which cipher is
+being used for the connection, `8` to log if the plugin has a cert, and
+`16` to log details of plugin's certificate. `-1` will enable all.
+This can be especially helpful during plugin migration, so you can
+tell which plugins have certificates, what SSL/TLS version is being
+used, and which ciphers are being used.
+
+
+check_nrpe Changes
+------------------
+
+The `check_nrpe` plugin has also been updated to provide more secure
+encryption and allow the use of client certificates. The command line
+has several new options, which are outlined below. Both the long and
+short arguments are presented.
+
+`--no-adh` or `-d` will disable the use of ADH. This option is
+**DEPRECATED**, even though it's new. It will be removed in a
+future version.
+
+`--ssl-version=<ver>` or `-S <ver>` specifies minimum SSL/TLS version
+to use. See the `ssl_version` directive above for possible values.
+
+`--cipher-list=<value.` or `-L <value>` determines which ciphers will
+and won't be allowed. See the `ssl_cipher_list` directive above.
+
+`--client-cert=<path>` or `-C <path>` specifies an optional client
+certificate to use. If this value is entered, the next one below is
+required.
+
+`--key-file=<path>` or `-K <path>` specifies the client certificate
+key file to use. This goes along with `--client-cert` above.
+
+`--ca-cert-file=<path>` or `-A <path>` specifies the CA certificate
+to use in order to validate the nrpe daemon's public key.
+
+`--no-adh` or `-d` is **DEPRECATED**
+
+`--use-adh` or `-d [num]` is **DEPRECATED**, even though it is new.
+If you use `-d` or `-d 0` it acts the same way as as the old `-d`.
+Otherwise, use `1` to allow ADH, and `2` to require ADH.
+
+`--ssl-logging=<num>` or `-s <num>` allows you to log some additional
+data to syslog. OR (or add) values together to have more than one
+option enabled. See the description of the `ssl_logging` directive
+from NRPE above.
+
+
+
+Certificate Generation Example
+------------------------------
+
+**Note** _The following example does not follow best practice for
+creating and running a CA or creating certificates. It is for testing
+or possibly for use in a small environment. Sloppy security is as bad
+as no security._
+
+In this example, we are going to put everything in the
+`/usr/local/nagios/etc/ssl` directory. You may want to use the more
+common `/etc/ssl` directory, or somewhere else entirely.
+
+We are going to assume your company name is Foo Widgets, LLC; the
+server running the nagios process (and thus the check_nrpe program)
+is called `nag_serv`; and there are two Linux machines that will
+run the nrpe daemon: `db_server` and `bobs_workstation`.
+
+
+#### Set up the directories
+
+As root, do the following:
+
+ mkdir -p -m 750 /usr/local/nagios/etc/ssl
+ chown root:nagios /usr/local/nagios/etc/ssl
+ cd /usr/local/nagios/etc/ssl
+ mkdir -m 750 ca
+ chown root:root ca
+ mkdir -m 750 server_certs
+ chown root:nagios server_certs
+ mkdir -m 750 client_certs
+ chown root:nagios client_certs
+
+
+#### Create Certificate Authority
+
+If you want to validate client or server certificates, you will need
+to create a Certificate Authority (CA) that will sign all client and
+server certificates. If your organization already has a CA, you can
+use that.
+
+As root, do the following:
+
+ cd /usr/local/nagios/etc/ssl/ca
+ openssl req -x509 -newkey rsa:4096 -keyout ca_key.pem \
+ -out ca_cert.pem -utf8 -days 3650
+
+When asked, enter a passphrase. Then follow the prompts. You will
+probably want to include `CA` or `Certificate Authority` in for
+`Organizational Unit Name` and `Common Name`. For example:
+
+ Organization Name (eg, company) []:Foo Widgets LLC
+ Organizational Unit Name (eg, section) []:Foo Certificate Authority
+ Common Name (e.g. server FQDN or YOUR name) []:Foo Nagios CA
+
+
+#### Create NRPE Server Certificate Requests
+
+For each of the hosts that will be running the nrpe daemon, you will
+need a server certificate. You can create a key, and the CSR
+(Certificate Signing Request) separately, but the following commands
+will do both with one command. As root, do the following:
+
+ cd /usr/local/nagios/etc/ssl/server_certs
+ openssl req -new -newkey rsa:2048 -keyout db_server.key \
+ -out db_server.csr -nodes
+ openssl req -new -newkey rsa:2048 -keyout bobs_workstation.key \
+ -out bobs_workstation.csr -nodes
+
+Follow the prompts. The `-nodes` at the end of the lines tells
+openssl to generate the key without a passphrase. Leave it off if you
+want someone to enter a passphrase whenever the machine boots.
+
+Now you need to sign the CSRs with your CA key.
+
+If you have the default `/etc/openssl.cnf`, either change it, or as root, do:
+
+ cd /usr/local/nagios/etc/ssl
+ mkdir demoCA
+ mkdir demoCA/newcerts
+ touch demoCA/index.txt
+ echo "01" > demoCA/serial
+ chown -R root:root demoCA
+ chmod 700 demoCA
+ chmod 700 demoCA/newcerts
+ chmod 600 demoCA/serial
+ chmod 600 demoCA/index.txt
+
+Now, sign the CSRs. As root, do the following:
+
+ cd /usr/local/nagios/etc/ssl
+ openssl ca -days 365 -notext -md sha256 \
+ -keyfile ca/ca_key.pem -cert ca/ca_cert.pem \
+ -in server_certs/db_server.csr \
+ -out server_certs/db_server.pem
+ chown root:nagios server_certs/db_server.pem
+ chmod 440 server_certs/db_server.pem
+ openssl ca -days 365 -notext -md sha256 \
+ -keyfile ca/ca_key.pem -cert ca/ca_cert.pem \
+ -in server_certs/bobs_workstation.csr \
+ -out server_certs/bobs_workstation.pem
+ chown root:nagios server_certs/bobs_workstation.pem
+ chmod 440 server_certs/bobs_workstation.pem
+
+Now, copy the `db_server.pem` and `db_server.key` files to the
+db_server machine, and the `bobs_workstation.pem` and
+`bobs_workstation.key` files to bobs_workstation. Copy the
+`ca/ca_cert.pem` file to both machines.
+
+
+#### Create NRPE Client Certificate Requests
+
+Now you need to do the same thing for the machine that will be
+running the check_nrpe program.
+
+ cd /usr/local/nagios/etc/ssl/client_certs
+ openssl req -new -newkey rsa:2048 -keyout nag_serv.key \
+ -out nag_serv.csr -nodes
+
+ cd /usr/local/nagios/etc/ssl
+ openssl ca -extensions usr_cert -days 365 -notext -md sha256 \
+ -keyfile ca/ca_key.pem -cert ca/ca_cert.pem \
+ -in client_certs/nag_serv.csr \
+ -out client_certs/nag_serv.pem
+ chown root:nagios client_certs/nag_serv.pem
+ chmod 440 client_certs/nag_serv.pem
+
+Now, copy the `nag_serv.pem`, `nag_serv.key` and `ca/ca_cert.pem`
+files to the nag_serv machine, if you did the above on a different
+computer.
+
+Put the location of each computers' three files in the `nrpe.cfg`
+file or in the check_nrpe command line. You should now have
+encryption and, if desired, key validation.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..801f9f8
--- /dev/null
+++ b/README.md
@@ -0,0 +1,292 @@
+![Nagios!](https://www.nagios.com/wp-content/uploads/2015/05/Nagios-Black-500x124.png)
+
+[![Build Status](https://travis-ci.org/NagiosEnterprises/nrpe.svg?branch=master)](https://travis-ci.org/NagiosEnterprises/nrpe)
+
+NRPE
+====
+
+## Nagios Remote Plugin Executor
+
+
+For installation instructions and information on the design overview
+of the NRPE addon, please read the PDF documentation that is found in
+this directory: `docs/NRPE.pdf`.
+
+If you are upgrading from a previous version, you'll want to
+check the [Changelog](CHANGELOG.md) and then run `./update-cfg.pl` to
+add the new SSL parameters to your config file.
+
+TL;DR: You can jump straight to [Compiling](#compiling) and
+[Installing](#installing)
+
+You'll want to read up on the [Security](SECURITY.md) document
+regarding NRPE, no doubt.
+
+And make sure to check out the [SSL Readme](README.SSL.md) as well,
+if you plan on using encryption methods to transmit `nrpe` data.
+
+
+Purpose
+-------
+The purpose of this addon is to allow you to execute Nagios
+plugins on a remote host in as transparent a manner as possible.
+
+
+Contents
+--------
+
+There are two pieces to this addon:
+
+1. `nrpe`
+
+ This program runs as a background process on the
+ remote host and processes command execution requests
+ from the check_nrpe plugin on the Nagios host.
+ Upon receiving a plugin request from an authorized
+ host, it will execute the command line associated
+ with the command name it received and send the
+ program output and return code back to the
+ check_nrpe plugin
+
+2. `check_nrpe`
+
+ This is a plugin that is run on the Nagios host
+ and is used to contact the NRPE process on remote
+ hosts. The plugin requests that a plugin be
+ executed on the remote host and wait for the NRPE
+ process to execute the plugin and return the result.
+ The plugin then uses the output and return code
+ from the plugin execution on the remote host for
+ its own output and return code.
+
+
+Compiling
+---------
+
+If you are having any problems compiling on your system,
+please let us know (preferrably with fixes). Most users
+should be able to compile `nrpe` and the `check_nrpe`
+plugin with the following commands...
+
+ ./configure
+ make all
+
+***HINT:*** `./configure --help`
+
+**NOTE:** If you're cloning from GitHub, you'll need to run
+`autoconf` first.
+
+**NOTE:** Since the check_nrpe plugin and nrpe daemon run
+on different machines (the plugin runs on the Nagios host and
+the daemon runs on the remote host), you will have to compile
+the nrpe daemon on the target machine.
+
+
+Installing
+----------
+
+You have a few options here. The binaries created from `make all`
+were placed in your `src/` directory. You can either copy these
+where they need to be, or you can run any of the following
+`make install` options:
+
+* `make install-groups-users`
+
+ Add the users and groups sepcified during `./configure`. Defaults
+ to nagios and nagios, respectively. You can override these with the
+ `./configure --with-nrpe-user=USER --with-nrpe-group=GROUP`.
+
+* `make install`
+
+ This will run both `install-plugin` and `install-daemon`.
+
+* `make install-plugin`
+
+ This will install the plugin by default in
+ `/usr/local/nagios/libexec`. You can override this
+ behavior by using the `--with-pluginsdir=DIR` flag during
+ `./configure`.
+
+* `make install-daemon`
+
+ This will install the plugin by default in
+ `/usr/local/nagios/bin`. You can override this
+ behavior by using the `--prefix=DIR` or
+ `--bindir=DIR` flags during `./configure`.
+
+* `make install-config`
+
+ This will install the sample config by default in
+ `/usr/local/nagios/etc`. You can override this
+ behavior by using the `--with-pkgsysconfdir=DIR`
+ flag during `./configure`.
+
+* `make install-inetd`
+
+ `./configure` attempts to determine your inetd type.
+ If it finds it, it will install the appropriate inetd
+ script in the proper location. You can help it out with
+ `./configure --with-inetd-type=TYPE` where `TYPE` can be
+ one of: `inetd`, `xinetd`, `systemd`, `launchd`,
+ `smf10`, `smf11`.
+
+* `make install-init`
+
+ `./configure` attempts to determine the appropriate
+ init type. If it figures it out, will install the
+ required startup script. You can help it out with
+ `./configure --with-init-type=TYPE` where TYPE can be
+ one of: `bsd`, `sysv`, `systemd`, `launchd`, `smf10`,
+ `smf11`, `upstart`, `openrc`.
+
+If you used all the necessary `./configure` flags, you shouldn't
+need to tweak your config file any at this point, and a simple
+`service nrpe start` or `systemctl start nrpe.service` should
+work just fine.
+
+Configuring
+-----------
+
+A sample config file for the NRPE daemon are located in the
+`sample-config/` subdirectory.
+
+If you used the proper flags during `./configure`, this file
+should contain all of the appropriate information as a starting
+point.
+
+
+Running Under `inetd` or `xinetd`
+---------------------------------
+
+If you plan on running nrpe under inetd or xinetd and making use
+of TCP wrappers, you need to add a line to your `/etc/services`
+file as follows (modify the port number as you see fit)
+
+ nrpe 5666/tcp # NRPE
+
+The run `make install-inetd` to copy the appropriate file, or
+add the appropriate line to your `/etc/inetd.conf`.
+
+**NOTE:** If you run nrpe under inetd or xinetd, the server_port
+and allowed_hosts variables in the nrpe configuration file are
+ignored.
+
+
+* `inetd`
+
+ After running `make install-inetd`, your `/etc/inetd.conf` file will
+ contain lines similar to the following:
+
+ # Enable the following entry to enable the nrpe daemon
+ #nrpe stream tcp nowait nagios /usr/local/nagios/bin/nrpe nrpe -c /usr/local/nagios/etc/nr
+ # Enable the following entry if the nrpe daemon didn't link with libwrap
+ #nrpe stream tcp nowait nagios /usr/sbin/tcpd /usr/local/nagios/bin/nrpe -c /usr/local/nag
+
+ Un-comment the appropriate line, then Restart inetd:
+
+ /etc/rc.d/init.d/inet restart
+
+ OpenBSD users can use the following command to restart inetd:
+
+ kill -HUP `cat /var/run/inet.pid`
+
+ Then add entries to your `/etc/hosts.allow` and `/etc/hosts.deny`
+ file to enable TCP wrapper protection for the nrpe service.
+ This is optional, although highly recommended.
+
+
+* `xinetd`
+
+ If your system uses xinetd instead of inetd, `make install-inetd`
+ will create a file called `nrpe` in your `/etc/xinetd.d`
+ directory that contains a file similar to this:
+
+ # default: off
+ # description: NRPE (Nagios Remote Plugin Executor)
+ service nrpe
+ {
+ disable = yes
+ socket_type = stream
+ port = @NRPE_PORT@
+ wait = no
+ user = nagios
+ group = nagios
+ server = /usr/local/nagios/bin/nrpe
+ server_args = -c /usr/local/nagios/etc/nrpe.cfg --inetd
+ only_from = 127.0.0.1
+ log_on_failure += USERID
+ }
+
+ * Replace `disable = yes` with `disable = no`
+ * Replace the `127.0.0.1` field with the IP addresses of hosts which
+ are allowed to connect to the NRPE daemon. This only works if xinetd was
+ compiled with support for tcpwrappers.
+ * Add entries to your `/etc/hosts.allow` and `/etc/hosts.deny`
+ file to enable TCP wrapper protection for the nrpe service.
+ This is optional, although highly recommended.
+
+ * Restart xinetd:
+
+ /etc/rc.d/init.d/xinetd restart
+
+
+Configuring Things On The Nagios Host
+---------------------------------------
+
+Examples for configuring the nrpe daemon are found in the sample
+`nrpe.cfg` file included in this distribution. That config file
+resides on the remote host(s) along with the nrpe daemon. The
+check_nrpe plugin gets installed on the Nagios host. In order
+to use the check_nrpe plugin from within Nagios, you will have
+to define a few things in the host config file. An example
+command definition for the check_nrpe plugin would look like this:
+
+ define command{
+ command_name check_nrpe
+ command_line /usr/local/nagios/libexec/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
+ }
+
+In any service definitions that use the nrpe plugin/daemon to
+get their results, you would set the service check command portion
+of the definition to something like this (sample service definition
+is simplified for this example):
+
+ define service{
+ host_name someremotehost
+ service_description someremoteservice
+ check_command check_nrpe!yourcommand
+ ... etc ...
+ }
+
+where `yourcommand` is a name of a command that you define in
+your `nrpe.cfg` file on the remote host (see the docs in the
+sample nrpe.cfg file for more information).
+
+
+License Notice
+--------------
+
+NRPE - Nagios Remote Plugin Executor
+
+Copyright (c) 2017 Nagios Enterprises
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+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; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+
+Questions?
+----------
+
+If you have questions about this addon, or encounter problems getting things
+working along the way, your best bet for an answer or quick resolution is to check the
+[Nagios Support Forums](https://support.nagios.com/forum/viewforum.php?f=5).
diff --git a/SECURITY.md b/SECURITY.md
new file mode 100644
index 0000000..7173f27
--- /dev/null
+++ b/SECURITY.md
@@ -0,0 +1,123 @@
+NRPE SECURITY README
+====================
+
+TCP Wrapper Support
+-------------------
+
+NRPE 2.x includes native support for TCP wrappers. Once you
+compile NRPE you can check to see if it has wrapper support
+built in by running the daemon from the command line without
+any arguments like this:
+
+ ./nrpe --help
+
+
+Command Arguments
+-----------------
+
+NRPE 2.0 includes the ability for clients to supply arguments to
+commands which should be run. Please note that this feature
+should be considered a security risk, and you should only use
+it if you know what you're doing!
+
+
+Bash Command Substitution
+-------------------------
+
+Even with the metacharacter restrictions below, if command arguments
+are enabled, it is still possible to send bash command substitutions
+in the form `$(...)` as an argument. This is explicitly disabled by
+default, but can be enabled by a configure-time option and a
+configuration file option. Enabling this option is **VERY RISKY**
+and its use is **HIGHLY DISCOURAGED**.
+
+
+Enabling Arguments
+------------------
+
+To enable support for command argument in the daemon, you must
+do two things:
+
+ 1. Run the configure script with the `--enable-command-args`
+ option
+
+ 2. Set the `dont_blame_nrpe` directive in the NRPE config
+ file to `1`.
+
+
+Enabling Bash Command Substitution
+----------------------------------
+
+To enable support for arguments containing bash command substitutions,
+you must do two things:
+
+ 1. Enable arguments as described above
+
+ 2. Include the `--enable-bash-command-substitution` configure
+ option when running the configure script
+
+ 3. Set the `allow_bash_command_substitutions` directive in the
+ NRPE config file to `1`.
+
+
+Nasty Metacharacters
+--------------------
+
+To help prevent some nasty things from being done by evil
+clients, the following metacharacters are not allowed
+in client command arguments:
+
+ | ` & > < ' \ [ ] { } ; ! \r \n
+
+You can override these defaults by adjusting the `nasty_metachars`
+flag in the config file.
+
+Any client request which contains the above mentioned metachars
+is discarded.
+
+
+User/Group Restrictions
+-----------------------
+
+The NRPE daemon cannot be run with (effective) root user/group
+privileges. You must run the daemon with an account that does
+not have superuser rights. Use the `--with-nrpe-user` and
+`--with-nrpe-group` flags during `./configure`, or the `nrpe_user`
+and `nrpe_group` config file options to specify which user/group
+the daemon should run as.
+
+
+Encryption
+----------
+
+If you do enable support for command arguments in the NRPE daemon,
+make sure that you encrypt communications either by using:
+
+ 1. Stunnel (see http://www.stunnel.org for more info)
+ 2. Native SSL support (See the [SSL Readme](README.SSL.md) file for more info)
+
+Do **NOT** assume that just because the daemon is behind a firewall
+that you are safe! ***Always encrypt NRPE traffic!***
+
+
+Using Arguments
+---------------
+
+How do you use command arguments? Well, lets say you define a
+command in the NRPE config file that looks like this:
+
+ command[check_users]=/usr/local/nagios/libexec/check_users -w $ARG1$ -c $ARG2$
+
+You could then call the check_nrpe plugin like this:
+
+ ./check_nrpe -H <host> -c check_users -a 5 10
+
+The arguments '5' and '10' get substituted into the appropriate
+`$ARGx$` macros in the command (`$ARG1$` and `$ARG2$`, respectively).
+The command that would be executed by the NRPE daemon would look
+like this:
+
+ /usr/local/nagios/libexec/check_users -w 5 -c 10
+
+You can supply up to 16 arguments to be passed to the command
+for substitution in `$ARG$` macros (`$ARG1$` - `$ARG16$`).
diff --git a/THANKS b/THANKS
new file mode 100644
index 0000000..cbb4dd3
--- /dev/null
+++ b/THANKS
@@ -0,0 +1,54 @@
+Alex Weber
+Andrea Morgan-Brist
+Andrew Boyce-Lewis
+Andrew Ryder
+Andrew Widdersheim
+Bartosz Woronicz
+Bas Couwenberg
+Bill Mitchell
+Bjoern Beutel
+Brian Seklecki
+Bryan Heden
+Derrick Bennett
+Elan Ruusamäe
+Eric Mislivec
+Eric Stanley
+Gerhard Lausser
+Graham Collinson
+Grant Byers
+Grégory Starck
+jaclu@grm.se
+James Peterson
+Jari Takkala
+Jason Cook
+Jobst Schmalenbach
+John Frickson
+John Maag
+Jon Andrews
+Josh Soref
+Kaspersky Lab
+Kevin Pendleton
+Konstantin Malov
+Krzysztof Oledzki
+Leo Baltus
+Mark Plaksin
+Matthew L. Daniel
+Matthias Flacke
+Niels Endres
+Patric Wust
+Peter Palfrader
+Philippe Kueck
+Rene Klootwijk
+Robert Peaslee
+Ruben Kerkhof
+Ryan McGarry
+Ryan Ordway
+Sean Finney
+Spenser Reinhardt
+Stefan Krüger
+Stephen Smoogen
+Subhendu Ghosh
+Sven Nierlein
+Thierry Bertaud
+Ton Voon
+Vadim Antipov \ No newline at end of file
diff --git a/aclocal.m4 b/aclocal.m4
new file mode 100755
index 0000000..c64786b
--- /dev/null
+++ b/aclocal.m4
@@ -0,0 +1,7 @@
+m4_include([macros/ax_nagios_get_os])
+m4_include([macros/ax_nagios_get_distrib])
+m4_include([macros/ax_nagios_get_init])
+m4_include([macros/ax_nagios_get_inetd])
+m4_include([macros/ax_nagios_get_paths])
+m4_include([macros/ax_nagios_get_files])
+m4_include([macros/ax_nagios_get_ssl])
diff --git a/build-aux/config.guess b/build-aux/config.guess
new file mode 100755
index 0000000..eab94e2
--- /dev/null
+++ b/build-aux/config.guess
@@ -0,0 +1,1431 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+# Copyright 1992-2014 Free Software Foundation, Inc.
+
+timestamp='2014-11-04'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# 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; if not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that
+# program. This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
+#
+# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
+#
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+#
+# Please send patches to <config-patches@gnu.org>.
+
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright 1992-2014 Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit ;;
+ --version | -v )
+ echo "$version" ; exit ;;
+ --help | --h* | -h )
+ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help" >&2
+ exit 1 ;;
+ * )
+ break ;;
+ esac
+done
+
+if test $# != 0; then
+ echo "$me: too many arguments$help" >&2
+ exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,) echo "int x;" > $dummy.c ;
+ for c in cc gcc c89 c99 ; do
+ if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+ CC_FOR_BUILD="$c"; break ;
+ fi ;
+ done ;
+ if test x"$CC_FOR_BUILD" = x ; then
+ CC_FOR_BUILD=no_compiler_found ;
+ fi
+ ;;
+ ,,*) CC_FOR_BUILD=$CC ;;
+ ,*,*) CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+ PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+case "${UNAME_SYSTEM}" in
+Linux|GNU|GNU/*)
+ # If the system lacks a compiler, then just pick glibc.
+ # We could probably try harder.
+ LIBC=gnu
+
+ eval $set_cc_for_build
+ cat <<-EOF > $dummy.c
+ #include <features.h>
+ #if defined(__UCLIBC__)
+ LIBC=uclibc
+ #elif defined(__dietlibc__)
+ LIBC=dietlibc
+ #else
+ LIBC=gnu
+ #endif
+ EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
+ ;;
+esac
+
+case "${UNAME_MACHINE}" in
+ i?86)
+ test -z "$VENDOR" && VENDOR=pc
+ ;;
+ *)
+ test -z "$VENDOR" && VENDOR=unknown
+ ;;
+esac
+test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ *:NetBSD:*:*)
+ # NetBSD (nbsd) targets should (where applicable) match one or
+ # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
+ # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
+ # switched to ELF, *-*-netbsd* would select the old
+ # object file format. This provides both forward
+ # compatibility and a consistent mechanism for selecting the
+ # object file format.
+ #
+ # Note: NetBSD doesn't particularly care about the vendor
+ # portion of the name. We always set it to "unknown".
+ sysctl="sysctl -n hw.machine_arch"
+ UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+ /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+ case "${UNAME_MACHINE_ARCH}" in
+ armeb) machine=armeb-unknown ;;
+ arm*) machine=arm-unknown ;;
+ sh3el) machine=shl-unknown ;;
+ sh3eb) machine=sh-unknown ;;
+ sh5el) machine=sh5le-unknown ;;
+ *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+ esac
+ # The Operating System including object format, if it has switched
+ # to ELF recently, or will in the future.
+ case "${UNAME_MACHINE_ARCH}" in
+ arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+ eval $set_cc_for_build
+ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep -q __ELF__
+ then
+ # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+ # Return netbsd for either. FIX?
+ os=netbsd
+ else
+ os=netbsdelf
+ fi
+ ;;
+ *)
+ os=netbsd
+ ;;
+ esac
+ # The OS release
+ # Debian GNU/NetBSD machines have a different userland, and
+ # thus, need a distinct triplet. However, they do not need
+ # kernel version information, so it can be replaced with a
+ # suitable tag, in the style of linux-gnu.
+ case "${UNAME_VERSION}" in
+ Debian*)
+ release='-gnu'
+ ;;
+ *)
+ release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ ;;
+ esac
+ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+ # contains redundant information, the shorter form:
+ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ echo "${machine}-${os}${release}"
+ exit ;;
+ *:Bitrig:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
+ echo ${UNAME_MACHINE_ARCH}-${VENDOR}-bitrig${UNAME_RELEASE}
+ exit ;;
+ *:OpenBSD:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+ echo ${UNAME_MACHINE_ARCH}-${VENDOR}-openbsd${UNAME_RELEASE}
+ exit ;;
+ *:ekkoBSD:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-ekkobsd${UNAME_RELEASE}
+ exit ;;
+ *:SolidBSD:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-solidbsd${UNAME_RELEASE}
+ exit ;;
+ macppc:MirBSD:*:*)
+ echo powerpc-${VENDOR}-mirbsd${UNAME_RELEASE}
+ exit ;;
+ *:MirBSD:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-mirbsd${UNAME_RELEASE}
+ exit ;;
+ alpha:OSF1:*:*)
+ case $UNAME_RELEASE in
+ *4.0)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+ ;;
+ *5.*)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+ ;;
+ esac
+ # According to Compaq, /usr/sbin/psrinfo has been available on
+ # OSF/1 and Tru64 systems produced since 1995. I hope that
+ # covers most systems running today. This code pipes the CPU
+ # types through head -n 1, so we only detect the type of CPU 0.
+ ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+ case "$ALPHA_CPU_TYPE" in
+ "EV4 (21064)")
+ UNAME_MACHINE="alpha" ;;
+ "EV4.5 (21064)")
+ UNAME_MACHINE="alpha" ;;
+ "LCA4 (21066/21068)")
+ UNAME_MACHINE="alpha" ;;
+ "EV5 (21164)")
+ UNAME_MACHINE="alphaev5" ;;
+ "EV5.6 (21164A)")
+ UNAME_MACHINE="alphaev56" ;;
+ "EV5.6 (21164PC)")
+ UNAME_MACHINE="alphapca56" ;;
+ "EV5.7 (21164PC)")
+ UNAME_MACHINE="alphapca57" ;;
+ "EV6 (21264)")
+ UNAME_MACHINE="alphaev6" ;;
+ "EV6.7 (21264A)")
+ UNAME_MACHINE="alphaev67" ;;
+ "EV6.8CB (21264C)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.8AL (21264B)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.8CX (21264D)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.9A (21264/EV69A)")
+ UNAME_MACHINE="alphaev69" ;;
+ "EV7 (21364)")
+ UNAME_MACHINE="alphaev7" ;;
+ "EV7.9 (21364A)")
+ UNAME_MACHINE="alphaev79" ;;
+ esac
+ # A Pn.n version is a patched version.
+ # A Vn.n version is a released version.
+ # A Tn.n version is a released field test version.
+ # A Xn.n version is an unreleased experimental baselevel.
+ # 1.2 uses "1.2" for uname -r.
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
+ exitcode=$?
+ trap '' 0
+ exit $exitcode ;;
+ Alpha\ *:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # Should we change UNAME_MACHINE based on the output of uname instead
+ # of the specific Alpha model?
+ echo alpha-pc-interix
+ exit ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+ exit ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-${VENDOR}-sysv4
+ exit ;;
+ *:[Aa]miga[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-amigaos
+ exit ;;
+ *:[Mm]orph[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-morphos
+ exit ;;
+ *:OS/390:*:*)
+ echo i370-ibm-openedition
+ exit ;;
+ *:z/VM:*:*)
+ echo s390-ibm-zvmoe
+ exit ;;
+ *:OS400:*:*)
+ echo powerpc-ibm-os400
+ exit ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+ exit ;;
+ arm*:riscos:*:*|arm*:RISCOS:*:*)
+ echo arm-${VENDOR}-riscos
+ exit ;;
+ SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+ echo hppa1.1-hitachi-hiuxmpp
+ exit ;;
+ Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+ # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+ if test "`(/bin/universe) 2>/dev/null`" = att ; then
+ echo pyramid-pyramid-sysv3
+ else
+ echo pyramid-pyramid-bsd
+ fi
+ exit ;;
+ NILE*:*:*:dcosx)
+ echo pyramid-pyramid-svr4
+ exit ;;
+ DRS?6000:unix:4.0:6*)
+ echo sparc-icl-nx6
+ exit ;;
+ DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+ case `/usr/bin/uname -p` in
+ sparc) echo sparc-icl-nx7; exit ;;
+ esac ;;
+ s390x:SunOS:*:*)
+ echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4H:SunOS:5.*:*)
+ echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
+ echo i386-pc-auroraux${UNAME_RELEASE}
+ exit ;;
+ i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
+ eval $set_cc_for_build
+ SUN_ARCH="i386"
+ # If there is a compiler, see if it is configured for 64-bit objects.
+ # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
+ # This test works for both compilers.
+ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+ if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
+ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
+ then
+ SUN_ARCH="x86_64"
+ fi
+ fi
+ echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:*:*)
+ case "`/usr/bin/arch -k`" in
+ Series*|S4*)
+ UNAME_RELEASE=`uname -v`
+ ;;
+ esac
+ # Japanese Language versions have a version number like `4.1.3-JL'.
+ echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+ exit ;;
+ sun3*:SunOS:*:*)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ exit ;;
+ sun*:*:4.2BSD:*)
+ UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+ case "`/bin/arch`" in
+ sun3)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ ;;
+ sun4)
+ echo sparc-sun-sunos${UNAME_RELEASE}
+ ;;
+ esac
+ exit ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos${UNAME_RELEASE}
+ exit ;;
+ # The situation for MiNT is a little confusing. The machine name
+ # can be virtually everything (everything which is not
+ # "atarist" or "atariste" at least should have a processor
+ # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
+ # to the lowercase version "mint" (or "freemint"). Finally
+ # the system name "TOS" denotes a system which is actually not
+ # MiNT. But MiNT is downward compatible to TOS, so this should
+ # be no problem.
+ atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+ echo m68k-milan-mint${UNAME_RELEASE}
+ exit ;;
+ hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+ echo m68k-hades-mint${UNAME_RELEASE}
+ exit ;;
+ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+ echo m68k-${VENDOR}-mint${UNAME_RELEASE}
+ exit ;;
+ m68k:machten:*:*)
+ echo m68k-apple-machten${UNAME_RELEASE}
+ exit ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten${UNAME_RELEASE}
+ exit ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+ exit ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix${UNAME_RELEASE}
+ exit ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix${UNAME_RELEASE}
+ exit ;;
+ 2020:CLIX:*:* | 2430:CLIX:*:*)
+ echo clipper-intergraph-clix${UNAME_RELEASE}
+ exit ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+ #if defined (host_mips) && defined (MIPSEB)
+ #if defined (SYSTYPE_SYSV)
+ printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_SVR4)
+ printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+ printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+ #endif
+ #endif
+ exit (-1);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c &&
+ dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+ SYSTEM_NAME=`$dummy $dummyarg` &&
+ { echo "$SYSTEM_NAME"; exit; }
+ echo mips-mips-riscos${UNAME_RELEASE}
+ exit ;;
+ Motorola:PowerMAX_OS:*:*)
+ echo powerpc-motorola-powermax
+ exit ;;
+ Motorola:*:4.3:PL8-*)
+ echo powerpc-harris-powermax
+ exit ;;
+ Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+ echo powerpc-harris-powermax
+ exit ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerunix
+ exit ;;
+ m88k:CX/UX:7*:*)
+ echo m88k-harris-cxux7
+ exit ;;
+ m88k:*:4*:R4*)
+ echo m88k-motorola-sysv4
+ exit ;;
+ m88k:*:3*:R3*)
+ echo m88k-motorola-sysv3
+ exit ;;
+ AViiON:dgux:*:*)
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+ then
+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+ [ ${TARGET_BINARY_INTERFACE}x = x ]
+ then
+ echo m88k-dg-dgux${UNAME_RELEASE}
+ else
+ echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ fi
+ else
+ echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+ exit ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+ exit ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ echo m88k-motorola-sysv3
+ exit ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ echo m88k-tektronix-sysv3
+ exit ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ echo m68k-tektronix-bsd
+ exit ;;
+ *:IRIX*:*:*)
+ echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+ exit ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i*86:AIX:*:*)
+ echo i386-ibm-aix
+ exit ;;
+ ia64:AIX:*:*)
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+ exit ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <sys/systemcfg.h>
+
+ main()
+ {
+ if (!__power_pc())
+ exit(1);
+ puts("powerpc-ibm-aix3.2.5");
+ exit(0);
+ }
+EOF
+ if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+ then
+ echo "$SYSTEM_NAME"
+ else
+ echo rs6000-ibm-aix3.2.5
+ fi
+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ echo rs6000-ibm-aix3.2.4
+ else
+ echo rs6000-ibm-aix3.2
+ fi
+ exit ;;
+ *:AIX:*:[4567])
+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+ if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+ else
+ IBM_ARCH=powerpc
+ fi
+ if [ -x /usr/bin/lslpp ] ; then
+ IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
+ awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+ exit ;;
+ *:AIX:*:*)
+ echo rs6000-ibm-aix
+ exit ;;
+ ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+ echo romp-ibm-bsd4.4
+ exit ;;
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
+ echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
+ exit ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ echo rs6000-bull-bosx
+ exit ;;
+ DPX/2?00:B.O.S.:*:*)
+ echo m68k-bull-sysv3
+ exit ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ echo m68k-hp-bsd
+ exit ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ echo m68k-hp-bsd4.4
+ exit ;;
+ 9000/[34678]??:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ case "${UNAME_MACHINE}" in
+ 9000/31? ) HP_ARCH=m68000 ;;
+ 9000/[34]?? ) HP_ARCH=m68k ;;
+ 9000/[678][0-9][0-9])
+ if [ -x /usr/bin/getconf ]; then
+ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+ case "${sc_cpu_version}" in
+ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+ 532) # CPU_PA_RISC2_0
+ case "${sc_kernel_bits}" in
+ 32) HP_ARCH="hppa2.0n" ;;
+ 64) HP_ARCH="hppa2.0w" ;;
+ '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
+ esac ;;
+ esac
+ fi
+ if [ "${HP_ARCH}" = "" ]; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+
+ #define _HPUX_SOURCE
+ #include <stdlib.h>
+ #include <unistd.h>
+
+ int main ()
+ {
+ #if defined(_SC_KERNEL_BITS)
+ long bits = sysconf(_SC_KERNEL_BITS);
+ #endif
+ long cpu = sysconf (_SC_CPU_VERSION);
+
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+ case CPU_PA_RISC2_0:
+ #if defined(_SC_KERNEL_BITS)
+ switch (bits)
+ {
+ case 64: puts ("hppa2.0w"); break;
+ case 32: puts ("hppa2.0n"); break;
+ default: puts ("hppa2.0"); break;
+ } break;
+ #else /* !defined(_SC_KERNEL_BITS) */
+ puts ("hppa2.0"); break;
+ #endif
+ default: puts ("hppa1.0"); break;
+ }
+ exit (0);
+ }
+EOF
+ (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+ test -z "$HP_ARCH" && HP_ARCH=hppa
+ fi ;;
+ esac
+ if [ ${HP_ARCH} = "hppa2.0w" ]
+ then
+ eval $set_cc_for_build
+
+ # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+ # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
+ # generating 64-bit code. GNU and HP use different nomenclature:
+ #
+ # $ CC_FOR_BUILD=cc ./config.guess
+ # => hppa2.0w-hp-hpux11.23
+ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+ # => hppa64-hp-hpux11.23
+
+ if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+ grep -q __LP64__
+ then
+ HP_ARCH="hppa2.0w"
+ else
+ HP_ARCH="hppa64"
+ fi
+ fi
+ echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ exit ;;
+ ia64:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ia64-hp-hpux${HPUX_REV}
+ exit ;;
+ 3050*:HI-UX:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <unistd.h>
+ int
+ main ()
+ {
+ long cpu = sysconf (_SC_CPU_VERSION);
+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
+ results, however. */
+ if (CPU_IS_PA_RISC (cpu))
+ {
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+ default: puts ("hppa-hitachi-hiuxwe2"); break;
+ }
+ }
+ else if (CPU_IS_HP_MC68K (cpu))
+ puts ("m68k-hitachi-hiuxwe2");
+ else puts ("unknown-hitachi-hiuxwe2");
+ exit (0);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
+ echo unknown-hitachi-hiuxwe2
+ exit ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+ echo hppa1.1-hp-bsd
+ exit ;;
+ 9000/8??:4.3bsd:*:*)
+ echo hppa1.0-hp-bsd
+ exit ;;
+ *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+ echo hppa1.0-hp-mpeix
+ exit ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ echo hppa1.1-hp-osf
+ exit ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+ exit ;;
+ i*86:OSF1:*:*)
+ if [ -x /usr/sbin/sysversion ] ; then
+ echo ${UNAME_MACHINE}-${VENDOR}-osf1mk
+ else
+ echo ${UNAME_MACHINE}-${VENDOR}-osf1
+ fi
+ exit ;;
+ parisc*:Lites*:*:*)
+ echo hppa1.1-hp-lites
+ exit ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+ exit ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+ exit ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+ exit ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+ exit ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*[A-Z]90:*:*:*)
+ echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+ -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*T3E:*:*:*)
+ echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*SV1:*:*:*)
+ echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ *:UNICOS/mp:*:*)
+ echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+ FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
+ 5000:UNIX_System_V:4.*:*)
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
+ i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+ exit ;;
+ sparc*:BSD/OS:*:*)
+ echo sparc-${VENDOR}-bsdi${UNAME_RELEASE}
+ exit ;;
+ *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-bsdi${UNAME_RELEASE}
+ exit ;;
+ *:FreeBSD:*:*)
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ case ${UNAME_PROCESSOR} in
+ amd64)
+ echo x86_64-${VENDOR}-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ *)
+ echo ${UNAME_PROCESSOR}-${VENDOR}-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ esac
+ exit ;;
+ i*:CYGWIN*:*)
+ echo ${UNAME_MACHINE}-pc-cygwin
+ exit ;;
+ *:MINGW64*:*)
+ echo ${UNAME_MACHINE}-pc-mingw64
+ exit ;;
+ *:MINGW*:*)
+ echo ${UNAME_MACHINE}-pc-mingw32
+ exit ;;
+ *:MSYS*:*)
+ echo ${UNAME_MACHINE}-pc-msys
+ exit ;;
+ i*:windows32*:*)
+ # uname -m includes "-pc" on this system.
+ echo ${UNAME_MACHINE}-mingw32
+ exit ;;
+ i*:PW*:*)
+ echo ${UNAME_MACHINE}-pc-pw32
+ exit ;;
+ *:Interix*:*)
+ case ${UNAME_MACHINE} in
+ x86)
+ echo i586-pc-interix${UNAME_RELEASE}
+ exit ;;
+ authenticamd | genuineintel | EM64T)
+ echo x86_64-${VENDOR}-interix${UNAME_RELEASE}
+ exit ;;
+ IA64)
+ echo ia64-${VENDOR}-interix${UNAME_RELEASE}
+ exit ;;
+ esac ;;
+ [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+ echo i${UNAME_MACHINE}-pc-mks
+ exit ;;
+ 8664:Windows_NT:*)
+ echo x86_64-pc-mks
+ exit ;;
+ i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+ # UNAME_MACHINE based on the output of uname instead of i386?
+ echo i586-pc-interix
+ exit ;;
+ i*:UWIN*:*)
+ echo ${UNAME_MACHINE}-pc-uwin
+ exit ;;
+ amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+ echo x86_64-${VENDOR}-cygwin
+ exit ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-${VENDOR}-cygwin
+ exit ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-${VENDOR}-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ *:GNU:*:*)
+ # the GNU system
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-${VENDOR}-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ exit ;;
+ *:GNU/*:*:*)
+ # other systems with GNU libc and userland
+ echo ${UNAME_MACHINE}-${VENDOR}-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
+ exit ;;
+ i*86:Minix:*:*)
+ echo ${UNAME_MACHINE}-pc-minix
+ exit ;;
+ aarch64:Linux:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
+ exit ;;
+ aarch64_be:Linux:*:*)
+ UNAME_MACHINE=aarch64_be
+ echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
+ exit ;;
+ alpha:Linux:*:*)
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ EV5) UNAME_MACHINE=alphaev5 ;;
+ EV56) UNAME_MACHINE=alphaev56 ;;
+ PCA56) UNAME_MACHINE=alphapca56 ;;
+ PCA57) UNAME_MACHINE=alphapca56 ;;
+ EV6) UNAME_MACHINE=alphaev6 ;;
+ EV67) UNAME_MACHINE=alphaev67 ;;
+ EV68*) UNAME_MACHINE=alphaev68 ;;
+ esac
+ objdump --private-headers /bin/sh | grep -q ld.so.1
+ if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
+ echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
+ exit ;;
+ arc:Linux:*:* | arceb:Linux:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
+ exit ;;
+ arm*:Linux:*:*)
+ eval $set_cc_for_build
+ if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep -q __ARM_EABI__
+ then
+ echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
+ else
+ if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep -q __ARM_PCS_VFP
+ then
+ echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}eabi
+ else
+ echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}eabihf
+ fi
+ fi
+ exit ;;
+ avr32*:Linux:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
+ exit ;;
+ cris:Linux:*:*)
+ echo ${UNAME_MACHINE}-axis-linux-${LIBC}
+ exit ;;
+ crisv32:Linux:*:*)
+ echo ${UNAME_MACHINE}-axis-linux-${LIBC}
+ exit ;;
+ frv:Linux:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
+ exit ;;
+ hexagon:Linux:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
+ exit ;;
+ i*86:Linux:*:*)
+ echo ${UNAME_MACHINE}-pc-linux-${LIBC}
+ exit ;;
+ ia64:Linux:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
+ exit ;;
+ m32r*:Linux:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
+ exit ;;
+ m68*:Linux:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
+ exit ;;
+ mips:Linux:*:* | mips64:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef ${UNAME_MACHINE}
+ #undef ${UNAME_MACHINE}el
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=${UNAME_MACHINE}el
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=${UNAME_MACHINE}
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
+ test x"${CPU}" != x && { echo "${CPU}-${VENDOR}-linux-${LIBC}"; exit; }
+ ;;
+ openrisc*:Linux:*:*)
+ echo or1k-${VENDOR}-linux-${LIBC}
+ exit ;;
+ or32:Linux:*:* | or1k*:Linux:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
+ exit ;;
+ padre:Linux:*:*)
+ echo sparc-${VENDOR}-linux-${LIBC}
+ exit ;;
+ parisc64:Linux:*:* | hppa64:Linux:*:*)
+ echo hppa64-${VENDOR}-linux-${LIBC}
+ exit ;;
+ parisc:Linux:*:* | hppa:Linux:*:*)
+ # Look for CPU level
+ case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+ PA7*) echo hppa1.1-${VENDOR}-linux-${LIBC} ;;
+ PA8*) echo hppa2.0-${VENDOR}-linux-${LIBC} ;;
+ *) echo hppa-${VENDOR}-linux-${LIBC} ;;
+ esac
+ exit ;;
+ ppc64:Linux:*:*)
+ echo powerpc64-${VENDOR}-linux-${LIBC}
+ exit ;;
+ ppc:Linux:*:*)
+ echo powerpc-${VENDOR}-linux-${LIBC}
+ exit ;;
+ ppc64le:Linux:*:*)
+ echo powerpc64le-${VENDOR}-linux-${LIBC}
+ exit ;;
+ ppcle:Linux:*:*)
+ echo powerpcle-${VENDOR}-linux-${LIBC}
+ exit ;;
+ s390:Linux:*:* | s390x:Linux:*:*)
+ echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
+ exit ;;
+ sh64*:Linux:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
+ exit ;;
+ sh*:Linux:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
+ exit ;;
+ sparc:Linux:*:* | sparc64:Linux:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
+ exit ;;
+ tile*:Linux:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
+ exit ;;
+ vax:Linux:*:*)
+ echo ${UNAME_MACHINE}-dec-linux-${LIBC}
+ exit ;;
+ x86_64:Linux:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
+ exit ;;
+ xtensa*:Linux:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}
+ exit ;;
+ i*86:DYNIX/ptx:4*:*)
+ # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+ # earlier versions are messed up and put the nodename in both
+ # sysname and nodename.
+ echo i386-sequent-sysv4
+ exit ;;
+ i*86:UNIX_SV:4.2MP:2.*)
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+ # I am not positive that other SVR4 systems won't match this,
+ # I just have to hope. -- rms.
+ # Use sysv4.2uw... so that sysv4* matches it.
+ echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ exit ;;
+ i*86:OS/2:*:*)
+ # If we were able to find `uname', then EMX Unix compatibility
+ # is probably installed.
+ echo ${UNAME_MACHINE}-pc-os2-emx
+ exit ;;
+ i*86:XTS-300:*:STOP)
+ echo ${UNAME_MACHINE}-${VENDOR}-stop
+ exit ;;
+ i*86:atheos:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-atheos
+ exit ;;
+ i*86:syllable:*:*)
+ echo ${UNAME_MACHINE}-pc-syllable
+ exit ;;
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
+ echo i386-${VENODR}-lynxos${UNAME_RELEASE}
+ exit ;;
+ i*86:*DOS:*:*)
+ echo ${UNAME_MACHINE}-pc-msdosdjgpp
+ exit ;;
+ i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+ UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+ fi
+ exit ;;
+ i*86:*:5:[678]*)
+ # UnixWare 7.x, OpenUNIX and OpenServer 6.
+ case `/bin/uname -X | grep "^Machine"` in
+ *486*) UNAME_MACHINE=i486 ;;
+ *Pentium) UNAME_MACHINE=i586 ;;
+ *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+ esac
+ echo ${UNAME_MACHINE}-${VENDOR}-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+ exit ;;
+ i*86:*:3.2:*)
+ if test -f /usr/options/cb.name; then
+ UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+ elif /bin/uname -X 2>/dev/null >/dev/null ; then
+ UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+ && UNAME_MACHINE=i686
+ (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+ && UNAME_MACHINE=i686
+ echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ else
+ echo ${UNAME_MACHINE}-pc-sysv32
+ fi
+ exit ;;
+ pc:*:*:*)
+ # Left here for compatibility:
+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
+ # the processor, so we play safe by assuming i586.
+ # Note: whatever this is, it MUST be the same as what config.sub
+ # prints for the "djgpp" host, or else GDB configury will decide that
+ # this is a cross-build.
+ echo i586-pc-msdosdjgpp
+ exit ;;
+ Intel:Mach:3*:*)
+ echo i386-pc-mach3
+ exit ;;
+ paragon:*:*:*)
+ echo i860-intel-osf1
+ exit ;;
+ i860:*:4.*:*) # i860-SVR4
+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+ echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ echo i860-${VENODR}-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ fi
+ exit ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+ exit ;;
+ mc68k:UNIX:SYSTEM5:3.51m)
+ echo m68k-convergent-sysv
+ exit ;;
+ M680?0:D-NIX:5.3:*)
+ echo m68k-diab-dnix
+ exit ;;
+ M68*:*:R3V[5678]*:*)
+ test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+ 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4; exit; } ;;
+ NCR*:*:4.2:* | MPRAS*:*:4.2:*)
+ OS_REL='.3'
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+ m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+ echo m68k-${VENDOR}-lynxos${UNAME_RELEASE}
+ exit ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+ exit ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-${VENDOR}-lynxos${UNAME_RELEASE}
+ exit ;;
+ rs6000:LynxOS:2.*:*)
+ echo rs6000-${VENDOR}-lynxos${UNAME_RELEASE}
+ exit ;;
+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
+ echo powerpc-${VENDOR}-lynxos${UNAME_RELEASE}
+ exit ;;
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv${UNAME_RELEASE}
+ exit ;;
+ RM*:ReliantUNIX-*:*:*)
+ echo mips-sni-sysv4
+ exit ;;
+ RM*:SINIX-*:*:*)
+ echo mips-sni-sysv4
+ exit ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ echo ${UNAME_MACHINE}-sni-sysv4
+ else
+ echo ns32k-sni-sysv
+ fi
+ exit ;;
+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes <hewes@openmarket.com>.
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+ exit ;;
+ *:*:*:FTX*)
+ # From seanf@swdc.stratus.com.
+ echo i860-stratus-sysv4
+ exit ;;
+ i*86:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo ${UNAME_MACHINE}-stratus-vos
+ exit ;;
+ *:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo hppa1.1-stratus-vos
+ exit ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+ exit ;;
+ news*:NEWS-OS:6*:*)
+ echo mips-sony-newsos6
+ exit ;;
+ R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+ if [ -d /usr/nec ]; then
+ echo mips-nec-sysv${UNAME_RELEASE}
+ else
+ echo mips-${VENDOR}-sysv${UNAME_RELEASE}
+ fi
+ exit ;;
+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
+ echo powerpc-be-beos
+ exit ;;
+ BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
+ echo powerpc-apple-beos
+ exit ;;
+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
+ echo i586-pc-beos
+ exit ;;
+ BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
+ echo i586-pc-haiku
+ exit ;;
+ x86_64:Haiku:*:*)
+ echo x86_64-${VENDOR}-haiku
+ exit ;;
+ SX-4:SUPER-UX:*:*)
+ echo sx4-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-5:SUPER-UX:*:*)
+ echo sx5-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-6:SUPER-UX:*:*)
+ echo sx6-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-7:SUPER-UX:*:*)
+ echo sx7-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-8:SUPER-UX:*:*)
+ echo sx8-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-8R:SUPER-UX:*:*)
+ echo sx8r-nec-superux${UNAME_RELEASE}
+ exit ;;
+ Power*:Rhapsody:*:*)
+ echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ exit ;;
+ *:Rhapsody:*:*)
+ echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+ exit ;;
+ *:Darwin:*:*)
+ UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+ eval $set_cc_for_build
+ if test "$UNAME_PROCESSOR" = unknown ; then
+ UNAME_PROCESSOR=powerpc
+ fi
+ if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
+ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
+ then
+ case $UNAME_PROCESSOR in
+ i386) UNAME_PROCESSOR=x86_64 ;;
+ powerpc) UNAME_PROCESSOR=powerpc64 ;;
+ esac
+ fi
+ fi
+ elif test "$UNAME_PROCESSOR" = i386 ; then
+ # Avoid executing cc on OS X 10.9, as it ships with a stub
+ # that puts up a graphical alert prompting to install
+ # developer tools. Any system running Mac OS X 10.7 or
+ # later (Darwin 11 and later) is required to have a 64-bit
+ # processor. This is not true of the ARM version of Darwin
+ # that Apple uses in portable devices.
+ UNAME_PROCESSOR=x86_64
+ fi
+ echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+ exit ;;
+ *:procnto*:*:* | *:QNX:[0123456789]*:*)
+ UNAME_PROCESSOR=`uname -p`
+ if test "$UNAME_PROCESSOR" = "x86"; then
+ UNAME_PROCESSOR=i386
+ UNAME_MACHINE=pc
+ fi
+ echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+ exit ;;
+ *:QNX:*:4*)
+ echo i386-pc-qnx
+ exit ;;
+ NEO-?:NONSTOP_KERNEL:*:*)
+ echo neo-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ NSE-*:NONSTOP_KERNEL:*:*)
+ echo nse-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ NSR-?:NONSTOP_KERNEL:*:*)
+ echo nsr-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ *:NonStop-UX:*:*)
+ echo mips-compaq-nonstopux
+ exit ;;
+ BS2000:POSIX*:*:*)
+ echo bs2000-siemens-sysv
+ exit ;;
+ DS/*:UNIX_System_V:*:*)
+ echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+ exit ;;
+ *:Plan9:*:*)
+ # "uname -m" is not consistent, so use $cputype instead. 386
+ # is converted to i386 for consistency with other x86
+ # operating systems.
+ if test "$cputype" = "386"; then
+ UNAME_MACHINE=i386
+ else
+ UNAME_MACHINE="$cputype"
+ fi
+ echo ${UNAME_MACHINE}-${VENDOR}-plan9
+ exit ;;
+ *:TOPS-10:*:*)
+ echo pdp10-${VENDOR}-tops10
+ exit ;;
+ *:TENEX:*:*)
+ echo pdp10-${VENDOR}-tenex
+ exit ;;
+ KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+ echo pdp10-dec-tops20
+ exit ;;
+ XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+ echo pdp10-xkl-tops20
+ exit ;;
+ *:TOPS-20:*:*)
+ echo pdp10-${VENDOR}-tops20
+ exit ;;
+ *:ITS:*:*)
+ echo pdp10-${VENDOR}-its
+ exit ;;
+ SEI:*:*:SEIUX)
+ echo mips-sei-seiux${UNAME_RELEASE}
+ exit ;;
+ *:DragonFly:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit ;;
+ *:*VMS:*:*)
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ case "${UNAME_MACHINE}" in
+ A*) echo alpha-dec-vms ; exit ;;
+ I*) echo ia64-dec-vms ; exit ;;
+ V*) echo vax-dec-vms ; exit ;;
+ esac ;;
+ *:XENIX:*:SysV)
+ echo i386-pc-xenix
+ exit ;;
+ i*86:skyos:*:*)
+ echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+ exit ;;
+ i*86:rdos:*:*)
+ echo ${UNAME_MACHINE}-pc-rdos
+ exit ;;
+ i*86:AROS:*:*)
+ echo ${UNAME_MACHINE}-pc-aros
+ exit ;;
+ x86_64:VMkernel:*:*)
+ echo ${UNAME_MACHINE}-${VENDOR}-esx
+ exit ;;
+esac
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+and
+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo = `(hostinfo) 2>/dev/null`
+/bin/universe = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/build-aux/config.sub b/build-aux/config.sub
new file mode 100755
index 0000000..7ffe373
--- /dev/null
+++ b/build-aux/config.sub
@@ -0,0 +1,1807 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+# Copyright 1992-2014 Free Software Foundation, Inc.
+
+timestamp='2014-12-03'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# 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; if not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that
+# program. This Exception is an additional permission under section 7
+# of the GNU General Public License, version 3 ("GPLv3").
+
+
+# Please send patches to <config-patches@gnu.org>.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support. The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+ $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright 1992-2014 Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit ;;
+ --version | -v )
+ echo "$version" ; exit ;;
+ --help | --h* | -h )
+ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help"
+ exit 1 ;;
+
+ *local*)
+ # First pass through any local machine types.
+ echo $1
+ exit ;;
+
+ * )
+ break ;;
+ esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+ exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+ exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+ nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
+ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+ knetbsd*-gnu* | netbsd*-gnu* | \
+ kopensolaris*-gnu* | \
+ storm-chaos* | os2-emx* | rtmk-nova*)
+ os=-$maybe_os
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
+ android-linux)
+ os=-linux-android
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
+ ;;
+ *)
+ basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+ if [ $basic_machine != $1 ]
+ then os=`echo $1 | sed 's/.*-/-/'`
+ else os=; fi
+ ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work. We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+ -sun*os*)
+ # Prevent following clause from handling this invalid input.
+ ;;
+ -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+ -apple | -axis | -knuth | -cray | -microblaze*)
+ os=
+ basic_machine=$1
+ ;;
+ -bluegene*)
+ os=-cnk
+ ;;
+ -sim | -cisco | -oki | -wec | -winbond)
+ os=
+ basic_machine=$1
+ ;;
+ -scout)
+ ;;
+ -wrs)
+ os=-vxworks
+ basic_machine=$1
+ ;;
+ -chorusos*)
+ os=-chorusos
+ basic_machine=$1
+ ;;
+ -chorusrdb)
+ os=-chorusrdb
+ basic_machine=$1
+ ;;
+ -hiux*)
+ os=-hiuxwe2
+ ;;
+ -sco6)
+ os=-sco5v6
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco5)
+ os=-sco3.2v5
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco4)
+ os=-sco3.2v4
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2.[4-9]*)
+ os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2v[4-9]*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco5v6*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco*)
+ os=-sco3.2v2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -udk*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -isc)
+ os=-isc2.2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -clix*)
+ basic_machine=clipper-intergraph
+ ;;
+ -isc*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -lynx*178)
+ os=-lynxos178
+ ;;
+ -lynx*5)
+ os=-lynxos5
+ ;;
+ -lynx*)
+ os=-lynxos
+ ;;
+ -ptx*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+ ;;
+ -windowsnt*)
+ os=`echo $os | sed -e 's/windowsnt/winnt/'`
+ ;;
+ -psos*)
+ os=-psos
+ ;;
+ -mint | -mint[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+ # Recognize the basic CPU types without company name.
+ # Some are omitted here because they have special meanings below.
+ 1750a | 580 \
+ | a29k \
+ | aarch64 | aarch64_be \
+ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+ | am33_2.0 \
+ | arc | arceb \
+ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
+ | avr | avr32 \
+ | be32 | be64 \
+ | bfin \
+ | c4x | c8051 | clipper \
+ | d10v | d30v | dlx | dsp16xx \
+ | epiphany \
+ | fido | fr30 | frv \
+ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ | hexagon \
+ | i370 | i860 | i960 | ia64 \
+ | ip2k | iq2000 \
+ | k1om \
+ | le32 | le64 \
+ | lm32 \
+ | m32c | m32r | m32rle | m68000 | m68k | m88k \
+ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \
+ | mips | mipsbe | mipseb | mipsel | mipsle \
+ | mips16 \
+ | mips64 | mips64el \
+ | mips64octeon | mips64octeonel \
+ | mips64orion | mips64orionel \
+ | mips64r5900 | mips64r5900el \
+ | mips64vr | mips64vrel \
+ | mips64vr4100 | mips64vr4100el \
+ | mips64vr4300 | mips64vr4300el \
+ | mips64vr5000 | mips64vr5000el \
+ | mips64vr5900 | mips64vr5900el \
+ | mipsisa32 | mipsisa32el \
+ | mipsisa32r2 | mipsisa32r2el \
+ | mipsisa32r6 | mipsisa32r6el \
+ | mipsisa64 | mipsisa64el \
+ | mipsisa64r2 | mipsisa64r2el \
+ | mipsisa64r6 | mipsisa64r6el \
+ | mipsisa64sb1 | mipsisa64sb1el \
+ | mipsisa64sr71k | mipsisa64sr71kel \
+ | mipsr5900 | mipsr5900el \
+ | mipstx39 | mipstx39el \
+ | mn10200 | mn10300 \
+ | moxie \
+ | mt \
+ | msp430 \
+ | nds32 | nds32le | nds32be \
+ | nios | nios2 | nios2eb | nios2el \
+ | ns16k | ns32k \
+ | open8 | or1k | or1knd | or32 \
+ | pdp10 | pdp11 | pj | pjl \
+ | powerpc | powerpc64 | powerpc64le | powerpcle \
+ | pyramid \
+ | riscv32 | riscv64 \
+ | rl78 | rx \
+ | score \
+ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+ | sh64 | sh64le \
+ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+ | spu \
+ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
+ | ubicom32 \
+ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
+ | visium \
+ | we32k \
+ | x86 | xc16x | xstormy16 | xtensa \
+ | z8k | z80)
+ basic_machine=$basic_machine-unknown
+ ;;
+ c54x)
+ basic_machine=tic54x-unknown
+ ;;
+ c55x)
+ basic_machine=tic55x-unknown
+ ;;
+ c6x)
+ basic_machine=tic6x-unknown
+ ;;
+ leon|leon[3-9])
+ basic_machine=sparc-$basic_machine
+ ;;
+ m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
+ m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+ ;;
+ ms1)
+ basic_machine=mt-unknown
+ ;;
+
+ strongarm | thumb | xscale)
+ basic_machine=arm-unknown
+ ;;
+ xgate)
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
+ xscaleeb)
+ basic_machine=armeb-unknown
+ ;;
+
+ xscaleel)
+ basic_machine=armel-unknown
+ ;;
+
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+ # (2) the word "unknown" tends to confuse beginning users.
+ i*86 | x86_64)
+ basic_machine=$basic_machine-pc
+ ;;
+ # Object if more than one company name word.
+ *-*-*)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+ # Recognize the basic CPU types with company name.
+ 580-* \
+ | a29k-* \
+ | aarch64-* | aarch64_be-* \
+ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
+ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
+ | avr-* | avr32-* \
+ | be32-* | be64-* \
+ | bfin-* | bs2000-* \
+ | c[123]* | c30-* | [cjt]90-* | c4x-* \
+ | c8051-* | clipper-* | craynv-* | cydra-* \
+ | d10v-* | d30v-* | dlx-* \
+ | elxsi-* \
+ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+ | h8300-* | h8500-* \
+ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+ | hexagon-* \
+ | i*86-* | i860-* | i960-* | ia64-* \
+ | ip2k-* | iq2000-* \
+ | k1om-* \
+ | le32-* | le64-* \
+ | lm32-* \
+ | m32c-* | m32r-* | m32rle-* \
+ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
+ | microblaze-* | microblazeel-* \
+ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+ | mips16-* \
+ | mips64-* | mips64el-* \
+ | mips64octeon-* | mips64octeonel-* \
+ | mips64orion-* | mips64orionel-* \
+ | mips64r5900-* | mips64r5900el-* \
+ | mips64vr-* | mips64vrel-* \
+ | mips64vr4100-* | mips64vr4100el-* \
+ | mips64vr4300-* | mips64vr4300el-* \
+ | mips64vr5000-* | mips64vr5000el-* \
+ | mips64vr5900-* | mips64vr5900el-* \
+ | mipsisa32-* | mipsisa32el-* \
+ | mipsisa32r2-* | mipsisa32r2el-* \
+ | mipsisa32r6-* | mipsisa32r6el-* \
+ | mipsisa64-* | mipsisa64el-* \
+ | mipsisa64r2-* | mipsisa64r2el-* \
+ | mipsisa64r6-* | mipsisa64r6el-* \
+ | mipsisa64sb1-* | mipsisa64sb1el-* \
+ | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+ | mipsr5900-* | mipsr5900el-* \
+ | mipstx39-* | mipstx39el-* \
+ | mmix-* \
+ | mt-* \
+ | msp430-* \
+ | nds32-* | nds32le-* | nds32be-* \
+ | nios-* | nios2-* | nios2eb-* | nios2el-* \
+ | none-* | np1-* | ns16k-* | ns32k-* \
+ | open8-* \
+ | or1k*-* \
+ | orion-* \
+ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
+ | pyramid-* \
+ | rl78-* | romp-* | rs6000-* | rx-* \
+ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+ | sparclite-* \
+ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
+ | tahoe-* \
+ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+ | tile*-* \
+ | tron-* \
+ | ubicom32-* \
+ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
+ | vax-* \
+ | visium-* \
+ | we32k-* \
+ | x86-* | x86_64-* | xc16x-* | xps100-* \
+ | xstormy16-* | xtensa*-* \
+ | ymp-* \
+ | z8k-* | z80-*)
+ ;;
+ # Recognize the basic CPU types without company name, with glob match.
+ xtensa*)
+ basic_machine=$basic_machine-unknown
+ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+ 386bsd)
+ basic_machine=i386-unknown
+ os=-bsd
+ ;;
+ 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+ basic_machine=m68000-att
+ ;;
+ 3b*)
+ basic_machine=we32k-att
+ ;;
+ a29khif)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ abacus)
+ basic_machine=abacus-unknown
+ ;;
+ adobe68k)
+ basic_machine=m68010-adobe
+ os=-scout
+ ;;
+ alliant | fx80)
+ basic_machine=fx80-alliant
+ ;;
+ altos | altos3068)
+ basic_machine=m68k-altos
+ ;;
+ am29k)
+ basic_machine=a29k-none
+ os=-bsd
+ ;;
+ amd64)
+ basic_machine=x86_64-pc
+ ;;
+ amd64-*)
+ basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ amdahl)
+ basic_machine=580-amdahl
+ os=-sysv
+ ;;
+ amiga | amiga-*)
+ basic_machine=m68k-unknown
+ ;;
+ amigaos | amigados)
+ basic_machine=m68k-unknown
+ os=-amigaos
+ ;;
+ amigaunix | amix)
+ basic_machine=m68k-unknown
+ os=-sysv4
+ ;;
+ apollo68)
+ basic_machine=m68k-apollo
+ os=-sysv
+ ;;
+ apollo68bsd)
+ basic_machine=m68k-apollo
+ os=-bsd
+ ;;
+ aros)
+ basic_machine=i386-pc
+ os=-aros
+ ;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+ ;;
+ balance)
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
+ blackfin)
+ basic_machine=bfin-unknown
+ os=-linux
+ ;;
+ blackfin-*)
+ basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+ os=-linux
+ ;;
+ bluegene*)
+ basic_machine=powerpc-ibm
+ os=-cnk
+ ;;
+ c54x-*)
+ basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ c55x-*)
+ basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ c6x-*)
+ basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ c90)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
+ cegcc)
+ basic_machine=arm-unknown
+ os=-cegcc
+ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ os=-bsd
+ ;;
+ convex-c2)
+ basic_machine=c2-convex
+ os=-bsd
+ ;;
+ convex-c32)
+ basic_machine=c32-convex
+ os=-bsd
+ ;;
+ convex-c34)
+ basic_machine=c34-convex
+ os=-bsd
+ ;;
+ convex-c38)
+ basic_machine=c38-convex
+ os=-bsd
+ ;;
+ cray | j90)
+ basic_machine=j90-cray
+ os=-unicos
+ ;;
+ craynv)
+ basic_machine=craynv-cray
+ os=-unicosmp
+ ;;
+ cr16 | cr16-*)
+ basic_machine=cr16-unknown
+ os=-elf
+ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ ;;
+ crisv32 | crisv32-* | etraxfs*)
+ basic_machine=crisv32-axis
+ ;;
+ cris | cris-* | etrax*)
+ basic_machine=cris-axis
+ ;;
+ crx)
+ basic_machine=crx-unknown
+ os=-elf
+ ;;
+ da30 | da30-*)
+ basic_machine=m68k-da30
+ ;;
+ decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+ basic_machine=mips-dec
+ ;;
+ decsystem10* | dec10*)
+ basic_machine=pdp10-dec
+ os=-tops10
+ ;;
+ decsystem20* | dec20*)
+ basic_machine=pdp10-dec
+ os=-tops20
+ ;;
+ delta | 3300 | motorola-3300 | motorola-delta \
+ | 3300-motorola | delta-motorola)
+ basic_machine=m68k-motorola
+ ;;
+ delta88)
+ basic_machine=m88k-motorola
+ os=-sysv3
+ ;;
+ dicos)
+ basic_machine=i686-pc
+ os=-dicos
+ ;;
+ djgpp)
+ basic_machine=i586-pc
+ os=-msdosdjgpp
+ ;;
+ dpx20 | dpx20-*)
+ basic_machine=rs6000-bull
+ os=-bosx
+ ;;
+ dpx2* | dpx2*-bull)
+ basic_machine=m68k-bull
+ os=-sysv3
+ ;;
+ ebmon29k)
+ basic_machine=a29k-amd
+ os=-ebmon
+ ;;
+ elxsi)
+ basic_machine=elxsi-elxsi
+ os=-bsd
+ ;;
+ encore | umax | mmax)
+ basic_machine=ns32k-encore
+ ;;
+ es1800 | OSE68k | ose68k | ose | OSE)
+ basic_machine=m68k-ericsson
+ os=-ose
+ ;;
+ fx2800)
+ basic_machine=i860-alliant
+ ;;
+ genix)
+ basic_machine=ns32k-ns
+ ;;
+ gmicro)
+ basic_machine=tron-gmicro
+ os=-sysv
+ ;;
+ go32)
+ basic_machine=i386-pc
+ os=-go32
+ ;;
+ h3050r* | hiux*)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ h8300hms)
+ basic_machine=h8300-hitachi
+ os=-hms
+ ;;
+ h8300xray)
+ basic_machine=h8300-hitachi
+ os=-xray
+ ;;
+ h8500hms)
+ basic_machine=h8500-hitachi
+ os=-hms
+ ;;
+ harris)
+ basic_machine=m88k-harris
+ os=-sysv3
+ ;;
+ hp300-*)
+ basic_machine=m68k-hp
+ ;;
+ hp300bsd)
+ basic_machine=m68k-hp
+ os=-bsd
+ ;;
+ hp300hpux)
+ basic_machine=m68k-hp
+ os=-hpux
+ ;;
+ hp3k9[0-9][0-9] | hp9[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k2[0-9][0-9] | hp9k31[0-9])
+ basic_machine=m68000-hp
+ ;;
+ hp9k3[2-9][0-9])
+ basic_machine=m68k-hp
+ ;;
+ hp9k6[0-9][0-9] | hp6[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k7[0-79][0-9] | hp7[0-79][0-9])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k78[0-9] | hp78[0-9])
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][13679] | hp8[0-9][13679])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][0-9] | hp8[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hppa-next)
+ os=-nextstep3
+ ;;
+ hppaosf)
+ basic_machine=hppa1.1-hp
+ os=-osf
+ ;;
+ hppro)
+ basic_machine=hppa1.1-hp
+ os=-proelf
+ ;;
+ i370-ibm* | ibm*)
+ basic_machine=i370-ibm
+ ;;
+ i*86v32)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv32
+ ;;
+ i*86v4*)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv4
+ ;;
+ i*86v)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv
+ ;;
+ i*86sol2)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-solaris2
+ ;;
+ i386mach)
+ basic_machine=i386-mach
+ os=-mach
+ ;;
+ i386-vsta | vsta)
+ basic_machine=i386-unknown
+ os=-vsta
+ ;;
+ iris | iris4d)
+ basic_machine=mips-sgi
+ case $os in
+ -irix*)
+ ;;
+ *)
+ os=-irix4
+ ;;
+ esac
+ ;;
+ isi68 | isi)
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
+ leon-*|leon[3-9]-*)
+ basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
+ ;;
+ m68knommu)
+ basic_machine=m68k-unknown
+ os=-linux
+ ;;
+ m68knommu-*)
+ basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+ os=-linux
+ ;;
+ m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+ magnum | m3230)
+ basic_machine=mips-mips
+ os=-sysv
+ ;;
+ merlin)
+ basic_machine=ns32k-utek
+ os=-sysv
+ ;;
+ microblaze*)
+ basic_machine=microblaze-xilinx
+ ;;
+ mingw64)
+ basic_machine=x86_64-pc
+ os=-mingw64
+ ;;
+ mingw32)
+ basic_machine=i686-pc
+ os=-mingw32
+ ;;
+ mingw32ce)
+ basic_machine=arm-unknown
+ os=-mingw32ce
+ ;;
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+ *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+ mips3*-*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ ;;
+ mips3*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ ;;
+ monitor)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ morphos)
+ basic_machine=powerpc-unknown
+ os=-morphos
+ ;;
+ moxiebox)
+ basic_machine=moxie-unknown
+ os=-moxiebox
+ ;;
+ msdos)
+ basic_machine=i386-pc
+ os=-msdos
+ ;;
+ ms1-*)
+ basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+ ;;
+ msys)
+ basic_machine=i686-pc
+ os=-msys
+ ;;
+ mvs)
+ basic_machine=i370-ibm
+ os=-mvs
+ ;;
+ nacl)
+ basic_machine=le32-unknown
+ os=-nacl
+ ;;
+ ncr3000)
+ basic_machine=i486-ncr
+ os=-sysv4
+ ;;
+ netbsd386)
+ basic_machine=i386-unknown
+ os=-netbsd
+ ;;
+ netwinder)
+ basic_machine=armv4l-rebel
+ os=-linux
+ ;;
+ news | news700 | news800 | news900)
+ basic_machine=m68k-sony
+ os=-newsos
+ ;;
+ news1000)
+ basic_machine=m68030-sony
+ os=-newsos
+ ;;
+ news-3600 | risc-news)
+ basic_machine=mips-sony
+ os=-newsos
+ ;;
+ necv70)
+ basic_machine=v70-nec
+ os=-sysv
+ ;;
+ next | m*-next )
+ basic_machine=m68k-next
+ case $os in
+ -nextstep* )
+ ;;
+ -ns2*)
+ os=-nextstep2
+ ;;
+ *)
+ os=-nextstep3
+ ;;
+ esac
+ ;;
+ nh3000)
+ basic_machine=m68k-harris
+ os=-cxux
+ ;;
+ nh[45]000)
+ basic_machine=m88k-harris
+ os=-cxux
+ ;;
+ nindy960)
+ basic_machine=i960-intel
+ os=-nindy
+ ;;
+ mon960)
+ basic_machine=i960-intel
+ os=-mon960
+ ;;
+ nonstopux)
+ basic_machine=mips-compaq
+ os=-nonstopux
+ ;;
+ np1)
+ basic_machine=np1-gould
+ ;;
+ neo-tandem)
+ basic_machine=neo-tandem
+ ;;
+ nse-tandem)
+ basic_machine=nse-tandem
+ ;;
+ nsr-tandem)
+ basic_machine=nsr-tandem
+ ;;
+ op50n-* | op60c-*)
+ basic_machine=hppa1.1-oki
+ os=-proelf
+ ;;
+ openrisc | openrisc-*)
+ basic_machine=or32-unknown
+ ;;
+ os400)
+ basic_machine=powerpc-ibm
+ os=-os400
+ ;;
+ OSE68000 | ose68000)
+ basic_machine=m68000-ericsson
+ os=-ose
+ ;;
+ os68k)
+ basic_machine=m68k-none
+ os=-os68k
+ ;;
+ pa-hitachi)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ paragon)
+ basic_machine=i860-intel
+ os=-osf
+ ;;
+ parisc)
+ basic_machine=hppa-unknown
+ os=-linux
+ ;;
+ parisc-*)
+ basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+ os=-linux
+ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+ pbb)
+ basic_machine=m68k-tti
+ ;;
+ pc532 | pc532-*)
+ basic_machine=ns32k-pc532
+ ;;
+ pc98)
+ basic_machine=i386-pc
+ ;;
+ pc98-*)
+ basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentium | p5 | k5 | k6 | nexgen | viac3)
+ basic_machine=i586-pc
+ ;;
+ pentiumpro | p6 | 6x86 | athlon | athlon_*)
+ basic_machine=i686-pc
+ ;;
+ pentiumii | pentium2 | pentiumiii | pentium3)
+ basic_machine=i686-pc
+ ;;
+ pentium4)
+ basic_machine=i786-pc
+ ;;
+ pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+ basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumpro-* | p6-* | 6x86-* | athlon-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentium4-*)
+ basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pn)
+ basic_machine=pn-gould
+ ;;
+ power) basic_machine=power-ibm
+ ;;
+ ppc | ppcbe) basic_machine=powerpc-unknown
+ ;;
+ ppc-* | ppcbe-*)
+ basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppcle | powerpclittle | ppc-le | powerpc-little)
+ basic_machine=powerpcle-unknown
+ ;;
+ ppcle-* | powerpclittle-*)
+ basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64) basic_machine=powerpc64-unknown
+ ;;
+ ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+ basic_machine=powerpc64le-unknown
+ ;;
+ ppc64le-* | powerpc64little-*)
+ basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ps2)
+ basic_machine=i386-ibm
+ ;;
+ pw32)
+ basic_machine=i586-unknown
+ os=-pw32
+ ;;
+ rdos | rdos64)
+ basic_machine=x86_64-pc
+ os=-rdos
+ ;;
+ rdos32)
+ basic_machine=i386-pc
+ os=-rdos
+ ;;
+ rom68k)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ rm[46]00)
+ basic_machine=mips-siemens
+ ;;
+ rtpc | rtpc-*)
+ basic_machine=romp-ibm
+ ;;
+ s390 | s390-*)
+ basic_machine=s390-ibm
+ ;;
+ s390x | s390x-*)
+ basic_machine=s390x-ibm
+ ;;
+ sa29200)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ sb1)
+ basic_machine=mipsisa64sb1-unknown
+ ;;
+ sb1el)
+ basic_machine=mipsisa64sb1el-unknown
+ ;;
+ sde)
+ basic_machine=mipsisa32-sde
+ os=-elf
+ ;;
+ sei)
+ basic_machine=mips-sei
+ os=-seiux
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ ;;
+ sh)
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
+ sh5el)
+ basic_machine=sh5le-unknown
+ ;;
+ sh64)
+ basic_machine=sh64-unknown
+ ;;
+ sparclite-wrs | simso-wrs)
+ basic_machine=sparclite-wrs
+ os=-vxworks
+ ;;
+ sps7)
+ basic_machine=m68k-bull
+ os=-sysv2
+ ;;
+ spur)
+ basic_machine=spur-unknown
+ ;;
+ st2000)
+ basic_machine=m68k-tandem
+ ;;
+ stratus)
+ basic_machine=i860-stratus
+ os=-sysv4
+ ;;
+ strongarm-* | thumb-*)
+ basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ sun2)
+ basic_machine=m68000-sun
+ ;;
+ sun2os3)
+ basic_machine=m68000-sun
+ os=-sunos3
+ ;;
+ sun2os4)
+ basic_machine=m68000-sun
+ os=-sunos4
+ ;;
+ sun3os3)
+ basic_machine=m68k-sun
+ os=-sunos3
+ ;;
+ sun3os4)
+ basic_machine=m68k-sun
+ os=-sunos4
+ ;;
+ sun4os3)
+ basic_machine=sparc-sun
+ os=-sunos3
+ ;;
+ sun4os4)
+ basic_machine=sparc-sun
+ os=-sunos4
+ ;;
+ sun4sol2)
+ basic_machine=sparc-sun
+ os=-solaris2
+ ;;
+ sun3 | sun3-*)
+ basic_machine=m68k-sun
+ ;;
+ sun4)
+ basic_machine=sparc-sun
+ ;;
+ sun386 | sun386i | roadrunner)
+ basic_machine=i386-sun
+ ;;
+ sv1)
+ basic_machine=sv1-cray
+ os=-unicos
+ ;;
+ symmetry)
+ basic_machine=i386-sequent
+ os=-dynix
+ ;;
+ t3e)
+ basic_machine=alphaev5-cray
+ os=-unicos
+ ;;
+ t90)
+ basic_machine=t90-cray
+ os=-unicos
+ ;;
+ tile*)
+ basic_machine=$basic_machine-unknown
+ os=-linux-gnu
+ ;;
+ tx39)
+ basic_machine=mipstx39-unknown
+ ;;
+ tx39el)
+ basic_machine=mipstx39el-unknown
+ ;;
+ toad1)
+ basic_machine=pdp10-xkl
+ os=-tops20
+ ;;
+ tower | tower-32)
+ basic_machine=m68k-ncr
+ ;;
+ tpf)
+ basic_machine=s390x-ibm
+ os=-tpf
+ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ ultra3)
+ basic_machine=a29k-nyu
+ os=-sym1
+ ;;
+ v810 | necv810)
+ basic_machine=v810-nec
+ os=-none
+ ;;
+ vaxv)
+ basic_machine=vax-dec
+ os=-sysv
+ ;;
+ vms)
+ basic_machine=vax-dec
+ os=-vms
+ ;;
+ vpp*|vx|vx-*)
+ basic_machine=f301-fujitsu
+ ;;
+ vxworks960)
+ basic_machine=i960-wrs
+ os=-vxworks
+ ;;
+ vxworks68)
+ basic_machine=m68k-wrs
+ os=-vxworks
+ ;;
+ vxworks29k)
+ basic_machine=a29k-wrs
+ os=-vxworks
+ ;;
+ w65*)
+ basic_machine=w65-wdc
+ os=-none
+ ;;
+ w89k-*)
+ basic_machine=hppa1.1-winbond
+ os=-proelf
+ ;;
+ xbox)
+ basic_machine=i686-pc
+ os=-mingw32
+ ;;
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
+ xscale-* | xscalee[bl]-*)
+ basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
+ ;;
+ ymp)
+ basic_machine=ymp-cray
+ os=-unicos
+ ;;
+ z8k-*-coff)
+ basic_machine=z8k-unknown
+ os=-sim
+ ;;
+ z80-*-coff)
+ basic_machine=z80-unknown
+ os=-sim
+ ;;
+ none)
+ basic_machine=none-none
+ os=-none
+ ;;
+
+# Here we handle the default manufacturer of certain CPU types. It is in
+# some cases the only manufacturer, in others, it is the most popular.
+ w89k)
+ basic_machine=hppa1.1-winbond
+ ;;
+ op50n)
+ basic_machine=hppa1.1-oki
+ ;;
+ op60c)
+ basic_machine=hppa1.1-oki
+ ;;
+ romp)
+ basic_machine=romp-ibm
+ ;;
+ mmix)
+ basic_machine=mmix-knuth
+ ;;
+ rs6000)
+ basic_machine=rs6000-ibm
+ ;;
+ vax)
+ basic_machine=vax-dec
+ ;;
+ pdp10)
+ # there are many clones, so DEC is not a safe bet
+ basic_machine=pdp10-unknown
+ ;;
+ pdp11)
+ basic_machine=pdp11-dec
+ ;;
+ we32k)
+ basic_machine=we32k-att
+ ;;
+ sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
+ basic_machine=sh-unknown
+ ;;
+ sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+ basic_machine=sparc-sun
+ ;;
+ cydra)
+ basic_machine=cydra-cydrome
+ ;;
+ orion)
+ basic_machine=orion-highlevel
+ ;;
+ orion105)
+ basic_machine=clipper-highlevel
+ ;;
+ mac | mpw | mac-mpw)
+ basic_machine=m68k-apple
+ ;;
+ pmac | pmac-mpw)
+ basic_machine=powerpc-apple
+ ;;
+ *-unknown)
+ # Make sure to match an already-canonicalized machine name.
+ ;;
+ *)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+ *-digital*)
+ basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+ ;;
+ *-commodore*)
+ basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+ ;;
+ *)
+ ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+ # First match some system type aliases
+ # that might get confused with valid system types.
+ # -solaris* is a basic system type, with this one exception.
+ -auroraux)
+ os=-auroraux
+ ;;
+ -solaris1 | -solaris1.*)
+ os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ ;;
+ -solaris)
+ os=-solaris2
+ ;;
+ -svr4*)
+ os=-sysv4
+ ;;
+ -unixware*)
+ os=-sysv4.2uw
+ ;;
+ -gnu/linux*)
+ os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+ ;;
+ # First accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST END IN A *, to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+ | -sym* | -kopensolaris* | -plan9* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+ | -aos* | -aros* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+ | -bitrig* | -openbsd* | -solidbsd* \
+ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ | -chorusos* | -chorusrdb* | -cegcc* \
+ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
+ | -linux-newlib* | -linux-musl* | -linux-uclibc* \
+ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
+ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*)
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -qnx*)
+ case $basic_machine in
+ x86-* | i*86-*)
+ ;;
+ *)
+ os=-nto$os
+ ;;
+ esac
+ ;;
+ -nto-qnx*)
+ ;;
+ -nto*)
+ os=`echo $os | sed -e 's|nto|nto-qnx|'`
+ ;;
+ -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+ ;;
+ -mac*)
+ os=`echo $os | sed -e 's|mac|macos|'`
+ ;;
+ -linux-dietlibc)
+ os=-linux-dietlibc
+ ;;
+ -linux*)
+ os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ ;;
+ -sunos5*)
+ os=`echo $os | sed -e 's|sunos5|solaris2|'`
+ ;;
+ -sunos6*)
+ os=`echo $os | sed -e 's|sunos6|solaris3|'`
+ ;;
+ -opened*)
+ os=-openedition
+ ;;
+ -os400*)
+ os=-os400
+ ;;
+ -wince*)
+ os=-wince
+ ;;
+ -osfrose*)
+ os=-osfrose
+ ;;
+ -osf*)
+ os=-osf
+ ;;
+ -utek*)
+ os=-bsd
+ ;;
+ -dynix*)
+ os=-bsd
+ ;;
+ -acis*)
+ os=-aos
+ ;;
+ -atheos*)
+ os=-atheos
+ ;;
+ -syllable*)
+ os=-syllable
+ ;;
+ -386bsd)
+ os=-bsd
+ ;;
+ -ctix* | -uts*)
+ os=-sysv
+ ;;
+ -nova*)
+ os=-rtmk-nova
+ ;;
+ -ns2 )
+ os=-nextstep2
+ ;;
+ -nsk*)
+ os=-nsk
+ ;;
+ # Preserve the version number of sinix5.
+ -sinix5.*)
+ os=`echo $os | sed -e 's|sinix|sysv|'`
+ ;;
+ -sinix*)
+ os=-sysv4
+ ;;
+ -tpf*)
+ os=-tpf
+ ;;
+ -triton*)
+ os=-sysv3
+ ;;
+ -oss*)
+ os=-sysv3
+ ;;
+ -svr4)
+ os=-sysv4
+ ;;
+ -svr3)
+ os=-sysv3
+ ;;
+ -sysvr4)
+ os=-sysv4
+ ;;
+ # This must come after -sysvr4.
+ -sysv*)
+ ;;
+ -ose*)
+ os=-ose
+ ;;
+ -es1800*)
+ os=-ose
+ ;;
+ -xenix)
+ os=-xenix
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ os=-mint
+ ;;
+ -aros*)
+ os=-aros
+ ;;
+ -zvmoe)
+ os=-zvmoe
+ ;;
+ -dicos*)
+ os=-dicos
+ ;;
+ -nacl*)
+ ;;
+ -none)
+ ;;
+ *)
+ # Get rid of the `-' at the beginning of $os.
+ os=`echo $os | sed 's/[^-]*-//'`
+ echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system. Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+ score-*)
+ os=-elf
+ ;;
+ spu-*)
+ os=-elf
+ ;;
+ *-acorn)
+ os=-riscix1.2
+ ;;
+ arm*-rebel)
+ os=-linux
+ ;;
+ arm*-semi)
+ os=-aout
+ ;;
+ c4x-* | tic4x-*)
+ os=-coff
+ ;;
+ c8051-*)
+ os=-elf
+ ;;
+ hexagon-*)
+ os=-elf
+ ;;
+ tic54x-*)
+ os=-coff
+ ;;
+ tic55x-*)
+ os=-coff
+ ;;
+ tic6x-*)
+ os=-coff
+ ;;
+ # This must come before the *-dec entry.
+ pdp10-*)
+ os=-tops20
+ ;;
+ pdp11-*)
+ os=-none
+ ;;
+ *-dec | vax-*)
+ os=-ultrix4.2
+ ;;
+ m68*-apollo)
+ os=-domain
+ ;;
+ i386-sun)
+ os=-sunos4.0.2
+ ;;
+ m68000-sun)
+ os=-sunos3
+ ;;
+ m68*-cisco)
+ os=-aout
+ ;;
+ mep-*)
+ os=-elf
+ ;;
+ mips*-cisco)
+ os=-elf
+ ;;
+ mips*-*)
+ os=-elf
+ ;;
+ or32-*)
+ os=-coff
+ ;;
+ *-tti) # must be before sparc entry or we get the wrong os.
+ os=-sysv3
+ ;;
+ sparc-* | *-sun)
+ os=-sunos4.1.1
+ ;;
+ *-be)
+ os=-beos
+ ;;
+ *-haiku)
+ os=-haiku
+ ;;
+ *-ibm)
+ os=-aix
+ ;;
+ *-knuth)
+ os=-mmixware
+ ;;
+ *-wec)
+ os=-proelf
+ ;;
+ *-winbond)
+ os=-proelf
+ ;;
+ *-oki)
+ os=-proelf
+ ;;
+ *-hp)
+ os=-hpux
+ ;;
+ *-hitachi)
+ os=-hiux
+ ;;
+ i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+ os=-sysv
+ ;;
+ *-cbm)
+ os=-amigaos
+ ;;
+ *-dg)
+ os=-dgux
+ ;;
+ *-dolphin)
+ os=-sysv3
+ ;;
+ m68k-ccur)
+ os=-rtu
+ ;;
+ m88k-omron*)
+ os=-luna
+ ;;
+ *-next )
+ os=-nextstep
+ ;;
+ *-sequent)
+ os=-ptx
+ ;;
+ *-crds)
+ os=-unos
+ ;;
+ *-ns)
+ os=-genix
+ ;;
+ i370-*)
+ os=-mvs
+ ;;
+ *-next)
+ os=-nextstep3
+ ;;
+ *-gould)
+ os=-sysv
+ ;;
+ *-highlevel)
+ os=-bsd
+ ;;
+ *-encore)
+ os=-bsd
+ ;;
+ *-sgi)
+ os=-irix
+ ;;
+ *-siemens)
+ os=-sysv4
+ ;;
+ *-masscomp)
+ os=-rtu
+ ;;
+ f30[01]-fujitsu | f700-fujitsu)
+ os=-uxpv
+ ;;
+ *-rom68k)
+ os=-coff
+ ;;
+ *-*bug)
+ os=-coff
+ ;;
+ *-apple)
+ os=-macos
+ ;;
+ *-atari*)
+ os=-mint
+ ;;
+ *)
+ os=-none
+ ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer. We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+ *-unknown)
+ case $os in
+ -riscix*)
+ vendor=acorn
+ ;;
+ -sunos*)
+ vendor=sun
+ ;;
+ -cnk*|-aix*)
+ vendor=ibm
+ ;;
+ -beos*)
+ vendor=be
+ ;;
+ -hpux*)
+ vendor=hp
+ ;;
+ -mpeix*)
+ vendor=hp
+ ;;
+ -hiux*)
+ vendor=hitachi
+ ;;
+ -unos*)
+ vendor=crds
+ ;;
+ -dgux*)
+ vendor=dg
+ ;;
+ -luna*)
+ vendor=omron
+ ;;
+ -genix*)
+ vendor=ns
+ ;;
+ -mvs* | -opened*)
+ vendor=ibm
+ ;;
+ -os400*)
+ vendor=ibm
+ ;;
+ -ptx*)
+ vendor=sequent
+ ;;
+ -tpf*)
+ vendor=ibm
+ ;;
+ -vxsim* | -vxworks* | -windiss*)
+ vendor=wrs
+ ;;
+ -aux*)
+ vendor=apple
+ ;;
+ -hms*)
+ vendor=hitachi
+ ;;
+ -mpw* | -macos*)
+ vendor=apple
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ vendor=atari
+ ;;
+ -vos*)
+ vendor=stratus
+ ;;
+ esac
+ basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+ ;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/build-aux/custom_help.m4 b/build-aux/custom_help.m4
new file mode 100755
index 0000000..80c4f88
--- /dev/null
+++ b/build-aux/custom_help.m4
@@ -0,0 +1,131 @@
+# _AC_INIT_HELP
+# -------------
+# Handle the `configure --help' message.
+m4_define([_AC_INIT_HELP],
+[m4_divert_push([HELP_BEGIN])dnl
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat <<_ACEOF
+\`configure' configures m4_ifset([AC_PACKAGE_STRING],
+ [AC_PACKAGE_STRING],
+ [this package]) to adapt to many kinds of systems.
+
+Usage: $[0] [[OPTION]]... [[VAR=VALUE]]...
+
+[To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking ...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [/usr/local/nagios]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`/usr/local/nagios/bin', \`/usr/local/nagios/lib' etc. You can specify
+an installation prefix other than \`/usr/local/nagios' using \`--prefix',
+for instance \`--prefix=$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR plugins, brokers, CGI [EPREFIX/libexec]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
+ --datadir=DIR r/o arch.-independent data [DATAROOTDIR/PKG_NAME]
+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
+_ACEOF
+
+ cat <<\_ACEOF]
+m4_divert_pop([HELP_BEGIN])dnl
+dnl The order of the diversions here is
+dnl - HELP_BEGIN
+dnl which may be extended by extra generic options such as with X or
+dnl AC_ARG_PROGRAM. Displayed only in long --help.
+dnl
+dnl - HELP_CANON
+dnl Support for cross compilation (--build, --host and --target).
+dnl Display only in long --help.
+dnl
+dnl - HELP_ENABLE
+dnl which starts with the trailer of the HELP_BEGIN, HELP_CANON section,
+dnl then implements the header of the non generic options.
+dnl
+dnl - HELP_WITH
+dnl
+dnl - HELP_VAR
+dnl
+dnl - HELP_VAR_END
+dnl
+dnl - HELP_END
+dnl initialized below, in which we dump the trailer (handling of the
+dnl recursion for instance).
+m4_divert_push([HELP_ENABLE])dnl
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+m4_ifset([AC_PACKAGE_STRING],
+[ case $ac_init_help in
+ short | recursive ) echo "Configuration of AC_PACKAGE_STRING:";;
+ esac])
+ cat <<\_ACEOF
+m4_divert_pop([HELP_ENABLE])dnl
+m4_divert_push([HELP_END])dnl
+
+Report bugs to m4_ifset([AC_PACKAGE_BUGREPORT], [<AC_PACKAGE_BUGREPORT>],
+ [the package provider]).dnl
+m4_ifdef([AC_PACKAGE_NAME], [m4_ifset([AC_PACKAGE_URL], [
+AC_PACKAGE_NAME home page: <AC_PACKAGE_URL>.])dnl
+m4_if(m4_index(m4_defn([AC_PACKAGE_NAME]), [GNU ]), [0], [
+General help using GNU software: <http://www.gnu.org/gethelp/>.])])
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d "$ac_dir" ||
+ { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+ continue
+ _AC_SRCDIRS(["$ac_dir"])
+ cd "$ac_dir" || { ac_status=$?; continue; }
+ # Check for guested configure.
+ if test -f "$ac_srcdir/configure.gnu"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+ elif test -f "$ac_srcdir/configure"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure" --help=recursive
+ else
+ AC_MSG_WARN([no configuration information is in $ac_dir])
+ fi || ac_status=$?
+ cd "$ac_pwd" || { ac_status=$?; break; }
+ done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+m4_divert_pop([HELP_END])dnl
+])# _AC_INIT_HELP
diff --git a/build-aux/install-sh b/build-aux/install-sh
new file mode 100755
index 0000000..0b0fdcb
--- /dev/null
+++ b/build-aux/install-sh
@@ -0,0 +1,501 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2013-12-25.23; # UTC
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# 'make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+
+tab=' '
+nl='
+'
+IFS=" $tab$nl"
+
+# Set DOITPROG to "echo" to test this script.
+
+doit=${DOITPROG-}
+doit_exec=${doit:-exec}
+
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
+
+chgrpprog=${CHGRPPROG-chgrp}
+chmodprog=${CHMODPROG-chmod}
+chownprog=${CHOWNPROG-chown}
+cmpprog=${CMPPROG-cmp}
+cpprog=${CPPROG-cp}
+mkdirprog=${MKDIRPROG-mkdir}
+mvprog=${MVPROG-mv}
+rmprog=${RMPROG-rm}
+stripprog=${STRIPPROG-strip}
+
+posix_mkdir=
+
+# Desired mode of installed file.
+mode=0755
+
+chgrpcmd=
+chmodcmd=$chmodprog
+chowncmd=
+mvcmd=$mvprog
+rmcmd="$rmprog -f"
+stripcmd=
+
+src=
+dst=
+dir_arg=
+dst_arg=
+
+copy_on_change=false
+is_target_a_directory=possibly
+
+usage="\
+Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+ or: $0 [OPTION]... SRCFILES... DIRECTORY
+ or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+ or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+ --help display this help and exit.
+ --version display version info and exit.
+
+ -c (ignored)
+ -C install only if different (preserve the last data modification time)
+ -d create directories instead of installing files.
+ -g GROUP $chgrpprog installed files to GROUP.
+ -m MODE $chmodprog installed files to MODE.
+ -o USER $chownprog installed files to USER.
+ -s $stripprog installed files.
+ -t DIRECTORY install into DIRECTORY.
+ -T report an error if DSTFILE is a directory.
+
+Environment variables override the default commands:
+ CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
+ RMPROG STRIPPROG
+"
+
+while test $# -ne 0; do
+ case $1 in
+ -c) ;;
+
+ -C) copy_on_change=true;;
+
+ -d) dir_arg=true;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift;;
+
+ --help) echo "$usage"; exit $?;;
+
+ -m) mode=$2
+ case $mode in
+ *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
+ echo "$0: invalid mode: $mode" >&2
+ exit 1;;
+ esac
+ shift;;
+
+ -o) chowncmd="$chownprog $2"
+ shift;;
+
+ -s) stripcmd=$stripprog;;
+
+ -t)
+ is_target_a_directory=always
+ dst_arg=$2
+ # Protect names problematic for 'test' and other utilities.
+ case $dst_arg in
+ -* | [=\(\)!]) dst_arg=./$dst_arg;;
+ esac
+ shift;;
+
+ -T) is_target_a_directory=never;;
+
+ --version) echo "$0 $scriptversion"; exit $?;;
+
+ --) shift
+ break;;
+
+ -*) echo "$0: invalid option: $1" >&2
+ exit 1;;
+
+ *) break;;
+ esac
+ shift
+done
+
+# We allow the use of options -d and -T together, by making -d
+# take the precedence; this is for compatibility with GNU install.
+
+if test -n "$dir_arg"; then
+ if test -n "$dst_arg"; then
+ echo "$0: target directory not allowed when installing a directory." >&2
+ exit 1
+ fi
+fi
+
+if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
+ # When -d is used, all remaining arguments are directories to create.
+ # When -t is used, the destination is already specified.
+ # Otherwise, the last argument is the destination. Remove it from $@.
+ for arg
+ do
+ if test -n "$dst_arg"; then
+ # $@ is not empty: it contains at least $arg.
+ set fnord "$@" "$dst_arg"
+ shift # fnord
+ fi
+ shift # arg
+ dst_arg=$arg
+ # Protect names problematic for 'test' and other utilities.
+ case $dst_arg in
+ -* | [=\(\)!]) dst_arg=./$dst_arg;;
+ esac
+ done
+fi
+
+if test $# -eq 0; then
+ if test -z "$dir_arg"; then
+ echo "$0: no input file specified." >&2
+ exit 1
+ fi
+ # It's OK to call 'install-sh -d' without argument.
+ # This can happen when creating conditional directories.
+ exit 0
+fi
+
+if test -z "$dir_arg"; then
+ if test $# -gt 1 || test "$is_target_a_directory" = always; then
+ if test ! -d "$dst_arg"; then
+ echo "$0: $dst_arg: Is not a directory." >&2
+ exit 1
+ fi
+ fi
+fi
+
+if test -z "$dir_arg"; then
+ do_exit='(exit $ret); exit $ret'
+ trap "ret=129; $do_exit" 1
+ trap "ret=130; $do_exit" 2
+ trap "ret=141; $do_exit" 13
+ trap "ret=143; $do_exit" 15
+
+ # Set umask so as not to create temps with too-generous modes.
+ # However, 'strip' requires both read and write access to temps.
+ case $mode in
+ # Optimize common cases.
+ *644) cp_umask=133;;
+ *755) cp_umask=22;;
+
+ *[0-7])
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw='% 200'
+ fi
+ cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+ *)
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw=,u+rw
+ fi
+ cp_umask=$mode$u_plus_rw;;
+ esac
+fi
+
+for src
+do
+ # Protect names problematic for 'test' and other utilities.
+ case $src in
+ -* | [=\(\)!]) src=./$src;;
+ esac
+
+ if test -n "$dir_arg"; then
+ dst=$src
+ dstdir=$dst
+ test -d "$dstdir"
+ dstdir_status=$?
+ else
+
+ # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+ # might cause directories to be created, which would be especially bad
+ # if $src (and thus $dsttmp) contains '*'.
+ if test ! -f "$src" && test ! -d "$src"; then
+ echo "$0: $src does not exist." >&2
+ exit 1
+ fi
+
+ if test -z "$dst_arg"; then
+ echo "$0: no destination specified." >&2
+ exit 1
+ fi
+ dst=$dst_arg
+
+ # If destination is a directory, append the input filename; won't work
+ # if double slashes aren't ignored.
+ if test -d "$dst"; then
+ if test "$is_target_a_directory" = never; then
+ echo "$0: $dst_arg: Is a directory" >&2
+ exit 1
+ fi
+ dstdir=$dst
+ dst=$dstdir/`basename "$src"`
+ dstdir_status=0
+ else
+ dstdir=`dirname "$dst"`
+ test -d "$dstdir"
+ dstdir_status=$?
+ fi
+ fi
+
+ obsolete_mkdir_used=false
+
+ if test $dstdir_status != 0; then
+ case $posix_mkdir in
+ '')
+ # Create intermediate dirs using mode 755 as modified by the umask.
+ # This is like FreeBSD 'install' as of 1997-10-28.
+ umask=`umask`
+ case $stripcmd.$umask in
+ # Optimize common cases.
+ *[2367][2367]) mkdir_umask=$umask;;
+ .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+ *[0-7])
+ mkdir_umask=`expr $umask + 22 \
+ - $umask % 100 % 40 + $umask % 20 \
+ - $umask % 10 % 4 + $umask % 2
+ `;;
+ *) mkdir_umask=$umask,go-w;;
+ esac
+
+ # With -d, create the new directory with the user-specified mode.
+ # Otherwise, rely on $mkdir_umask.
+ if test -n "$dir_arg"; then
+ mkdir_mode=-m$mode
+ else
+ mkdir_mode=
+ fi
+
+ posix_mkdir=false
+ case $umask in
+ *[123567][0-7][0-7])
+ # POSIX mkdir -p sets u+wx bits regardless of umask, which
+ # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+ ;;
+ *)
+ tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+ if (umask $mkdir_umask &&
+ exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+ then
+ if test -z "$dir_arg" || {
+ # Check for POSIX incompatibilities with -m.
+ # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+ # other-writable bit of parent directory when it shouldn't.
+ # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+ ls_ld_tmpdir=`ls -ld "$tmpdir"`
+ case $ls_ld_tmpdir in
+ d????-?r-*) different_mode=700;;
+ d????-?--*) different_mode=755;;
+ *) false;;
+ esac &&
+ $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+ ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+ test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+ }
+ }
+ then posix_mkdir=:
+ fi
+ rmdir "$tmpdir/d" "$tmpdir"
+ else
+ # Remove any dirs left behind by ancient mkdir implementations.
+ rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+ fi
+ trap '' 0;;
+ esac;;
+ esac
+
+ if
+ $posix_mkdir && (
+ umask $mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+ )
+ then :
+ else
+
+ # The umask is ridiculous, or mkdir does not conform to POSIX,
+ # or it failed possibly due to a race condition. Create the
+ # directory the slow way, step by step, checking for races as we go.
+
+ case $dstdir in
+ /*) prefix='/';;
+ [-=\(\)!]*) prefix='./';;
+ *) prefix='';;
+ esac
+
+ oIFS=$IFS
+ IFS=/
+ set -f
+ set fnord $dstdir
+ shift
+ set +f
+ IFS=$oIFS
+
+ prefixes=
+
+ for d
+ do
+ test X"$d" = X && continue
+
+ prefix=$prefix$d
+ if test -d "$prefix"; then
+ prefixes=
+ else
+ if $posix_mkdir; then
+ (umask=$mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+ # Don't fail if two instances are running concurrently.
+ test -d "$prefix" || exit 1
+ else
+ case $prefix in
+ *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) qprefix=$prefix;;
+ esac
+ prefixes="$prefixes '$qprefix'"
+ fi
+ fi
+ prefix=$prefix/
+ done
+
+ if test -n "$prefixes"; then
+ # Don't fail if two instances are running concurrently.
+ (umask $mkdir_umask &&
+ eval "\$doit_exec \$mkdirprog $prefixes") ||
+ test -d "$dstdir" || exit 1
+ obsolete_mkdir_used=true
+ fi
+ fi
+ fi
+
+ if test -n "$dir_arg"; then
+ { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+ { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
+ else
+
+ # Make a couple of temp file names in the proper directory.
+ dsttmp=$dstdir/_inst.$$_
+ rmtmp=$dstdir/_rm.$$_
+
+ # Trap to clean up those temp files at exit.
+ trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+
+ # Copy the file name to the temp name.
+ (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+
+ # and set any options; do chmod last to preserve setuid bits.
+ #
+ # If any of these fail, we abort the whole thing. If we want to
+ # ignore errors from any of these, just make sure not to ignore
+ # errors from the above "$doit $cpprog $src $dsttmp" command.
+ #
+ { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
+ { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
+ { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+
+ # If -C, don't bother to copy if it wouldn't change the file.
+ if $copy_on_change &&
+ old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
+ new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
+ set -f &&
+ set X $old && old=:$2:$4:$5:$6 &&
+ set X $new && new=:$2:$4:$5:$6 &&
+ set +f &&
+ test "$old" = "$new" &&
+ $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
+ then
+ rm -f "$dsttmp"
+ else
+ # Rename the file to the real destination.
+ $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
+
+ # The rename failed, perhaps because mv can't rename something else
+ # to itself, or perhaps because mv is so ancient that it does not
+ # support -f.
+ {
+ # Now remove or move aside any old file at destination location.
+ # We try this two ways since rm can't unlink itself on some
+ # systems and the destination file might be busy for other
+ # reasons. In this case, the final cleanup might fail but the new
+ # file should still install successfully.
+ {
+ test ! -f "$dst" ||
+ $doit $rmcmd -f "$dst" 2>/dev/null ||
+ { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+ { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+ } ||
+ { echo "$0: cannot unlink or rename $dst" >&2
+ (exit 1); exit 1
+ }
+ } &&
+
+ # Now rename the file to the real destination.
+ $doit $mvcmd "$dsttmp" "$dst"
+ }
+ fi || exit 1
+
+ trap '' 0
+ fi
+done
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/configure b/configure
new file mode 100755
index 0000000..66462fd
--- /dev/null
+++ b/configure
@@ -0,0 +1,9113 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.69 for nrpe newdate.
+#
+# Report bugs to <nagios-users@lists.sourceforge.net>.
+#
+#
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
+#
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+# Use a proper internal environment variable to ensure we don't fall
+ # into an infinite loop, continuously re-executing ourselves.
+ if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+ _as_can_reexec=no; export _as_can_reexec;
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+as_fn_exit 255
+ fi
+ # We don't want this to propagate to other subprocesses.
+ { _as_can_reexec=; unset _as_can_reexec;}
+if test "x$CONFIG_SHELL" = x; then
+ as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '\${1+\"\$@\"}'='\"\$@\"'
+ setopt NO_GLOB_SUBST
+else
+ case \`(set -o) 2>/dev/null\` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+"
+ as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
+
+exitcode=0
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
+
+else
+ exitcode=1; echo positional parameters were not saved.
+fi
+test x\$exitcode = x0 || exit 1
+test -x / || exit 1"
+ as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+ as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+ eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+ test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1"
+ if (eval "$as_required") 2>/dev/null; then :
+ as_have_required=yes
+else
+ as_have_required=no
+fi
+ if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
+
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ as_found=:
+ case $as_dir in #(
+ /*)
+ for as_base in sh bash ksh sh5; do
+ # Try only shells that exist, to save several forks.
+ as_shell=$as_dir/$as_base
+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ CONFIG_SHELL=$as_shell as_have_required=yes
+ if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ break 2
+fi
+fi
+ done;;
+ esac
+ as_found=false
+done
+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
+ CONFIG_SHELL=$SHELL as_have_required=yes
+fi; }
+IFS=$as_save_IFS
+
+
+ if test "x$CONFIG_SHELL" != x; then :
+ export CONFIG_SHELL
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
+fi
+
+ if test x$as_have_required = xno; then :
+ $as_echo "$0: This script requires a shell more modern than all"
+ $as_echo "$0: the shells that I found on your system."
+ if test x${ZSH_VERSION+set} = xset ; then
+ $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+ $as_echo "$0: be upgraded to zsh 4.3.4 or later."
+ else
+ $as_echo "$0: Please tell bug-autoconf@gnu.org and
+$0: nagios-users@lists.sourceforge.net about your system,
+$0: including any error possibly output before this
+$0: message. Then install a modern shell, or manually run
+$0: the script under such a shell if you do have one."
+ fi
+ exit 1
+fi
+fi
+fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
+
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+ fi
+ $as_echo "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+
+ as_lineno_1=$LINENO as_lineno_1a=$LINENO
+ as_lineno_2=$LINENO as_lineno_2a=$LINENO
+ eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+ test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+ # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+
+ # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+ # already done that, so ensure we don't try to do so again and fall
+ # in an infinite loop. This has already happened in practice.
+ _as_can_reexec=no; export _as_can_reexec
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -pR'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -pR'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -pR'
+ fi
+else
+ as_ln_s='cp -pR'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p='mkdir -p "$as_dir"'
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+
+# Identity of this package.
+PACKAGE_NAME='nrpe'
+PACKAGE_TARNAME='nrpe'
+PACKAGE_VERSION='newdate'
+PACKAGE_STRING='nrpe newdate'
+PACKAGE_BUGREPORT='nagios-users@lists.sourceforge.net'
+PACKAGE_URL='https://www.nagios.org/downloads/nagios-core-addons/'
+
+ac_unique_file="src/nrpe.c"
+ac_default_prefix=/usr/local/nagios
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='PERL
+sslbin
+PKG_CONFIG
+SSL_LIB_DIR
+SSL_INC_PREFIX
+SSL_HDR
+SSL_INC_DIR
+SSL_TYPE
+HAVE_SSL
+EGREP
+GREP
+CPP
+SET_MAKE
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+CFLAGS
+CC
+LTLIBOBJS
+LIBOBJS
+bsd_enable
+src_tmpfile
+src_inetd
+src_init
+subsyslockfile
+subsyslockdir
+tmpfilesd
+inetddir
+initdir
+spooldir
+pipedir
+piddir
+logdir
+pkglocalstatedir
+privatesysconfdir
+webdir
+cgibindir
+brokersdir
+pluginsdir
+inetdname
+initname
+objsysconfdir
+pkgsysconfdir
+inetd_type
+init_type
+dist_ver
+dist_type
+arch
+opsys
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+TARGET_PLATFORM
+TARGET_ARCH
+TARGET_OS
+TARGET_VER
+NAGIOS_INSTALL_OPTS
+nagios_group
+nagios_user
+nrpe_port
+nrpe_group
+nrpe_user
+log_facility
+NRPE_INSTALL_OPTS
+LIBWRAPLIBS
+SOCKETLIBS
+OTHERLIBS
+LDFLAGS
+SNPRINTF_O
+INSTALL
+RPM_RELEASE
+PKG_REL_DATE
+PKG_HOME_URL
+PKG_VERSION
+PKG_NAME
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_URL
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
+ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+with_opsys
+with_dist_type
+with_init_type
+with_inetd_type
+enable_install_method
+enable_showdirs_only
+with_pkgsysconfdir
+with_objsysconfdir
+with_privatesysconfdir
+with_webdir
+with_pluginsdir
+with_brokersdir
+with_cgibindir
+with_logdir
+with_piddir
+with_pipedir
+enable_ssl
+with_need_dh
+with_ssl
+with_ssl_inc
+with_ssl_lib
+with_kerberos_inc
+with_log_facility
+with_nrpe_user
+with_nrpe_group
+with_nrpe_port
+with_nagios_user
+with_nagios_group
+enable_command_args
+enable_bash_command_substitution
+'
+ ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CPP'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval $ac_prev=\$ac_option
+ ac_prev=
+ continue
+ fi
+
+ case $ac_option in
+ *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *=) ac_optarg= ;;
+ *) ac_optarg=yes ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case $ac_dashdash$ac_option in
+ --)
+ ac_dashdash=yes ;;
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir=$ac_optarg ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build_alias ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build_alias=$ac_optarg ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
+
+ -datadir | --datadir | --datadi | --datad)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=*)
+ datadir=$ac_optarg ;;
+
+ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+ | --dataroo | --dataro | --datar)
+ ac_prev=datarootdir ;;
+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+ datarootdir=$ac_optarg ;;
+
+ -disable-* | --disable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=no ;;
+
+ -docdir | --docdir | --docdi | --doc | --do)
+ ac_prev=docdir ;;
+ -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+ docdir=$ac_optarg ;;
+
+ -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+ ac_prev=dvidir ;;
+ -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+ dvidir=$ac_optarg ;;
+
+ -enable-* | --enable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=\$ac_optarg ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix=$ac_optarg ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host_alias ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host_alias=$ac_optarg ;;
+
+ -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+ ac_prev=htmldir ;;
+ -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+ | --ht=*)
+ htmldir=$ac_optarg ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir=$ac_optarg ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir=$ac_optarg ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir=$ac_optarg ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir=$ac_optarg ;;
+
+ -localedir | --localedir | --localedi | --localed | --locale)
+ ac_prev=localedir ;;
+ -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+ localedir=$ac_optarg ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst | --locals)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+ localstatedir=$ac_optarg ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir=$ac_optarg ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c | -n)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir=$ac_optarg ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix=$ac_optarg ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix=$ac_optarg ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix=$ac_optarg ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name=$ac_optarg ;;
+
+ -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+ ac_prev=pdfdir ;;
+ -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+ pdfdir=$ac_optarg ;;
+
+ -psdir | --psdir | --psdi | --psd | --ps)
+ ac_prev=psdir ;;
+ -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+ psdir=$ac_optarg ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir=$ac_optarg ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir=$ac_optarg ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site=$ac_optarg ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir=$ac_optarg ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir=$ac_optarg ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target_alias ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target_alias=$ac_optarg ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
+
+ -with-* | --with-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=\$ac_optarg ;;
+
+ -without-* | --without-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=no ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes=$ac_optarg ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries=$ac_optarg ;;
+
+ -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ case $ac_envvar in #(
+ '' | [0-9]* | *[!_$as_cr_alnum]* )
+ as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
+ esac
+ eval $ac_envvar=\$ac_optarg
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ as_fn_error $? "missing argument to $ac_option"
+fi
+
+if test -n "$ac_unrecognized_opts"; then
+ case $enable_option_checking in
+ no) ;;
+ fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
+ *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+ esac
+fi
+
+# Check all directory arguments for consistency.
+for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
+ datadir sysconfdir sharedstatedir localstatedir includedir \
+ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+ libdir localedir mandir
+do
+ eval ac_val=\$$ac_var
+ # Remove trailing slashes.
+ case $ac_val in
+ */ )
+ ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+ eval $ac_var=\$ac_val;;
+ esac
+ # Be sure to have absolute directory names.
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) continue;;
+ NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+ esac
+ as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+ as_fn_error $? "working directory cannot be determined"
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+ as_fn_error $? "pwd does not report name of working directory"
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then the parent directory.
+ ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_myself" : 'X\(//\)[^/]' \| \
+ X"$as_myself" : 'X\(//\)$' \| \
+ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ srcdir=$ac_confdir
+ if test ! -r "$srcdir/$ac_unique_file"; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+ test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+ as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+ cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
+ pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+ srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+ eval ac_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_env_${ac_var}_value=\$${ac_var}
+ eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat <<_ACEOF
+\`configure' configures nrpe newdate to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking ...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [/usr/local/nagios]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`/usr/local/nagios/bin', \`/usr/local/nagios/lib' etc. You can specify
+an installation prefix other than \`/usr/local/nagios' using \`--prefix',
+for instance \`--prefix=$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR plugins, brokers, CGI [EPREFIX/libexec]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
+ --datadir=DIR r/o arch.-independent data [DATAROOTDIR/PKG_NAME]
+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
+_ACEOF
+
+ cat <<\_ACEOF
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of nrpe newdate:";;
+ esac
+ cat <<\_ACEOF
+
+Optional Features:
+ --disable-option-checking ignore unrecognized --enable/--with options
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-install-method=<method>
+ sets the install method to use: 'default' (the
+ default) will install to /usr/local/nagios, 'os'
+ will try to determine which method to use based on
+ OS type and distribution. Fine tuning using the
+ '--bindir', etc. overrides above will still work
+ --enable-showdirs-only=yes
+ This option will cause 'configure' to stop after
+ determining the install locations based on
+ '--enable-install-method', so you can see the
+ destinations before a full './configure', 'make',
+ 'make install' process.
+ --disable-ssl disables native SSL support [default=check]
+ --enable-command-args allows clients to specify command arguments. ***
+ THIS IS A SECURITY RISK! *** Read the SECURITY file
+ before using this option!
+ --enable-bash-command-substitution
+ allows clients to pass bash command substitutions of
+ the form $(command). *** THIS IS A HIGH SECURITY
+ RISK! *** Read the SECURITY file before using this
+ option!
+
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-opsys=OS specify operating system (linux, osx, bsd, solaris,
+ irix, cygwin, aix, hp-ux, etc.)
+ --with-dist-type=type specify distribution type (suse, rh, debian, etc.)
+ --with-init-type=type specify init type (bsd, sysv, systemd, launchd,
+ smf10, smf11, upstart, openrc, etc.)
+ --with-inetd-type=type which super-server the system runs (inetd, xinetd,
+ systemd, launchd, smf10, smf11, etc.)
+ --with-pkgsysconfdir=DIR
+ where configuration files should be placed
+ --with-objsysconfdir=DIR
+ where object configuration files should be placed
+ --with-privatesysconfdir=DIR
+ where private configuration files should be placed
+ --with-webdir=DIR where the website files should be placed
+ --with-pluginsdir=DIR where the plugins should be placed
+ --with-brokersdir=DIR where the broker modules should be placed
+ --with-cgibindir=DIR where the CGI programs should be placed
+ --with-logdir=DIR where log files should be placed
+ --with-piddir=DIR where the PID file should be placed
+ --with-pipedir=DIR where socket and pipe files should be placed
+ --with-need-dh set to 'no' to not include Diffie-Hellman SSL logic
+ --with-ssl=DIR sets location of the SSL installation
+ --with-ssl-inc=DIR sets location of the SSL include files
+ --with-ssl-lib=DIR sets location of the SSL libraries
+ --with-kerberos-inc=DIR sets location of the Kerberos include files
+ --with-log-facility=<facility>
+ sets NRPE syslog facility
+ --with-nrpe-user=<user> sets user name to run NRPE
+ --with-nrpe-group=<group>
+ sets group name to run NRPE
+ --with-nrpe-port=<port> sets port number for NRPE to listen on
+ --with-nagios-user=<user>
+ sets user name for file permissions
+ --with-nagios-group=<grp>
+ sets group name file permissions
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ LIBS libraries to pass to the linker, e.g. -l<library>
+ CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
+ you have headers in a nonstandard directory <include dir>
+ CPP C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to <nagios-users@lists.sourceforge.net>.
+nrpe home page: <https://www.nagios.org/downloads/nagios-core-addons/>.
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d "$ac_dir" ||
+ { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+ continue
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+ cd "$ac_dir" || { ac_status=$?; continue; }
+ # Check for guested configure.
+ if test -f "$ac_srcdir/configure.gnu"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+ elif test -f "$ac_srcdir/configure"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure" --help=recursive
+ else
+ $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi || ac_status=$?
+ cd "$ac_pwd" || { ac_status=$?; break; }
+ done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+ cat <<\_ACEOF
+nrpe configure newdate
+generated by GNU Autoconf 2.69
+
+Copyright (C) 2012 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+ exit
+fi
+
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
+
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext
+ if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_compile
+
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } > conftest.i && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_cpp
+
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=$ac_status
+fi
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_run
+
+# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_c_check_header_mongrel ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if eval \${$3+:} false; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_header_compiler=yes
+else
+ ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <$2>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ ac_header_preproc=yes
+else
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+ yes:no: )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+( $as_echo "## ------------------------------------------------- ##
+## Report this to nagios-users@lists.sourceforge.net ##
+## ------------------------------------------------- ##"
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_mongrel
+
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_compile
+
+# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
+# -------------------------------------------
+# Tests whether TYPE exists after having included INCLUDES, setting cache
+# variable VAR accordingly.
+ac_fn_c_check_type ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ eval "$3=no"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+if (sizeof ($2))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+if (sizeof (($2)))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+ eval "$3=yes"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_type
+
+# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
+# --------------------------------------------
+# Tries to find the compile-time value of EXPR in a program that includes
+# INCLUDES, setting VAR accordingly. Returns whether the value could be
+# computed
+ac_fn_c_compute_int ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= 0)];
+test_array [0] = 0;
+return test_array [0];
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_hi=$ac_mid; break
+else
+ as_fn_arith $ac_mid + 1 && ac_lo=$as_val
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) < 0)];
+test_array [0] = 0;
+return test_array [0];
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_lo=$ac_mid; break
+else
+ as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ ac_lo= ac_hi=
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0;
+return test_array [0];
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_hi=$ac_mid
+else
+ as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in #((
+?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
+'') ac_retval=1 ;;
+esac
+ else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+static long int longval () { return $2; }
+static unsigned long int ulongval () { return $2; }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ return 1;
+ if (($2) < 0)
+ {
+ long int i = longval ();
+ if (i != ($2))
+ return 1;
+ fprintf (f, "%ld", i);
+ }
+ else
+ {
+ unsigned long int i = ulongval ();
+ if (i != ($2))
+ return 1;
+ fprintf (f, "%lu", i);
+ }
+ /* Do not output a trailing newline, as this causes \r\n confusion
+ on some platforms. */
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ echo >>conftest.val; read $3 <conftest.val; ac_retval=0
+else
+ ac_retval=1
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+rm -f conftest.val
+
+ fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_compute_int
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext conftest$ac_exeext
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ test -x conftest$ac_exeext
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+ # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+ # interfere with the next link command; also delete a directory that is
+ # left behind by Apple's compiler. We do this before executing the actions.
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_link
+
+# ac_fn_c_check_func LINENO FUNC VAR
+# ----------------------------------
+# Tests whether FUNC exists, setting the cache variable VAR accordingly
+ac_fn_c_check_func ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $2 innocuous_$2
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $2 (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $2
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $2 ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
+
+int
+main ()
+{
+return $2 ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_func
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by nrpe $as_me newdate, which was
+generated by GNU Autoconf 2.69. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ $as_echo "PATH: $as_dir"
+ done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *\'*)
+ ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
+ 2)
+ as_fn_append ac_configure_args1 " '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ as_fn_append ac_configure_args " '$ac_arg'"
+ ;;
+ esac
+ done
+done
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ $as_echo "## ---------------- ##
+## Cache variables. ##
+## ---------------- ##"
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+(
+ for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+ (set) 2>&1 |
+ case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ sed -n \
+ "s/'\''/'\''\\\\'\'''\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+ ;; #(
+ *)
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+)
+ echo
+
+ $as_echo "## ----------------- ##
+## Output variables. ##
+## ----------------- ##"
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ $as_echo "## ------------------- ##
+## File substitutions. ##
+## ------------------- ##"
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ $as_echo "## ----------- ##
+## confdefs.h. ##
+## ----------- ##"
+ echo
+ cat confdefs.h
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ $as_echo "$as_me: caught signal $ac_signal"
+ $as_echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core core.conftest.* &&
+ rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+$as_echo "/* confdefs.h */" > confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
+if test -n "$CONFIG_SITE"; then
+ # We do not want a PATH search for config.site.
+ case $CONFIG_SITE in #((
+ -*) ac_site_file1=./$CONFIG_SITE;;
+ */*) ac_site_file1=$CONFIG_SITE;;
+ *) ac_site_file1=./$CONFIG_SITE;;
+ esac
+elif test "x$prefix" != xNONE; then
+ ac_site_file1=$prefix/share/config.site
+ ac_site_file2=$prefix/etc/config.site
+else
+ ac_site_file1=$ac_default_prefix/share/config.site
+ ac_site_file2=$ac_default_prefix/etc/config.site
+fi
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+do
+ test "x$ac_site_file" = xNONE && continue
+ if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
+ . "$ac_site_file" \
+ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+done
+
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val=\$ac_cv_env_${ac_var}_value
+ eval ac_new_val=\$ac_env_${ac_var}_value
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ # differences in whitespace do not lead to failure.
+ ac_old_val_w=`echo x $ac_old_val`
+ ac_new_val_w=`echo x $ac_new_val`
+ if test "$ac_old_val_w" != "$ac_new_val_w"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ ac_cache_corrupted=:
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+ eval $ac_var=\$ac_old_val
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5
+$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5
+$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) as_fn_append ac_configure_args " '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
+fi
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+ac_aux_dir=
+for ac_dir in build-aux "$srcdir"/build-aux; do
+ if test -f "$ac_dir/install-sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f "$ac_dir/install.sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ elif test -f "$ac_dir/shtool"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ as_fn_error $? "cannot find install-sh, install.sh, or shtool in build-aux \"$srcdir\"/build-aux" "$LINENO" 5
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
+
+
+
+
+PKG_NAME=nrpe
+PKG_VERSION="3.2.1"
+PKG_HOME_URL="http://www.nagios.org/"
+PKG_REL_DATE="2017-09-01"
+RPM_RELEASE=1
+
+LANG=C
+LC_ALL=C
+LC_COLLATE=C
+LC_CTYPE=C
+LC_MESSAGES=C
+LC_MONETARY=C
+LC_NUMERIC=C
+LC_TIME=C
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
+if test -z "$INSTALL"; then
+if ${ac_cv_path_install+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in #((
+ ./ | .// | /[cC]/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ rm -rf conftest.one conftest.two conftest.dir
+ echo one > conftest.one
+ echo two > conftest.two
+ mkdir conftest.dir
+ if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+ test -s conftest.one && test -s conftest.two &&
+ test -s conftest.dir/conftest.one &&
+ test -s conftest.dir/conftest.two
+ then
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+
+ done
+IFS=$as_save_IFS
+
+rm -rf conftest.one conftest.two conftest.dir
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL=$ac_cv_path_install
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ INSTALL=$ac_install_sh
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+
+
+
+
+
+
+#
+# Get user hints
+#
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking what the operating system is " >&5
+$as_echo_n "checking what the operating system is ... " >&6; }
+
+# Check whether --with-opsys was given.
+if test "${with_opsys+set}" = set; then :
+ withval=$with_opsys;
+ #
+ # Run this if --with was specified
+ #
+ if test "x$withval" = x -o x$withval = xno; then
+ opsys_wanted=yes
+ else
+ opsys_wanted=no
+ opsys="$withval"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $opsys" >&5
+$as_echo "$opsys" >&6; }
+ fi
+
+else
+
+ #
+ # Run this if --with was not specified
+ #
+ opsys_wanted=yes
+
+fi
+
+
+ if test x$opsys = xno; then
+ opsys=""
+ opsys_wanted=yes
+ elif test x$opsys = xyes; then
+ as_fn_error $? "you must enter an O/S type if '--with-opsys' is specified" "$LINENO" 5
+ fi
+
+ #
+ # Determine operating system if it wasn't supplied
+ #
+ if test $opsys_wanted=yes; then
+ opsys=`uname -s | tr "[A-Z]" "[a-z]"`
+ if test x"$opsys" = "x"; then opsys="unknown"; fi
+ case $opsys in #(
+ darwin*) :
+ opsys="osx" ;; #(
+ *bsd*) :
+ opsys="bsd" ;; #(
+ dragonfly) :
+ opsys="bsd" ;; #(
+ sunos) :
+ opsys="solaris" ;; #(
+ gnu/hurd) :
+ opsys="linux" ;; #(
+ irix*) :
+ opsys="irix" ;; #(
+ cygwin*) :
+ opsys="cygwin" ;; #(
+ mingw*) :
+ opsys="mingw" ;; #(
+ msys*) :
+ opsys="msys" ;; #(
+ *) :
+ ;;
+esac
+ fi
+
+ arch=`uname -m | tr "[A-Z]" "[a-z]"`
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $opsys" >&5
+$as_echo "$opsys" >&6; }
+
+
+
+
+
+
+#
+# Get user hints for possible cross-compile
+#
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking what the distribution type is " >&5
+$as_echo_n "checking what the distribution type is ... " >&6; }
+
+# Check whether --with-dist-type was given.
+if test "${with_dist_type+set}" = set; then :
+ withval=$with_dist_type;
+ #
+ # Run this if --with was specified
+ #
+ if test "x$withval" = x -o x$withval = xno; then
+ dist_type_wanted=yes
+ else
+ dist_type_wanted=no
+ dist_type="$withval"
+ dist_ver="unknown"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dist_type" >&5
+$as_echo "$dist_type" >&6; }
+ fi
+
+else
+
+ #
+ # Run this if --with was not specified
+ #
+ dist_type_wanted=yes
+
+fi
+
+
+ if test x$dist_type = xno; then
+ dist_type_wanted=yes
+ elif test x$dist_type = xyes; then
+ as_fn_error $? "you must enter a distribution type if '--with-dist-type' is specified" "$LINENO" 5
+ fi
+
+ #
+ # Determine distribution type if it wasn't supplied
+ #
+ dist_ver="unknown"
+
+ if test $dist_type_wanted=yes; then
+ dist_type="unknown"
+
+ if test "$opsys" != "linux"; then
+ dist_type="$opsys"
+ case $opsys in #(
+ bsd) :
+ dist_type=`uname -s | tr "A-Z" "a-z"`
+ dist_ver=`uname -r` ;; #(
+ aix) :
+ dist_ver="`uname -v`.`uname -r`" ;; #(
+ hp-ux) :
+ dist_ver=`uname -r | cut -d'.' -f1-3` ;; #(
+ solaris) :
+ dist_ver=`uname -r | cut -d'.' -f2` ;; #(
+ *) :
+ dist_ver=$OSTYPE
+ ;; #(
+ *) :
+ ;;
+esac
+
+ else
+
+ if test -r "/etc/gentoo-release"; then
+ dist_type="gentoo"
+ dist_ver=`cat /etc/gentoo-release`
+
+ elif test -r "/etc/os-release"; then
+ . /etc/os-release
+ if test x"$ID_LIKE" != x; then
+ dist_type=`echo $ID_LIKE | cut -d' ' -f1 | tr "[A-Z]" "[a-z]"`
+ elif test x"$ID" = xol; then
+ dist_type=rh
+ else
+ dist_type=`echo $ID | tr "[A-Z]" "[a-z]"`
+ fi
+ if test x"$dist_type" = sles; then
+ dist_type=suse
+ fi
+ if test x"$VERSION_ID" != x; then
+ dist_ver=$VERSION_ID
+ elif test x"$VERSION" != x; then
+ dist_ver=`echo $VERSION | cut -d'.' -f1 | tr -d :alpha::blank::punct:`
+ fi
+
+ elif test -r "/etc/redhat-release"; then
+ dist_type=rh
+ dist_ver=`cat /etc/redhat-release`
+
+ elif test -r "/etc/debian_version"; then
+ dist_type="debian"
+ if test -r "/etc/lsb-release"; then
+ . /etc/lsb-release
+ dist_ver=`echo "$DISTRIB_RELEASE"`
+ else
+ dist_ver=`cat /etc/debian_version`
+ fi
+
+ elif test -r "/etc/SuSE-release"; then
+ dist_type=suse
+ dist_ver=`grep VERSION /etc/SuSE-release`
+
+ fi
+
+ fi
+
+ if test "$dist_ver" != "unknown"; then
+ dist_ver=`echo "$dist_ver" | cut -d'.' -f1 | tr -d :alpha::blank::punct:`
+ fi
+ fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dist_type" >&5
+$as_echo "$dist_type" >&6; }
+
+
+
+
+
+#
+# Get user hints for possible cross-compile
+#
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking what init system is being used " >&5
+$as_echo_n "checking what init system is being used ... " >&6; }
+
+# Check whether --with-init_type was given.
+if test "${with_init_type+set}" = set; then :
+ withval=$with_init_type;
+ #
+ # Run this if --with was specified
+ #
+ if test "x$withval" = x -o x$withval = xno; then
+ init_type_wanted=yes
+ else
+ init_type_wanted=no
+ init_type="$withval"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $init_type" >&5
+$as_echo "$init_type" >&6; }
+ fi
+
+else
+
+ #
+ # Run this if --with was not specified
+ #
+ init_type_wanted=yes
+
+fi
+
+
+ if test x$init_type = xno; then
+ init_type_wanted=yes
+ elif test x$init_type = xyes; then
+ as_fn_error $? "you must enter an init type if '--with-init-type' is specified" "$LINENO" 5
+ fi
+
+ #
+ # Determine init type if it wasn't supplied
+ #
+ if test $init_type_wanted = yes; then
+ init_type=""
+
+ if test x"$opsys" = x; then
+ init_type="unknown"
+ init_type_wanted=no
+ elif test x"$dist_type" = x; then
+ init_type="unknown"
+ init_type_wanted=no
+ elif test "$opsys" = "osx"; then
+ init_type="launchd"
+ init_type_wanted=no
+ elif test "$opsys" = "bsd"; then
+ init_type="newbsd"
+ init_type_wanted=no
+ elif test "$dist_type" = "solaris"; then
+ if test -d "/lib/svc/manifest"; then
+ init_type="smf11"
+ init_type_wanted=no
+ elif test -d "/lib/svc/monitor"; then
+ init_type="smf10"
+ init_type_wanted=no
+ else
+ init_type="sysv"
+ init_type_wanted=no
+ fi
+ elif test "$dist_type" = "slackware"; then
+ init_type="bsd"
+ init_type_wanted=no
+ elif test "$dist_type" = "aix"; then
+ init_type="bsd"
+ init_type_wanted=no
+ elif test "$dist_type" = "hp-ux"; then
+ init_type="unknown"
+ init_type_wanted=no
+ fi
+ fi
+
+ PSCMD="ps -p1 -o args"
+ if test $dist_type = solaris; then
+ PSCMD="env UNIX95=1; ps -p1 -o args"
+ fi
+
+ if test "$init_type_wanted" = yes; then
+ pid1=`$PSCMD | grep -vi COMMAND | cut -d' ' -f1`
+ if test x"$pid1" = "x"; then
+ init_type="unknown"
+ init_type_wanted=no
+ fi
+ if `echo $pid1 | grep "systemd" > /dev/null`; then
+ init_type="systemd"
+ init_type_wanted=no
+ fi
+
+ if test "$init_type_wanted" = yes; then
+ if test "$pid1" = "init"; then
+ if test -e "/sbin/init"; then
+ pid1="/sbin/init";
+ elif test -e "/usr/sbin/init"; then
+ pid1="/usr/sbin/init"
+ else
+ init_type="unknown"
+ init_type_wanted=no
+ fi
+ fi
+ if test -L "$pid1"; then
+ pid1=`readlink "$pid1"`
+ fi
+ fi
+
+ if test "$init_type_wanted" = yes; then
+ if `echo $pid1 | grep "systemd" > /dev/null`; then
+ init_type="systemd"
+ init_type_wanted=no
+ elif test -f "/sbin/rc"; then
+ if test -f /sbin/runscript; then
+ init_type_wanted=no
+ if `/sbin/start-stop-daemon -V | grep "OpenRC" > /dev/null`; then
+ init_type="openrc"
+ else
+ init_type="gentoo"
+ fi
+ fi
+ fi
+ fi
+
+ if test "$init_type_wanted" = yes; then
+ if test "$pid1" = "/sbin/init" -o "$pid1" = "/usr/sbin/init"; then
+ if `$pid1 --version 2>/dev/null | grep "upstart" >/dev/null`; then
+ init_type="upstart"
+ init_type_wanted=no
+ elif test -f "/etc/rc" -a ! -L "/etc/rc"; then
+ init_type="newbsd"
+ init_type_wanted=no
+ else
+ init_type="sysv"
+ init_type_wanted=no
+ fi
+ fi
+ fi
+
+ if test "$init_type_wanted" = yes; then
+ init_type="unknown"
+ fi
+ fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $init_type" >&5
+$as_echo "$init_type" >&6; }
+
+
+
+
+
+#
+# Get user hints for possible cross-compile
+#
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking what inetd is being used " >&5
+$as_echo_n "checking what inetd is being used ... " >&6; }
+
+# Check whether --with-inetd_type was given.
+if test "${with_inetd_type+set}" = set; then :
+ withval=$with_inetd_type;
+ inetd_type_wanted=yes
+ #
+ # Run this if --with was specified
+ #
+ if test "x$withval" = x -o x$withval = xno; then
+ inetd_type_wanted=yes
+ else
+ inetd_type_wanted=no
+ inetd_type="$withval"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $inetd_type" >&5
+$as_echo "$inetd_type" >&6; }
+ fi
+
+else
+
+ #
+ # Run this if --with was not specified
+ #
+ inetd_type_wanted=yes
+
+fi
+
+
+ if test x$inetd_type = xno; then
+ inetd_type_wanted=yes
+ elif test x$inetd_type = xyes; then
+ as_fn_error $? "you must enter an inetd type if '--with-inetd-type' is specified" "$LINENO" 5
+ fi
+
+ #
+ # Determine inetd type if it wasn't supplied
+ #
+ if test $inetd_type_wanted = yes; then
+
+ inetd_disabled=""
+
+ case $dist_type in #(
+ solaris) :
+ if test x"$init_type" = "xsmf10" -o x"$init_type" = "xsmf11"; then
+ inetd_type="$init_type"
+ else
+ inetd_type="inetd"
+ fi ;; #(
+ *bsd*) :
+ inetd_type=`ps -A -o comm -c | grep inetd` ;; #(
+ osx) :
+ inetd_type=`launchd` ;; #(
+ aix|hp-ux) :
+ inetd_type=`UNIX95= ps -A -o comm | grep inetd | head -1` ;; #(
+ *) :
+ inetd_type=`ps -C "inetd,xinetd" -o fname | grep -vi COMMAND | head -1` ;; #(
+ *) :
+ ;;
+esac
+
+ if test x"$inetd_type" = x; then
+ if test -f /etc/xinetd.conf -a -d /etc/xinetd.d; then
+ inetd_disabled="(Not running)"
+ inetd_type=xinetd
+ elif test -f /etc/inetd.conf -o -f /usr/sbin/inetd; then
+ inetd_type=inetd
+ inetd_disabled="(Not running)"
+ fi
+ fi
+
+ if test x"$inetd_type" = x; then
+ if test x"$init_type" = "xupstart"; then
+ inetd_type="upstart"
+ fi
+ fi
+
+ if test x"$inetd_type" = x; then
+ if test x"$init_type" = "xsystemd"; then
+ inetd_type="systemd"
+ else
+ inetd_type="unknown"
+ fi
+ fi
+
+ if test -n "$inetd_disabled"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $inetd_type $inetd_disabled" >&5
+$as_echo "$inetd_type $inetd_disabled" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $inetd_type" >&5
+$as_echo "$inetd_type" >&6; }
+ fi
+ fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+if test x$DBG_PATHS != x; then
+ echo
+ echo Incoming paths:
+ echo " prefix $prefix"
+ echo " exec_prefix $exec_prefix"
+ echo " bindir $bindir"
+ echo " sbindir $sbindir"
+ echo " libexecdir $libexecdir"
+ echo " sysconfdir $sysconfdir"
+ echo " localstatedir $localstatedir"
+ echo " datarootdir $datarootdir"
+ echo " datadir $datadir"
+ echo " localedir $localedir"
+ echo
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for which paths to use " >&5
+$as_echo_n "checking for which paths to use ... " >&6; }
+
+# Check whether --enable-install_method was given.
+if test "${enable_install_method+set}" = set; then :
+ enableval=$enable_install_method; install_method=$enableval
+else
+ install_method=default
+
+fi
+
+
+# Check whether --enable-showdirs_only was given.
+if test "${enable_showdirs_only+set}" = set; then :
+ enableval=$enable_showdirs_only; showdirs_only=$enableval
+else
+ showdirs_only=no
+
+fi
+
+
+case $install_method in #(
+ yes) :
+ install_method="os" ;; #(
+ no) :
+ install_method="default" ;; #(
+ default|os) :
+ : ;; #(
+ *) :
+ echo >&6; as_fn_error $? "'--enable-install-method=$install_method' is invalid" "$LINENO" 5
+ ;; #(
+ *) :
+ ;;
+esac
+
+if test $showdirs_only != "no"; then showdirs_only="yes"; fi
+
+case $dist_type in #(
+ *solaris*|*hp-ux*|*aix*|*osx*) :
+ opsys=unix ;; #(
+ *) :
+ ;;
+esac
+
+
+ # Does this package need to know:
+need_cgi=no # where the cgi-bin directory is
+need_web=no # where the website directory is
+need_brk=no # where the event broker modules directory is
+need_plg=no # where the plugins directory is
+need_pipe=no # where the pipe directory is
+need_spl=no # where the spool directory is
+need_loc=no # where the locale directory is
+need_log_subdir=no # where the loc sub-directory is
+need_etc_subdir=no # where the etc sub-directory is
+need_pls_dir=no # where the package locate state directory is
+
+if test x"$INIT_PROG" = x; then
+ INIT_PROG="$PKG_NAME"
+fi
+
+case $PKG_NAME in #(
+ nagios) :
+ need_log_subdir=yes
+ need_etc_subdir=yes
+ need_pls_dir=yes
+ need_brk=yes
+ need_pipe=yes
+ need_spl=yes
+ need_loc=yes
+ need_cgi=yes
+ need_web=yes ;; #(
+ ndoutils) :
+ need_brk=yes
+ need_spl=yes ;; #(
+ nrpe) :
+ need_plg=yes ;; #(
+ nsca) :
+ need_cgi=no ;; #(
+ plugins) :
+ need_loc=yes
+ need_plg=yes
+ ;; #(
+ *) :
+ ;;
+esac
+
+
+# Check whether --with-pkgsysconfdir was given.
+if test "${with_pkgsysconfdir+set}" = set; then :
+ withval=$with_pkgsysconfdir; if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
+ pkgsysconfdir="$withval"
+ fi
+fi
+
+
+# Check whether --with-objsysconfdir was given.
+if test "${with_objsysconfdir+set}" = set; then :
+ withval=$with_objsysconfdir; if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
+ objsysconfdir="$withval"
+ fi
+fi
+
+
+# Check whether --with-privatesysconfdir was given.
+if test "${with_privatesysconfdir+set}" = set; then :
+ withval=$with_privatesysconfdir; if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
+ privatesysconfdir="$withval"
+ fi
+fi
+
+
+# Check whether --with-webdir was given.
+if test "${with_webdir+set}" = set; then :
+ withval=$with_webdir; if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
+ webdir="$withval"
+ fi
+fi
+
+
+# Check whether --with-pluginsdir was given.
+if test "${with_pluginsdir+set}" = set; then :
+ withval=$with_pluginsdir; if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
+ pluginsdir="$withval"
+ fi
+fi
+
+
+# Check whether --with-brokersdir was given.
+if test "${with_brokersdir+set}" = set; then :
+ withval=$with_brokersdir; if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
+ brokersdir="$withval"
+ fi
+fi
+
+
+# Check whether --with-cgibindir was given.
+if test "${with_cgibindir+set}" = set; then :
+ withval=$with_cgibindir; if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
+ cgibindir="$withval"
+ fi
+fi
+
+
+# Check whether --with-logdir was given.
+if test "${with_logdir+set}" = set; then :
+ withval=$with_logdir; if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
+ logdir="$withval"
+ fi
+fi
+
+
+# Check whether --with-piddir was given.
+if test "${with_piddir+set}" = set; then :
+ withval=$with_piddir; if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
+ piddir="$withval"
+ fi
+fi
+
+
+# Check whether --with-pipedir was given.
+if test "${with_pipedir+set}" = set; then :
+ withval=$with_pipedir; if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
+ pipedir="$withval"
+ fi
+fi
+
+
+
+#
+# Setup the base directory
+#
+
+if test $install_method = "default"; then
+ if test $opsys = "unix"; then
+ if test x"$prefix" = "xNONE"; then prefix="/usr/local/nagios"; fi
+ else
+ if test x"$prefix" = "xNONE"; then prefix=${ac_default_prefix}; fi
+ fi
+ datarootdir=${datarootdir="$prefix"}
+
+else
+ if test x"$datadir" = x'${datarootdir}'; then { datadir=; unset datadir;}; fi
+ if test x"$sysconfdir" = x'${prefix}/etc'; then { sysconfdir=; unset sysconfdir;}; fi
+
+ if test x"$prefix" = "xNONE"; then
+ if test $dist_type = freebsd -o $dist_type = openbsd -o $dist_type = osx; then
+ prefix="/usr/local"
+ elif test $dist_type = netbsd; then
+ prefix="/usr/pkg"
+ else
+ prefix="/usr"
+ fi
+ fi
+ if test x"$exec_prefix" = "xNONE"; then exec_prefix=$prefix; fi
+ if test x"$localstatedir" = x'${prefix}/var'; then
+ if test $dist_type = "osx"; then
+ localstatedir="/private/var"
+ else
+ localstatedir="/var"
+ fi
+ fi
+
+ if test $opsys = "unix"; then
+ if test x"$datarootdir" = x'${prefix}/share'; then
+ if test $dist_type = "hp-ux"; then
+ datarootdir="/usr/local/share"
+ if test x"$libexecdir" = x'${exec_prefix}/libexec'; then
+ libexecdir="/usr/nagios"
+ fi
+ elif test $dist_type = "osx"; then
+ datarootdir="/usr/local/share"
+ if test x"$libexecdir" = x'${exec_prefix}/libexec'; then
+ libexecdir="/usr/local/nagios"
+ fi
+ elif test x"$libexecdir" = x'${exec_prefix}/libexec'; then
+ libexecdir="/usr/lib/nagios"
+ fi
+ fi
+ if test $dist_type = "osx"; then
+ if test x"$sbindir" = x'${exec_prefix}/sbin'; then
+ sbindir="$libexecdir"
+ fi
+ if test x"$libexecdir" = x'${exec_prefix}/libexec'; then
+ libexecdir="/usr/local/libexec/nagios"
+ fi
+ fi
+ elif test $opsys = "bsd"; then
+ if test x"$libexecdir" = x'${exec_prefix}/libexec'; then
+ libexecdir=${exec_prefix}/libexec/nagios;
+ fi
+ elif test x"$libexecdir" = x'${exec_prefix}/lib'; then
+ libexecdir=${libexecdir}/nagios;
+ elif test x"$libexecdir" = x'${exec_prefix}/libexec'; then
+ libexecdir=${exec_prefix}/lib/nagios;
+ fi
+
+fi
+
+if test x"$exec_prefix" = "xNONE"; then exec_prefix=${prefix}; fi
+
+tmpfilesd=${tmpfilesd="/usr/lib/tmpfiles.d"}
+if test ! -d "$tmpfilesd"; then
+ tmpfilesd="N/A"
+else
+ tmpfilesd="$tmpfilesd/$INIT_PROG.conf"
+fi
+subsyslockdir=${subsyslockdir="/var/lock/subsys"}
+if test ! -d "$subsyslockdir"; then
+ subsyslockdir="N/A"
+ subsyslockfile="N/A"
+else
+ subsyslockfile="$subsyslockdir/$INIT_PROG"
+fi
+if test "$need_loc" = no; then
+ localedir="N/A"
+fi
+
+if test $install_method = "default" ; then
+ #
+ # Do the default setup
+ #
+ sbindir=${bindir}
+ datadir=${datadir="$datarootdir"}
+ if test $need_web = yes; then
+ webdir=${webdir="$datadir"}
+ else
+ webdir="N/A"
+ fi
+ if test $opsys = "unix"; then
+ sysconfdir=${sysconfdir="/etc/opt"}
+ fi
+ pkgsysconfdir=${pkgsysconfdir="$sysconfdir"}
+ if test $need_etc_subdir = yes; then
+ objsysconfdir=${objsysconfdir="$pkgsysconfdir/objects"}
+ else
+ objsysconfdir="N/A"
+ fi
+ privatesysconfdir=${privatesysconfdir="$pkgsysconfdir"}
+ logdir=${logdir="$localstatedir"}
+ piddir=${piddir="$localstatedir"}
+ if test "$need_pipe" = yes; then
+ pipedir=${pipedir="$localstatedir/rw"}
+ else
+ pipedir="N/A"
+ fi
+ if test "$need_pls_dir" = yes; then
+ pkglocalstatedir=${pkglocalstatedir="$localstatedir"}
+ else
+ pkglocalstatedir="N/A"
+ fi
+ if test "$need_spl" = yes; then
+ spooldir=${spooldir="$localstatedir/var"}
+ else
+ spooldir="N/A"
+ fi
+ if test $need_brk = yes; then
+ brokersdir=${brokersdir="$bindir"}
+ else
+ brokersdir="N/A"
+ fi
+ if test $need_plg = yes; then
+ pluginsdir=${pluginsdir="$libexecdir"}
+ else
+ pluginsdir="N/A"
+ fi
+ if test $need_cgi = yes; then
+ cgibindir=${cgibindir="$prefix/sbin"}
+ else
+ cgibindir="N/A"
+ fi
+
+elif test $opsys = "linux"; then
+
+ #
+ # Linux "Standard" install
+ #
+ install_method="$install_method : FHS"
+ datadir=${datadir="$datarootdir/nagios"}
+ if test $need_web = yes; then
+ webdir=${webdir="$datadir/html"}
+ else
+ webdir="N/A"
+ fi
+ sysconfdir=${sysconfdir="/etc"}
+ pkgsysconfdir=${pkgsysconfdir="$sysconfdir/nagios"}
+ if test $need_etc_subdir = yes; then
+ objsysconfdir=${objsysconfdir="$pkgsysconfdir/objects"}
+ else
+ objsysconfdir="N/A"
+ fi
+ privatesysconfdir=${privatesysconfdir="$pkgsysconfdir/private"}
+ if test $need_log_subdir = yes; then
+ logdir=${logdir="$localstatedir/log/$INIT_PROG"}
+ else
+ logdir=${logdir="$localstatedir/log"}
+ fi
+ piddir=${piddir="$localstatedir/run/${INIT_PROG}"}
+ if test "$need_pipe" = yes; then
+ pipedir=${pipedir="$localstatedir/run/${INIT_PROG}"}
+ else
+ pipedir="N/A"
+ fi
+ if test "$need_pls_dir" = yes; then
+ pkglocalstatedir=${pkglocalstatedir="$localstatedir/lib/$INIT_PROG"}
+ else
+ pkglocalstatedir="N/A"
+ fi
+ if test "$need_spl" = yes; then
+ spooldir=${spooldir="$localstatedir/spool/$INIT_PROG"}
+ else
+ spooldir="N/A"
+ fi
+ if test $need_brk = yes; then
+ brokersdir=${brokersdir="$libexecdir/brokers"}
+ else
+ brokersdir="N/A"
+ fi
+ if test $need_plg = yes; then
+ pluginsdir=${pluginsdir="$libexecdir/plugins"}
+ else
+ pluginsdir="N/A"
+ fi
+ if test $need_cgi = yes; then
+ cgibindir=${cgibindir="$libexecdir/cgi-bin"}
+ else
+ cgibindir="N/A"
+ fi
+
+elif test $opsys = "unix"; then
+
+ #
+ # "Standard" Unix install
+ #
+ install_method="$install_method : Unix Standard"
+ if test $dist_type = osx; then
+ install_method="$install_method : OS X Standard"
+ sbindir=${sbindir="/usr/local/libexec"}
+ fi
+ datadir=${datadir="$datarootdir/nagios"}
+ if test $need_web = yes; then
+ webdir=${webdir="$datadir/html"}
+ else
+ webdir="N/A"
+ fi
+ if test $dist_type = osx; then
+ sysconfdir=${sysconfdir="/private/etc"}
+ else
+ sysconfdir=${sysconfdir="/etc"}
+ fi
+ pkgsysconfdir=${pkgsysconfdir="$sysconfdir/nagios"}
+ if test $need_etc_subdir = yes; then
+ objsysconfdir=${objsysconfdir="$pkgsysconfdir/objects"}
+ else
+ objsysconfdir="N/A"
+ fi
+ privatesysconfdir=${privatesysconfdir="$pkgsysconfdir/private"}
+ if test "$need_pls_dir" = yes; then
+ pkglocalstatedir=${pkglocalstatedir="$localstatedir/lib/$INIT_PROG"}
+ else
+ pkglocalstatedir="N/A"
+ fi
+ if test "$need_loc" = yes; then
+ localedir=${localedir="/usr/local/share/locale/<lang>/LC_MESSAGES/nagios-plugins.mo"}
+ fi
+ if test "$need_spl" = yes; then
+ spooldir=${spooldir="$localstatedir/spool/$INIT_PROG"}
+ else
+ spooldir="N/A"
+ fi
+ if test $need_brk = yes; then
+ brokersdir=${brokersdir="$libexecdir/brokers"}
+ else
+ brokersdir="N/A"
+ fi
+ if test $need_plg = yes; then
+ pluginsdir=${pluginsdir="$libexecdir/plugins"}
+ else
+ pluginsdir="N/A"
+ fi
+ if test $need_cgi = yes; then
+ cgibindir=${cgibindir="$libexecdir/cgi-bin"}
+ else
+ cgibindir="N/A"
+ fi
+ case $dist_type in #(
+ *hp-ux*) :
+ piddir=${piddir="$pkgsysconfdir"}
+ pipedir=${pipedir="$pkglocalstatedir"}
+ logdir=${logdir="$pkglocalstatedir/log"} ;; #(
+ *) :
+ piddir=${piddir="$localstatedir/run/${INIT_PROG}"}
+ if test "$need_pipe" = yes; then
+ pipedir=${pipedir="$localstatedir/run/${INIT_PROG}"}
+ else
+ pipedir="N/A"
+ fi
+ if test $need_log_subdir = yes; then
+ logdir=${logdir="$localstatedir/log/$INIT_PROG"}
+ else
+ logdir=${logdir="$localstatedir/log"}
+ fi
+ ;; #(
+ *) :
+ ;;
+esac
+
+elif test $opsys = "bsd"; then
+
+ #
+ # "Standard" BSD install
+ #
+ install_method="$install_method : BSD"
+ if test $dist_type = freebsd -o $dist_type = openbsd; then
+ prefix=${prefix="/usr/local"}
+ exec_prefix=${exec_prefix="/usr/local"}
+ if test $dist_type = freebsd; then
+ install_method="$install_method : FreeBSD"
+ else
+ install_method="$install_method : OpenBSD"
+ fi
+ elif test $dist_type = netbsd; then
+ prefix=${prefix="/usr/pkg"}
+ exec_prefix=${exec_prefix="/usr/pkg"}
+ install_method="$install_method : NetBSD"
+ fi
+ datadir=${datadir="$datarootdir/nagios"}
+ if test $need_web = yes -o $need_cgi = yes; then
+ if test $dist_type = freebsd; then
+ webdir=${webdir="$prefix/www/nagios"}
+ elif test $dist_type = netbsd; then
+ webdir=${webdir="$prefix/share/nagios"}
+ elif test $dist_type = openbsd; then
+ webdir=${webdir="/var/www/nagios"}
+ fi
+ else
+ webdir="N/A"
+ fi
+ if test $dist_type = freebsd; then
+ sysconfdir=${sysconfdir="/usr/local/etc"}
+ else
+ sysconfdir=${sysconfdir="/etc"}
+ fi
+ pkgsysconfdir=${pkgsysconfdir="$sysconfdir/nagios"}
+ if test $need_etc_subdir = yes; then
+ objsysconfdir=${objsysconfdir="$pkgsysconfdir/objects"}
+ else
+ objsysconfdir="N/A"
+ fi
+ privatesysconfdir=${privatesysconfdir="$pkgsysconfdir/private"}
+ if test "$need_pls_dir" = yes; then
+ pkglocalstatedir=${pkglocalstatedir="$localstatedir/lib/$INIT_PROG"}
+ else
+ pkglocalstatedir="N/A"
+ fi
+ if test "$need_loc" = yes; then
+ localedir=${localedir="/usr/local/share/locale/<lang>/LC_MESSAGES/nagios-plugins.mo"}
+ fi
+ if test "$need_spl" = yes; then
+ spooldir=${spooldir="$localstatedir/spool/$INIT_PROG"}
+ else
+ spooldir="N/A"
+ fi
+ if test $need_brk = yes; then
+ brokersdir=${brokersdir="$libexecdir/brokers"}
+ else
+ brokersdir="N/A"
+ fi
+ if test $need_plg = yes; then
+ pluginsdir=${pluginsdir="$libexecdir/plugins"}
+ else
+ pluginsdir="N/A"
+ fi
+ if test $need_cgi = yes; then
+ if test $dist_type = freebsd; then
+ cgibindir=${cgibindir="$webdir/cgi-bin"}
+ elif test $dist_type = netbsd; then
+ cgibindir=${pluginsdir="$libexecdir/cgi-bin"}
+ elif test $dist_type = openbsd; then
+ cgibindir=${pluginsdir="/var/www/cgi-bin/nagios"}
+ fi
+ else
+ cgibindir="N/A"
+ fi
+ piddir=${piddir="$localstatedir/run/${INIT_PROG}"}
+ if test "$need_pipe" = yes; then
+ pipedir=${pipedir="$localstatedir/run/${INIT_PROG}"}
+ else
+ pipedir="N/A"
+ fi
+ if test $need_log_subdir = yes; then
+ logdir=${logdir="$localstatedir/log/$INIT_PROG"}
+ else
+ logdir=${logdir="$localstatedir/log"}
+ fi
+
+else
+
+ #
+ # Unknown install
+ #
+ install_method="unknown"
+ webdir=unknown
+ pkgsysconfdir=unknown
+ objsysconfdir=unknown
+ privatesysconfdir=unknown
+ logdir=unknown
+ piddir=unknown
+ pipedir=unknown
+ pkglocalstatedir=unknown
+ spooldir=unknown
+ brokersdir=unknown
+ pluginsdir=unknown
+ cgibindir=unknown
+
+fi
+
+eval prefix=$prefix
+eval exec_prefix=$exec_prefix
+eval bindir=$bindir
+eval sbindir=$sbindir
+eval datarootdir=$datarootdir
+eval datadir=$datadir
+eval libexecdir=$libexecdir
+eval brokersdir=$brokersdir
+eval pluginsdir=$pluginsdir
+eval cgibindir=$cgibindir
+eval localstatedir=$localstatedir
+eval pkglocalstatedir=$pkglocalstatedir
+eval webdir=$webdir
+eval localedir=$localedir
+eval sysconfdir=$sysconfdir
+eval pkgsysconfdir=$pkgsysconfdir
+eval logdir=$logdir
+eval piddir=$piddir
+
+#
+# Init scripts/files
+#
+case $init_type in #(
+ sysv) :
+ if test $dist_type = "hp-ux"; then
+ initdir=${initdir="/sbin/init.d"}
+ else
+ initdir=${initdir="/etc/init.d"}
+ fi
+ initname=${initname="$INIT_PROG"}
+ initconfdir=${initconfdir="/etc/conf.d"}
+ initconf=${initconf="$initconfdir/$INIT_PROG"} ;; #(
+ systemd) :
+ if test $dist_type = "debian"; then
+ initdir=${initdir="/lib/systemd/system"}
+ else
+ initdir=${initdir="/usr/lib/systemd/system"}
+ fi
+ initname=${initname="$INIT_PROG.service"} ;; #(
+ bsd) :
+ if test $dist_type = "aix"; then
+ initdir=${initdir="/sbin/rc.d/init.d"}
+ initname=${initname="$INIT_PROG"}
+ else
+ initdir=${initdir="/etc/rc.d"}
+ initname=${initname="rc.$INIT_PROG"}
+ fi ;; #(
+ newbsd) :
+ initdir=${initdir="/etc/rc.d"}
+ initname=${initname="$INIT_PROG"} ;; #(
+ gentoo) :
+ initdir=${initdir="/etc/init.d"}
+ initname=${initname="$INIT_PROG"}
+ initconfdir=${initconfdir="/etc/init.d"}
+ initconf=${initconf="$initconfdir/$INIT_PROG"} ;; #(
+ openrc) :
+ initdir=${initdir="/etc/init.d"}
+ initname=${initname="$INIT_PROG"}
+ initconfdir=${initconfdir="/etc/conf.d"}
+ initconf=${initconf="$initconfdir/$INIT_PROG"} ;; #(
+ smf*) :
+ if test $init_type = smf10; then
+ initdir=${initdir="/var/svc/manifest/network/nagios"}
+ else
+ initdir=${initdir="/lib/svc/manifest/network/nagios"}
+ fi
+ initname=${initname="$INIT_PROG.xml"}
+ initconfdir=unknown
+ initconf=unknown ;; #(
+ upstart) :
+ initdir=${initdir="/etc/init"}
+ initname=${initname="$INIT_PROG.conf"}
+ initconfdir=${initconfdir="/etc/default"}
+ initconf=${initconf="$initconfdir/$INIT_PROG"} ;; #(
+ launchd) :
+ initdir=${initdir="/Library/LaunchDaemons"}
+ initname=${initname="org.nagios.$INIT_PROG.plist"} ;; #(
+ # initconfdir=${initconfdir="/private/etc"}
+# initconf=${initconf="$initconfdir/$INIT_PROG"},
+
+
+ *) :
+ initdir=unknown
+ initname=unknown ;; #(
+ *) :
+ ;;
+esac
+
+#
+# Inetd (per connection) scripts/files
+#
+case $inetd_type in #(
+ inetd*) :
+ inetddir=${inetddir="/etc"}
+ inetdname=${inetdname="inetd.conf"} ;; #(
+ xinetd) :
+ inetddir=${inetddir="/etc/xinetd.d"}
+ inetdname=${inetdname="$INIT_PROG"} ;; #(
+ systemd) :
+ if test $dist_type = "debian"; then
+ inetddir=${inetddir="/lib/systemd/system"}
+ else
+ inetddir=${inetddir="/usr/lib/systemd/system"}
+ fi
+ netdname=${inetdname="$INIT_PROG.socket"} ;; #(
+ smf*) :
+ if test $init_type = smf10; then
+ inetddir=${inetddir="/var/svc/manifest/network/nagios"}
+ else
+ inetddir=${inetddir="/lib/svc/manifest/network/nagios"}
+ fi
+ inetdname=${inetdname="$INIT_PROG.xml"} ;; #(
+ # [upstart],
+# inetddir=${inetddir="/etc/init.d"}
+# inetdname=${inetdname="$INIT_PROG"},
+
+ launchd) :
+ inetddir=${inetddir="/Library/LaunchDaemons"}
+ inetdname=${inetdname="org.nagios.$INIT_PROG.plist"} ;; #(
+ *) :
+ inetddir=${inetddir="unknown"}
+ inetdname=${inetdname="unknown"} ;; #(
+ *) :
+ ;;
+esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $install_method" >&5
+$as_echo "$install_method" >&6; }
+
+
+
+
+
+
+
+
+src_inetd=""
+src_init=""
+bsd_enable=""
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for which init file to use " >&5
+$as_echo_n "checking for which init file to use ... " >&6; }
+
+case $init_type in #(
+ sysv) :
+ src_init=default-init ;; #(
+ systemd) :
+ src_tmpfile=tmpfile.conf
+ src_init=default-service ;; #(
+ bsd) :
+ src_init=bsd-init ;; #(
+ newbsd) :
+ if test $dist_type = freebsd ; then
+ bsd_enable="_enable"
+ src_init=newbsd-init
+ elif test $dist_type = openbsd ; then
+ bsd_enable="_flags"
+ src_init=openbsd-init
+ elif test $dist_type = netbsd ; then
+ bsd_enable=""
+ src_init=newbsd-init
+ fi ;; #(
+ # [gentoo],
+
+ openrc) :
+ src_init=openrc-init ;; #(
+ smf*) :
+ src_init="solaris-init.xml"
+ src_inetd="solaris-inetd.xml" ;; #(
+ upstart) :
+ if test $dist_type = rh ; then
+ src_init=rh-upstart-init
+ else
+ src_init=upstart-init
+ fi ;; #(
+ launchd) :
+ src_init="mac-init.plist" ;; #(
+ *) :
+ src_init="unknown"
+ ;; #(
+ *) :
+ ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $src_init" >&5
+$as_echo "$src_init" >&6; }
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for which inetd files to use " >&5
+$as_echo_n "checking for which inetd files to use ... " >&6; }
+
+if test x$src_inetd = x; then
+
+ case $inetd_type in #(
+ inetd*) :
+ src_inetd=default-inetd ;; #(
+ xinetd) :
+ src_inetd=default-xinetd ;; #(
+ systemd) :
+ src_inetd=default-socket ;; #(
+ launchd) :
+ src_inetd="mac-inetd.plist" ;; #(
+ *) :
+ src_inetd="unknown"
+ ;; #(
+ *) :
+ ;;
+esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $src_inetd" >&5
+$as_echo "$src_inetd" >&6; }
+
+
+
+if test "$dist_type" = solaris -a "$dist_ver" = 10; then
+ $as_echo "#define SOLARIS_10 yes" >>confdefs.h
+
+fi
+
+if test x${showdirs_only} = xyes; then
+ ac_config_files="$ac_config_files paths"
+
+
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Transform confdefs.h into DEFS.
+# Protect against shell expansion while executing Makefile rules.
+# Protect against Makefile macro expansion.
+#
+# If the first sed substitution is executed (which looks for macros that
+# take arguments), then branch to the quote section. Otherwise,
+# look for a macro that doesn't take arguments.
+ac_script='
+:mline
+/\\$/{
+ N
+ s,\\\n,,
+ b mline
+}
+t clear
+:clear
+s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g
+t quote
+s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g
+t quote
+b any
+:quote
+s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g
+s/\[/\\&/g
+s/\]/\\&/g
+s/\$/$$/g
+H
+:any
+${
+ g
+ s/^\n//
+ s/\n/ /g
+ p
+}
+'
+DEFS=`sed -n "$ac_script" confdefs.h`
+
+
+ac_libobjs=
+ac_ltlibobjs=
+U=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+ ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+ # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
+ # will be set to the directory where LIBOBJS objects are built.
+ as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+
+: "${CONFIG_STATUS=./config.status}"
+ac_write_fail=0
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+ fi
+ $as_echo "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -pR'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -pR'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -pR'
+ fi
+else
+ as_ln_s='cp -pR'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p='mkdir -p "$as_dir"'
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by nrpe $as_me newdate, which was
+generated by GNU Autoconf 2.69. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
+
+
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+# Files that config.status was made for.
+config_files="$ac_config_files"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ac_cs_usage="\
+\`$as_me' instantiates files and other configuration actions
+from templates according to the current configuration. Unless the files
+and actions are specified as TAGs, all are instantiated by default.
+
+Usage: $0 [OPTION]... [TAG]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number and configuration settings, then exit
+ --config print configuration, then exit
+ -q, --quiet, --silent
+ do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+
+Configuration files:
+$config_files
+
+Report bugs to <nagios-users@lists.sourceforge.net>.
+nrpe home page: <https://www.nagios.org/downloads/nagios-core-addons/>."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
+ac_cs_version="\\
+nrpe config.status newdate
+configured by $0, generated by GNU Autoconf 2.69,
+ with options \\"\$ac_cs_config\\"
+
+Copyright (C) 2012 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+test -n "\$AWK" || AWK=awk
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=?*)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ --*=)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=
+ ac_shift=:
+ ;;
+ *)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+ $as_echo "$ac_cs_version"; exit ;;
+ --config | --confi | --conf | --con | --co | --c )
+ $as_echo "$ac_cs_config"; exit ;;
+ --debug | --debu | --deb | --de | --d | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ '') as_fn_error $? "missing file argument" ;;
+ esac
+ as_fn_append CONFIG_FILES " '$ac_optarg'"
+ ac_need_defaults=false;;
+ --he | --h | --help | --hel | -h )
+ $as_echo "$ac_cs_usage"; exit ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) as_fn_error $? "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
+
+ *) as_fn_append ac_config_targets " $1"
+ ac_need_defaults=false ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+if \$ac_cs_recheck; then
+ set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ shift
+ \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+ CONFIG_SHELL='$SHELL'
+ export CONFIG_SHELL
+ exec "\$@"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+ $as_echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+ case $ac_config_target in
+ "paths") CONFIG_FILES="$CONFIG_FILES paths" ;;
+
+ *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+ esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+ tmp= ac_tmp=
+ trap 'exit_status=$?
+ : "${ac_tmp:=$tmp}"
+ { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
+' 0
+ trap 'as_fn_exit 1' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+ test -d "$tmp"
+} ||
+{
+ tmp=./conf$$-$RANDOM
+ (umask 077 && mkdir "$tmp")
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
+
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
+if test -n "$CONFIG_FILES"; then
+
+
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+ eval ac_cr=\$\'\\r\'
+fi
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+ ac_cs_awk_cr='\\r'
+else
+ ac_cs_awk_cr=$ac_cr
+fi
+
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
+_ACEOF
+
+
+{
+ echo "cat >conf$$subs.awk <<_ACEOF" &&
+ echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+ echo "_ACEOF"
+} >conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ . ./conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+
+ ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+ if test $ac_delim_n = $ac_delim_num; then
+ break
+ elif $ac_last_try; then
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\)..*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\)..*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+ N
+ s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
+ for (key in S) S_is_set[key] = 1
+ FS = ""
+
+}
+{
+ line = $ 0
+ nfields = split(line, field, "@")
+ substed = 0
+ len = length(field[1])
+ for (i = 2; i < nfields; i++) {
+ key = field[i]
+ keylen = length(key)
+ if (S_is_set[key]) {
+ value = S[key]
+ line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+ len += length(value) + length(field[++i])
+ substed = 1
+ } else
+ len += 1 + keylen
+ }
+
+ print line
+}
+
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+ cat
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
+ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
+_ACEOF
+
+# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
+# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
+h
+s///
+s/^/:/
+s/[ ]*$/:/
+s/:\$(srcdir):/:/g
+s/:\${srcdir}:/:/g
+s/:@srcdir@:/:/g
+s/^:*//
+s/:*$//
+x
+s/\(=[ ]*\).*/\1/
+G
+s/\n//
+s/^[^=]*=[ ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+fi # test -n "$CONFIG_FILES"
+
+
+eval set X " :F $CONFIG_FILES "
+shift
+for ac_tag
+do
+ case $ac_tag in
+ :[FHLC]) ac_mode=$ac_tag; continue;;
+ esac
+ case $ac_mode$ac_tag in
+ :[FHL]*:*);;
+ :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
+ :[FH]-) ac_tag=-:-;;
+ :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+ esac
+ ac_save_IFS=$IFS
+ IFS=:
+ set x $ac_tag
+ IFS=$ac_save_IFS
+ shift
+ ac_file=$1
+ shift
+
+ case $ac_mode in
+ :L) ac_source=$1;;
+ :[FH])
+ ac_file_inputs=
+ for ac_f
+ do
+ case $ac_f in
+ -) ac_f="$ac_tmp/stdin";;
+ *) # Look for the file first in the build tree, then in the source tree
+ # (if the path is not absolute). The absolute path cannot be DOS-style,
+ # because $ac_f cannot contain `:'.
+ test -f "$ac_f" ||
+ case $ac_f in
+ [\\/$]*) false;;
+ *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+ esac ||
+ as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+ esac
+ case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+ as_fn_append ac_file_inputs " '$ac_f'"
+ done
+
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ configure_input='Generated from '`
+ $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+ `' by configure.'
+ if test x"$ac_file" != x-; then
+ configure_input="$ac_file. $configure_input"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
+ fi
+ # Neutralize special characters interpreted by sed in replacement strings.
+ case $configure_input in #(
+ *\&* | *\|* | *\\* )
+ ac_sed_conf_input=`$as_echo "$configure_input" |
+ sed 's/[\\\\&|]/\\\\&/g'`;; #(
+ *) ac_sed_conf_input=$configure_input;;
+ esac
+
+ case $ac_tag in
+ *:-:* | *:-) cat >"$ac_tmp/stdin" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
+ esac
+ ;;
+ esac
+
+ ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ as_dir="$ac_dir"; as_fn_mkdir_p
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+ case $ac_mode in
+ :F)
+ #
+ # CONFIG_FILE
+ #
+
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+ esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+ac_sed_dataroot='
+/datarootdir/ {
+ p
+ q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ ac_datarootdir_hack='
+ s&@datadir@&$datadir&g
+ s&@docdir@&$docdir&g
+ s&@infodir@&$infodir&g
+ s&@localedir@&$localedir&g
+ s&@mandir@&$mandir&g
+ s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s|@configure_input@|$ac_sed_conf_input|;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+$ac_datarootdir_hack
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \
+ "$ac_tmp/out"`; test -z "$ac_out"; } &&
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined" >&5
+$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined" >&2;}
+
+ rm -f "$ac_tmp/stdin"
+ case $ac_file in
+ -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+ *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
+ esac \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ ;;
+
+
+
+ esac
+
+done # for ac_tag
+
+
+as_fn_exit 0
+_ACEOF
+ac_clean_files=$ac_clean_files_save
+
+test $ac_write_fail = 0 ||
+ as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || as_fn_exit 1
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
+fi
+
+ chmod 755 paths
+ ./paths
+ exit 0
+fi
+
+ac_config_headers="$ac_config_headers include/config.h"
+
+ac_config_files="$ac_config_files Makefile src/Makefile nrpe.spec uninstall sample-config/nrpe.cfg startup/bsd-init startup/debian-init startup/default-init startup/default-inetd startup/default-service startup/default-socket startup/default-socket-svc startup/default-xinetd startup/mac-init.plist startup/mac-inetd.plist startup/newbsd-init startup/openbsd-init startup/openrc-conf startup/openrc-init startup/solaris-init.xml startup/solaris-inetd.xml startup/tmpfile.conf startup/upstart-init startup/rh-upstart-init include/common.h"
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ fi
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl.exe
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl.exe
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CC" && break
+done
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+ { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ sed '10a\
+... rest of stderr output deleted ...
+ 10q' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ fi
+ rm -f conftest.er1 conftest.err
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+done
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
+ac_rmfiles=
+for ac_file in $ac_files
+do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+ esac
+done
+rm -f $ac_rmfiles
+
+if { { ac_try="$ac_link_default"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link_default") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile. We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+ then :; else
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ fi
+ # We set ac_cv_exeext here because the later test for it is not
+ # safe: cross compilers may not add the suffix if given an `-o'
+ # argument, so we may need to know it at that point already.
+ # Even if this section looks crufty: it has the advantage of
+ # actually working.
+ break;;
+ * )
+ break;;
+ esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+ ac_file=''
+fi
+if test -z "$ac_file"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "C compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+ac_exeext=$ac_cv_exeext
+
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+ { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ if { ac_try='./conftest$ac_cv_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if ${ac_cv_objext+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ for ac_file in conftest.o conftest.obj conftest.*; do
+ test -f "$ac_file" || continue;
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if ${ac_cv_c_compiler_gnu+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_compiler_gnu=yes
+else
+ ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if ${ac_cv_prog_cc_g+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_save_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ ac_cv_prog_cc_g=no
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+else
+ CFLAGS=""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+ ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if ${ac_cv_prog_cc_c89+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+struct stat;
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+ x)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+ xno)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_c89"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+ @echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+ *@@@%%%=?*=@@@%%%*)
+ eval ac_cv_prog_make_${ac_make}_set=yes;;
+ *)
+ eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ SET_MAKE=
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if ${ac_cv_prog_CPP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if ${ac_cv_path_GREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$GREP"; then
+ ac_path_GREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in grep ggrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_GREP" || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+ # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'GREP' >> "conftest.nl"
+ "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_GREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_GREP="$ac_path_GREP"
+ ac_path_GREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_GREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_GREP"; then
+ as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if ${ac_cv_path_EGREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+ then ac_cv_path_EGREP="$GREP -E"
+ else
+ if test -z "$EGREP"; then
+ ac_path_EGREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in egrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_EGREP" || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+ # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'EGREP' >> "conftest.nl"
+ "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_EGREP="$ac_path_EGREP"
+ ac_path_EGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_EGREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_EGREP"; then
+ as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_EGREP=$EGREP
+fi
+
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if ${ac_cv_header_stdc+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_stdc=yes
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then :
+ :
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5
+$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; }
+if ${ac_cv_header_time+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+
+int
+main ()
+{
+if ((struct tm *) 0)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_time=yes
+else
+ ac_cv_header_time=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5
+$as_echo "$ac_cv_header_time" >&6; }
+if test $ac_cv_header_time = yes; then
+
+$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5
+$as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; }
+if ${ac_cv_header_sys_wait_h+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <sys/wait.h>
+#ifndef WEXITSTATUS
+# define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8)
+#endif
+#ifndef WIFEXITED
+# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
+#endif
+
+int
+main ()
+{
+ int s;
+ wait (&s);
+ s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_sys_wait_h=yes
+else
+ ac_cv_header_sys_wait_h=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5
+$as_echo "$ac_cv_header_sys_wait_h" >&6; }
+if test $ac_cv_header_sys_wait_h = yes; then
+
+$as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+for ac_header in ctype.h dirent.h errno.h fcntl.h getopt.h grp.h inttypes.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+for ac_header in netdb.h pwd.h signal.h stdint.h strings.h string.h syslog.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+for ac_header in tcpd.h unistd.h arpa/inet.h netinet/in.h socket.h sys/types.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+for ac_header in sys/time.h sys/resource.h sys/wait.h sys/socket.h sys/stat.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+for ac_header in paths.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "paths.h" "ac_cv_header_paths_h" "$ac_includes_default"
+if test "x$ac_cv_header_paths_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_PATHS_H 1
+_ACEOF
+
+fi
+
+done
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
+$as_echo_n "checking for an ANSI C-conforming const... " >&6; }
+if ${ac_cv_c_const+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+#ifndef __cplusplus
+ /* Ultrix mips cc rejects this sort of thing. */
+ typedef int charset[2];
+ const charset cs = { 0, 0 };
+ /* SunOS 4.1.1 cc rejects this. */
+ char const *const *pcpcc;
+ char **ppc;
+ /* NEC SVR4.0.2 mips cc rejects this. */
+ struct point {int x, y;};
+ static struct point const zero = {0,0};
+ /* AIX XL C 1.02.0.0 rejects this.
+ It does not let you subtract one const X* pointer from another in
+ an arm of an if-expression whose if-part is not a constant
+ expression */
+ const char *g = "string";
+ pcpcc = &g + (g ? g-g : 0);
+ /* HPUX 7.0 cc rejects these. */
+ ++pcpcc;
+ ppc = (char**) pcpcc;
+ pcpcc = (char const *const *) ppc;
+ { /* SCO 3.2v4 cc rejects this sort of thing. */
+ char tx;
+ char *t = &tx;
+ char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+ *t++ = 0;
+ if (s) return 0;
+ }
+ { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
+ int x[] = {25, 17};
+ const int *foo = &x[0];
+ ++foo;
+ }
+ { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+ typedef const int *iptr;
+ iptr p = 0;
+ ++p;
+ }
+ { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying
+ "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+ struct s { int j; const int *ap[3]; } bx;
+ struct s *b = &bx; b->j = 5;
+ }
+ { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+ const int foo = 10;
+ if (!foo) return 0;
+ }
+ return !cs[0] && !zero.x;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_c_const=yes
+else
+ ac_cv_c_const=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5
+$as_echo "$ac_cv_c_const" >&6; }
+if test $ac_cv_c_const = no; then
+
+$as_echo "#define const /**/" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5
+$as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; }
+if ${ac_cv_struct_tm+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <time.h>
+
+int
+main ()
+{
+struct tm tm;
+ int *p = &tm.tm_sec;
+ return !p;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_struct_tm=time.h
+else
+ ac_cv_struct_tm=sys/time.h
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm" >&5
+$as_echo "$ac_cv_struct_tm" >&6; }
+if test $ac_cv_struct_tm = sys/time.h; then
+
+$as_echo "#define TM_IN_SYS_TIME 1" >>confdefs.h
+
+fi
+
+ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default"
+if test "x$ac_cv_type_mode_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define mode_t int
+_ACEOF
+
+fi
+
+ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default"
+if test "x$ac_cv_type_pid_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define pid_t int
+_ACEOF
+
+fi
+
+ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
+if test "x$ac_cv_type_size_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define size_t unsigned int
+_ACEOF
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5
+$as_echo_n "checking return type of signal handlers... " >&6; }
+if ${ac_cv_type_signal+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <signal.h>
+
+int
+main ()
+{
+return *(signal (0, 0)) (0) == 1;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_type_signal=int
+else
+ ac_cv_type_signal=void
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5
+$as_echo "$ac_cv_type_signal" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define RETSIGTYPE $ac_cv_type_signal
+_ACEOF
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5
+$as_echo_n "checking for uid_t in sys/types.h... " >&6; }
+if ${ac_cv_type_uid_t+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "uid_t" >/dev/null 2>&1; then :
+ ac_cv_type_uid_t=yes
+else
+ ac_cv_type_uid_t=no
+fi
+rm -f conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5
+$as_echo "$ac_cv_type_uid_t" >&6; }
+if test $ac_cv_type_uid_t = no; then
+
+$as_echo "#define uid_t int" >>confdefs.h
+
+
+$as_echo "#define gid_t int" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking type of array argument to getgroups" >&5
+$as_echo_n "checking type of array argument to getgroups... " >&6; }
+if ${ac_cv_type_getgroups+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ ac_cv_type_getgroups=cross
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+/* Thanks to Mike Rendell for this test. */
+$ac_includes_default
+#define NGID 256
+#undef MAX
+#define MAX(x, y) ((x) > (y) ? (x) : (y))
+
+int
+main ()
+{
+ gid_t gidset[NGID];
+ int i, n;
+ union { gid_t gval; long int lval; } val;
+
+ val.lval = -1;
+ for (i = 0; i < NGID; i++)
+ gidset[i] = val.gval;
+ n = getgroups (sizeof (gidset) / MAX (sizeof (int), sizeof (gid_t)) - 1,
+ gidset);
+ /* Exit non-zero if getgroups seems to require an array of ints. This
+ happens when gid_t is short int but getgroups modifies an array
+ of ints. */
+ return n > 0 && gidset[n] != val.gval;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_type_getgroups=gid_t
+else
+ ac_cv_type_getgroups=int
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+if test $ac_cv_type_getgroups = cross; then
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <unistd.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "getgroups.*int.*gid_t" >/dev/null 2>&1; then :
+ ac_cv_type_getgroups=gid_t
+else
+ ac_cv_type_getgroups=int
+fi
+rm -f conftest*
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_getgroups" >&5
+$as_echo "$ac_cv_type_getgroups" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define GETGROUPS_T $ac_cv_type_getgroups
+_ACEOF
+
+
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5
+$as_echo_n "checking size of int... " >&6; }
+if ${ac_cv_sizeof_int+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then :
+
+else
+ if test "$ac_cv_type_int" = yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (int)
+See \`config.log' for more details" "$LINENO" 5; }
+ else
+ ac_cv_sizeof_int=0
+ fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5
+$as_echo "$ac_cv_sizeof_int" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_INT $ac_cv_sizeof_int
+_ACEOF
+
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5
+$as_echo_n "checking size of short... " >&6; }
+if ${ac_cv_sizeof_short+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default"; then :
+
+else
+ if test "$ac_cv_type_short" = yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (short)
+See \`config.log' for more details" "$LINENO" 5; }
+ else
+ ac_cv_sizeof_short=0
+ fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5
+$as_echo "$ac_cv_sizeof_short" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_SHORT $ac_cv_sizeof_short
+_ACEOF
+
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5
+$as_echo_n "checking size of long... " >&6; }
+if ${ac_cv_sizeof_long+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then :
+
+else
+ if test "$ac_cv_type_long" = yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (long)
+See \`config.log' for more details" "$LINENO" 5; }
+ else
+ ac_cv_sizeof_long=0
+ fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5
+$as_echo "$ac_cv_sizeof_long" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG $ac_cv_sizeof_long
+_ACEOF
+
+
+
+ac_fn_c_check_type "$LINENO" "uint32_t" "ac_cv_type_uint32_t" "$ac_includes_default"
+if test "x$ac_cv_type_uint32_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define uint32_t unsigned int
+_ACEOF
+
+fi
+
+ac_fn_c_check_type "$LINENO" "u_int32_t" "ac_cv_type_u_int32_t" "$ac_includes_default"
+if test "x$ac_cv_type_u_int32_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define u_int32_t unsigned int
+_ACEOF
+
+fi
+
+if test "$ac_cv_type_u_int32_t" = no ; then
+ if test "$ac_cv_type_u_int32_t" = yes ; then
+
+$as_echo "#define U_INT32_T_IS_UINT32_T 1" >>confdefs.h
+
+ else
+ if test "$ac_cv_sizeof_int" = 4 ; then
+
+$as_echo "#define U_INT32_T_IS_UINT 1" >>confdefs.h
+
+ else
+ if test "$ac_cv_sizeof_long" = 4 ; then
+
+$as_echo "#define U_INT32_T_IS_ULONG 1" >>confdefs.h
+
+ else
+ if test "$ac_cv_sizeof_short" = 4 ; then
+
+$as_echo "#define U_INT32_T_IS_USHORT 1" >>confdefs.h
+
+ fi
+ fi
+ fi
+ fi
+fi
+
+ac_fn_c_check_type "$LINENO" "int32_t" "ac_cv_type_int32_t" "$ac_includes_default"
+if test "x$ac_cv_type_int32_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define int32_t int
+_ACEOF
+
+fi
+
+if test "$ac_cv_type_int32_t" = no ; then
+ if test "$ac_cv_sizeof_int" = 4 ; then
+
+$as_echo "#define INT32_T_IS_UINT 1" >>confdefs.h
+
+ else
+ if test "$ac_cv_sizeof_long" = 4 ; then
+
+$as_echo "#define INT32_T_IS_ULONG 1" >>confdefs.h
+
+ else
+ if test "$ac_cv_sizeof_short" = 4 ; then
+
+$as_echo "#define INT32_T_IS_USHORT 1" >>confdefs.h
+
+ fi
+ fi
+ fi
+fi
+
+ac_fn_c_check_type "$LINENO" "struct sockaddr_storage" "ac_cv_type_struct_sockaddr_storage" "#include <sys/socket.h>
+"
+if test "x$ac_cv_type_struct_sockaddr_storage" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_SOCKADDR_STORAGE 1
+_ACEOF
+
+
+fi
+
+
+ac_fn_c_check_func "$LINENO" "seteuid" "ac_cv_func_seteuid"
+if test "x$ac_cv_func_seteuid" = xyes; then :
+ $as_echo "#define SETEUID(id) seteuid(id)" >>confdefs.h
+
+else
+ $as_echo "#define SETEUID(id) setresuid((uid_t) -1, id, (uid_t) -1)" >>confdefs.h
+
+
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for va_copy" >&5
+$as_echo_n "checking for va_copy... " >&6; }
+if ${ac_cv_HAVE_VA_COPY+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdarg.h>
+va_list ap1,ap2;
+int
+main ()
+{
+va_copy(ap1,ap2);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_HAVE_VA_COPY=yes
+else
+ ac_cv_HAVE_VA_COPY=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_HAVE_VA_COPY" >&5
+$as_echo "$ac_cv_HAVE_VA_COPY" >&6; }
+if test x"$ac_cv_HAVE_VA_COPY" = x"yes"; then
+
+$as_echo "#define HAVE_VA_COPY 1" >>confdefs.h
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __va_copy" >&5
+$as_echo_n "checking for __va_copy... " >&6; }
+if ${ac_cv_HAVE___VA_COPY+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdarg.h>
+ va_list ap1,ap2;
+int
+main ()
+{
+__va_copy(ap1,ap2);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_HAVE___VA_COPY=yes
+else
+ ac_cv_HAVE___VA_COPY=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_HAVE___VA_COPY" >&5
+$as_echo "$ac_cv_HAVE___VA_COPY" >&6; }
+ if test x"$ac_cv_HAVE___VA_COPY" = x"yes"; then
+
+$as_echo "#define HAVE___VA_COPY 1" >>confdefs.h
+
+ fi
+fi
+
+ac_fn_c_check_func "$LINENO" "vsnprintf" "ac_cv_func_vsnprintf"
+if test "x$ac_cv_func_vsnprintf" = xyes; then :
+
+else
+ SNPRINTF_O=./snprintf.o
+fi
+
+ac_fn_c_check_func "$LINENO" "snprintf" "ac_cv_func_snprintf"
+if test "x$ac_cv_func_snprintf" = xyes; then :
+
+else
+ SNPRINTF_O=./snprintf.o
+fi
+
+ac_fn_c_check_func "$LINENO" "asprintf" "ac_cv_func_asprintf"
+if test "x$ac_cv_func_asprintf" = xyes; then :
+
+else
+ SNPRINTF_O=./snprintf.o
+fi
+
+ac_fn_c_check_func "$LINENO" "vasprintf" "ac_cv_func_vasprintf"
+if test "x$ac_cv_func_vasprintf" = xyes; then :
+
+else
+ SNPRINTF_O=./snprintf.o
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C99 vsnprintf" >&5
+$as_echo_n "checking for C99 vsnprintf... " >&6; }
+if ${ac_cv_HAVE_C99_VSNPRINTF+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+if test "$cross_compiling" = yes; then :
+ ac_cv_HAVE_C99_VSNPRINTF=cross
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <sys/types.h>
+#include <stdarg.h>
+void foo(const char *format, ...) {
+ va_list ap;
+ int len;
+ char buf[5];
+
+ va_start(ap, format);
+ len = vsnprintf(buf, 0, format, ap);
+ va_end(ap);
+ if (len != 5) exit(1);
+
+ va_start(ap, format);
+ len = vsnprintf(0, 0, format, ap);
+ va_end(ap);
+ if (len != 5) exit(1);
+
+ if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
+
+ exit(0);
+}
+main() { foo("hello"); }
+
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_HAVE_C99_VSNPRINTF=yes
+else
+ ac_cv_HAVE_C99_VSNPRINTF=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_HAVE_C99_VSNPRINTF" >&5
+$as_echo "$ac_cv_HAVE_C99_VSNPRINTF" >&6; }
+if test x"$ac_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
+
+$as_echo "#define HAVE_C99_VSNPRINTF 1" >>confdefs.h
+
+fi
+
+
+for ac_func in getopt_long
+do :
+ ac_fn_c_check_func "$LINENO" "getopt_long" "ac_cv_func_getopt_long"
+if test "x$ac_cv_func_getopt_long" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_GETOPT_LONG 1
+_ACEOF
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getopt_long in -liberty" >&5
+$as_echo_n "checking for getopt_long in -liberty... " >&6; }
+if ${ac_cv_lib_iberty_getopt_long+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-liberty $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char getopt_long ();
+int
+main ()
+{
+return getopt_long ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_iberty_getopt_long=yes
+else
+ ac_cv_lib_iberty_getopt_long=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_iberty_getopt_long" >&5
+$as_echo "$ac_cv_lib_iberty_getopt_long" >&6; }
+if test "x$ac_cv_lib_iberty_getopt_long" = xyes; then :
+ OTHERLIBS="$OTHERLIBS -liberty"
+fi
+
+fi
+done
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lnsl" >&5
+$as_echo_n "checking for main in -lnsl... " >&6; }
+if ${ac_cv_lib_nsl_main+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lnsl $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+
+int
+main ()
+{
+return main ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_nsl_main=yes
+else
+ ac_cv_lib_nsl_main=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_main" >&5
+$as_echo "$ac_cv_lib_nsl_main" >&6; }
+if test "x$ac_cv_lib_nsl_main" = xyes; then :
+ SOCKETLIBS="$SOCKETLIBS -lnsl"
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for socket in -lsocket" >&5
+$as_echo_n "checking for socket in -lsocket... " >&6; }
+if ${ac_cv_lib_socket_socket+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsocket $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char socket ();
+int
+main ()
+{
+return socket ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_socket_socket=yes
+else
+ ac_cv_lib_socket_socket=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_socket" >&5
+$as_echo "$ac_cv_lib_socket_socket" >&6; }
+if test "x$ac_cv_lib_socket_socket" = xyes; then :
+ SOCKETLIBS="$SOCKETLIBS -lsocket"
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -lwrap" >&5
+$as_echo_n "checking for main in -lwrap... " >&6; }
+if ${ac_cv_lib_wrap_main+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lwrap $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+
+int
+main ()
+{
+return main ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_wrap_main=yes
+else
+ ac_cv_lib_wrap_main=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_wrap_main" >&5
+$as_echo "$ac_cv_lib_wrap_main" >&6; }
+if test "x$ac_cv_lib_wrap_main" = xyes; then :
+
+ LIBWRAPLIBS="$LIBWRAPLIBS -lwrap"
+
+$as_echo "#define HAVE_LIBWRAP 1" >>confdefs.h
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <tcpd.h>
+
+int
+main ()
+{
+int a = rfc931_timeout;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ $as_echo "#define HAVE_RFC931_TIMEOUT 1" >>confdefs.h
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
+fi
+
+for ac_func in strdup strstr strtoul strtok_r initgroups closesocket sigaction scandir
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" "#include <sys/types.h>
+#include <sys/socket.h>
+"
+if test "x$ac_cv_type_socklen_t" = xyes; then :
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socklen_t equivalent" >&5
+$as_echo_n "checking for socklen_t equivalent... " >&6; }
+ if ${curl_cv_socklen_t_equiv+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ # Systems have either "struct sockaddr *" or
+ # "void *" as the second argument to getpeername
+ curl_cv_socklen_t_equiv=
+ for arg2 in "struct sockaddr" void; do
+ for t in int size_t unsigned long "unsigned long"; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ #ifdef HAVE_SYS_TYPES_H
+ #include <sys/types.h>
+ #endif
+ #ifdef HAVE_SYS_SOCKET_H
+ #include <sys/socket.h>
+ #endif
+
+ int getpeername (int, $arg2 *, $t *);
+
+int
+main ()
+{
+
+ $t len;
+ getpeername(0,0,&len);
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ curl_cv_socklen_t_equiv="$t"
+ break
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+ done
+
+ if test "x$curl_cv_socklen_t_equiv" = x; then
+ as_fn_error $? "Cannot find a type to use in place of socklen_t" "$LINENO" 5
+ fi
+
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $curl_cv_socklen_t_equiv" >&5
+$as_echo "$curl_cv_socklen_t_equiv" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define socklen_t $curl_cv_socklen_t_equiv
+_ACEOF
+
+fi
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for type of socket size" >&5
+$as_echo_n "checking for type of socket size... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+
+int
+main ()
+{
+int a = send(1, (const void *)0, (size_t *) 0, (int *) 0);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+$as_echo "#define SOCKET_SIZE_TYPE size_t" >>confdefs.h
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: size_t" >&5
+$as_echo "size_t" >&6; }
+else
+
+$as_echo "#define SOCKET_SIZE_TYPE int" >>confdefs.h
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: int" >&5
+$as_echo "int" >&6; }
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+# Check whether --enable-ssl was given.
+if test "${enable_ssl+set}" = set; then :
+ enableval=$enable_ssl;
+ if test x$enableval = xyes; then
+ check_for_ssl=yes
+ else
+ check_for_ssl=no
+ fi
+
+else
+ check_for_ssl=yes
+fi
+
+
+need_dh=yes
+
+# Check whether --with-need_dh was given.
+if test "${with_need_dh+set}" = set; then :
+ withval=$with_need_dh; need_dh=$withval
+else
+ nrpe_group=need_dh
+fi
+
+
+if test x$check_for_ssl = xyes; then
+ # need_dh should only be set for NRPE
+ #need_dh=yes
+
+
+# -------------------------------
+# SSL library and include paths
+# -------------------------------
+
+SSL_TYPE=openssl
+try_pkg_config=1
+ssl_dir=
+ssl_inc_dir=
+ssl_lib_dir=
+SSL_INC_DIR=
+SSL_INC_PREFIX=
+SSL_HDR=
+SSL_LIB_DIR=
+
+
+
+
+
+
+
+
+
+# gnutls/openssl.h
+# nss_compat_ossl/nss_compat_ossl.h
+
+
+
+# Check whether --with-ssl was given.
+if test "${with_ssl+set}" = set; then :
+ withval=$with_ssl; ssl_dir=$withval
+fi
+
+
+# Check whether --with-ssl-inc was given.
+if test "${with_ssl_inc+set}" = set; then :
+ withval=$with_ssl_inc; ssl_inc_dir=$withval
+fi
+
+
+# Check whether --with-ssl-lib was given.
+if test "${with_ssl_lib+set}" = set; then :
+ withval=$with_ssl_lib; ssl_lib_dir=$withval
+fi
+
+
+if test x$ssl_inc_dir != x -o x$ssl_lib_dir != x; then
+ try_pkg_config=0
+fi
+
+
+# Check whether --with-kerberos-inc was given.
+if test "${with_kerberos_inc+set}" = set; then :
+ withval=$with_kerberos_inc; kerberos_inc_dir=$withval
+fi
+
+
+if test x$SSL_TYPE = xyes; then
+ SSL_TYPE=openssl
+fi
+
+
+dflt_hdrs="$ssl_inc_dir $ssl_dir $ssl_inc_dir/include $ssl_dir/include \
+ /usr/local/opt/{BBB} /usr/include/{BBB} /usr/local/include/{BBB} \
+ /usr/local/{AAA} /usr/local/{BBB} /usr/lib/{AAA} /usr/lib/{BBB} \
+ /usr/{AAA} /usr/pkg /usr/local /usr /usr/freeware/lib/{BBB} \
+ /usr/sfw /usr/sfw/include /opt/{BBB}"
+
+dflt_libs="$ssl_lib_dir {ssldir} {ssldir}/lib {ssldir}/lib64 /usr/lib64 \
+ /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/i386-linux-gnu \
+ /usr/local/lib /usr/lib/{AAA} /usr/{AAA}/lib /usr/{BBB}/lib \
+ /usr/pkg/lib /usr/freeware/lib/{BBB} /usr/sfw/lib /opt/freeware/lib \
+ /opt/{BBB}/lib/hpux64 /opt/{BBB}/lib/pa20_64 /opt/{BBB}/lib/hpux32 \
+ /opt/{BBB}/lib /opt/{BBB}";
+
+
+case $SSL_TYPE in #(
+ no) :
+ SSL_TYPE=NONE ;; #(
+ yes|openssl) :
+ ssl_hdr_dirs=`echo "$dflt_hdrs" | sed -e 's/{AAA}/ssl/g' | sed -e 's/{BBB}/openssl/g'`
+ ssl_lib_dirs=`echo "$dflt_libs" | sed -e 's/{AAA}/ssl/g' | sed -e 's/{BBB}/openssl/g'`
+ SSL_INC_PREFIX=openssl
+ SSL_HDR=ssl.h
+ ssl_lib=libssl ;; #(
+ gnutls) :
+ ssl_hdr_dirs=`echo "$dflt_hdrs" | sed -e 's/{AAA}/gnutls/g' | sed -e 's/{BBB}/gnutls/g'`
+ ssl_lib_dirs=`echo "$dflt_libs" | sed -e 's/{AAA}/gnutls/g' | sed -e 's/{BBB}/gnutls/g'`
+ SSL_INC_PREFIX=gnutls
+ SSL_TYPE=gnutls_compat
+ SSL_HDR=compat.h
+ ssl_lib=libgnutls ;; #(
+ nss) :
+ ssl_hdr_dirs=`echo "$dflt_hdrs" | sed -e 's/{AAA}/nss_compat_ossl/g' | sed -e 's/{BBB}/nss_compat_ossl/g'`
+ ssl_lib_dirs=`echo "$dflt_libs" | sed -e 's/{AAA}/nss_compat_ossl/g' | sed -e 's/{BBB}/nss_compat_ossl/g'`
+ SSL_HDR=nss_compat_ossl.h
+ ssl_lib=libnss_compat ;; #(
+ *) :
+ echo >&6; as_fn_error $? "'--with-ssl-type=$SSL_TYPE' is invalid" "$LINENO" 5
+ ;; #(
+ *) :
+ ;;
+esac
+
+
+# Check for SSL support
+
+if test x$SSL_TYPE != xNONE; then
+
+ found_ssl=no
+
+ # RedHat 8.0 and 9.0 include openssl compiled with kerberos,
+ # so we must include header file
+ # Must come before openssl checks for Redhat EL 3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Kerberos include files" >&5
+$as_echo_n "checking for Kerberos include files... " >&6; }
+ found_kerberos=no
+ for dir in $kerberos_inc_dir /usr/kerberos/include /usr/include/krb5 \
+ /usr/include; do
+ kerbdir="$dir"
+ if test -f "$dir/krb5.h"; then
+ found_kerberos=yes
+ CFLAGS="$CFLAGS -I$kerbdir"
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_KRB5_H 1
+_ACEOF
+
+ break
+ fi
+ done
+
+ if test x_$found_kerberos != x_yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: could not find include files" >&5
+$as_echo "$as_me: WARNING: could not find include files" >&2;}
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: found Kerberos include files in $kerbdir" >&5
+$as_echo "found Kerberos include files in $kerbdir" >&6; }
+ fi
+
+ # First, try using pkg_config
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_PKG_CONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$PKG_CONFIG"; then
+ ac_cv_prog_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_PKG_CONFIG="${ac_tool_prefix}pkg-config"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+PKG_CONFIG=$ac_cv_prog_PKG_CONFIG
+if test -n "$PKG_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
+$as_echo "$PKG_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_PKG_CONFIG"; then
+ ac_ct_PKG_CONFIG=$PKG_CONFIG
+ # Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_PKG_CONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_PKG_CONFIG"; then
+ ac_cv_prog_ac_ct_PKG_CONFIG="$ac_ct_PKG_CONFIG" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_PKG_CONFIG="pkg-config"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_PKG_CONFIG=$ac_cv_prog_ac_ct_PKG_CONFIG
+if test -n "$ac_ct_PKG_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_PKG_CONFIG" >&5
+$as_echo "$ac_ct_PKG_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_PKG_CONFIG" = x; then
+ PKG_CONFIG=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ PKG_CONFIG=$ac_ct_PKG_CONFIG
+ fi
+else
+ PKG_CONFIG="$ac_cv_prog_PKG_CONFIG"
+fi
+
+ if test x"$PKG_CONFIG" != x -a $try_pkg_config -ne 0 ; then
+ cflags=`$PKG_CONFIG $SSL_TYPE --cflags-only-I 2>/dev/null`
+ if test $? -eq 0; then
+ CFLAGS="$CFLAGS $cflags"
+ LDFLAGS="$LDFLAGS `$PKG_CONFIG $SSL_TYPE --libs-only-L 2>/dev/null`"
+ LIBS="$LIBS `$PKG_CONFIG $SSL_TYPE --libs-only-l 2>/dev/null`"
+ found_ssl=yes
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_SSL 1
+_ACEOF
+
+ fi
+ fi
+
+ if test x_$found_ssl != x_yes; then
+
+ # Find the SSL Headers
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL headers" >&5
+$as_echo_n "checking for SSL headers... " >&6; }
+ for dir in $ssl_hdr_dirs; do
+ if test "$dir" = "/include"; then
+ continue
+ fi
+ ssldir="$dir"
+ if test -f "$dir/include/$SSL_INC_PREFIX/$SSL_HDR"; then
+ found_ssl=yes
+ CFLAGS="$CFLAGS -I$dir/include/$SSL_INC_PREFIX -I$ssldir/include"
+ SSL_INC_DIR="$dir/include/$SSL_INC_PREFIX"
+ break
+ fi
+ if test -f "$dir/include/$SSL_HDR"; then
+ found_ssl=yes
+ if test "$SSL_HDR" != compat.h ; then
+ SSL_INC_PREFIX=""
+ fi
+ CFLAGS="$CFLAGS -I$dir/include"
+ SSL_INC_DIR="$dir/include"
+ break
+ fi
+ if test -f "$dir/$SSL_HDR"; then
+ found_ssl=yes
+ SSL_INC_PREFIX=""
+ CFLAGS="$CFLAGS -I$dir"
+ SSL_INC_DIR="$dir"
+ break
+ fi
+ if test -f "$dir/$SSL_INC_PREFIX/$SSL_HDR"; then
+ found_ssl=yes
+ CFLAGS="$CFLAGS -I$dir/$SSL_INC_PREFIX"
+ SSL_INC_DIR="$dir/$SSL_INC_PREFIX"
+ ssldir="$dir/.."
+ break
+ fi
+ done
+
+ if test x_$found_ssl != x_yes; then
+ as_fn_error $? "Cannot find ssl headers" "$LINENO" 5
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: found in $ssldir" >&5
+$as_echo "found in $ssldir" >&6; }
+
+ # Now try and find SSL libraries
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL libraries" >&5
+$as_echo_n "checking for SSL libraries... " >&6; }
+ found_ssl=no
+ ssl_lib_dirs=`echo "$ssl_lib_dirs" | sed -e "s|{ssldir}|$ssldir|g"`
+
+ if test "`uname -s`" = "Darwin" ; then
+ soext="dylib"
+ elif test "`uname -s`" = "HP-UX" ; then
+ if test x$arch = "xia64"; then
+ soext="so"
+ else
+ soext="sl"
+ fi
+ elif test "`uname -s`" = "AIX" ; then
+ soext="a"
+ else
+ soext="so"
+ fi
+
+ for dir in $ssl_lib_dirs; do
+ if test -f "$dir/$ssl_lib.$soext"; then
+ found_ssl=yes
+ SSL_LIB_DIR="$dir"
+ break
+ fi
+ done
+
+ if test x_$found_ssl != x_yes; then
+ as_fn_error $? "Cannot find ssl libraries" "$LINENO" 5
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: found in $SSL_LIB_DIR" >&5
+$as_echo "found in $SSL_LIB_DIR" >&6; }
+
+ LDFLAGS="$LDFLAGS -L$SSL_LIB_DIR";
+ LIBS="$LIBS -l`echo $ssl_lib | sed -e 's/^lib//'` -lcrypto";
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_SSL 1
+_ACEOF
+
+ fi
+ fi
+ fi
+
+ if test x$found_ssl = xyes ; then
+ if test -n "$SSL_INC_PREFIX" ; then
+ SSL_INC_PREFIX="${SSL_INC_PREFIX}/"
+ fi
+
+ # try to compile and link to see if SSL is set up properly
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiling and linking against SSL works" >&5
+$as_echo_n "checking whether compiling and linking against SSL works... " >&6; }
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <${SSL_INC_PREFIX}${SSL_HDR}>
+int
+main ()
+{
+SSL_new(NULL)
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+
+else
+
+ as_fn_error $? "no" "$LINENO" 5
+
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ fi
+
+ if test x$found_ssl = xyes -a x$need_dh = xyes; then
+
+ # Find the openssl program
+
+ if test x$need_dh = xyes; then
+ # Extract the first word of "openssl", so it can be a program name with args.
+set dummy openssl; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_sslbin+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $sslbin in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_sslbin="$sslbin" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $ssl_dir/sbin$PATH_SEPARATOR$ssl_dir/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_sslbin="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ test -z "$ac_cv_path_sslbin" && ac_cv_path_sslbin="value-if-not-found"
+ ;;
+esac
+fi
+sslbin=$ac_cv_path_sslbin
+if test -n "$sslbin"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $sslbin" >&5
+$as_echo "$sslbin" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ $as_echo "#define USE_SSL_DH 1" >>confdefs.h
+
+ # Generate DH parameters
+ if test -f "$sslbin"; then
+ echo ""
+ echo "*** Generating DH Parameters for SSL/TLS ***"
+ # awk to strip off meta data at bottom of dhparam output
+ $sslbin dhparam -C 2048 | awk '/^-----/ {exit} {print}' > include/dh.h
+ fi
+ fi
+ fi
+fi
+
+fi
+
+
+# Check whether --with-log_facility was given.
+if test "${with_log_facility+set}" = set; then :
+ withval=$with_log_facility; log_facility=$withval
+else
+ log_facility=daemon
+fi
+
+
+cat >>confdefs.h <<_ACEOF
+#define NRPE_LOG_FACILITY "$log_facility"
+_ACEOF
+
+
+
+# Check whether --with-nrpe_user was given.
+if test "${with_nrpe_user+set}" = set; then :
+ withval=$with_nrpe_user; nrpe_user=$withval
+else
+ nrpe_user=nagios
+fi
+
+
+
+# Check whether --with-nrpe_group was given.
+if test "${with_nrpe_group+set}" = set; then :
+ withval=$with_nrpe_group; nrpe_group=$withval
+else
+ nrpe_group=nagios
+fi
+
+
+
+# Check whether --with-nrpe_port was given.
+if test "${with_nrpe_port+set}" = set; then :
+ withval=$with_nrpe_port; nrpe_port=$withval
+else
+ nrpe_port=5666
+fi
+
+NRPE_INSTALL_OPTS="-o $nrpe_user -g $nrpe_group"
+
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_SERVER_PORT $nrpe_port
+_ACEOF
+
+
+
+# Check whether --with-nagios_user was given.
+if test "${with_nagios_user+set}" = set; then :
+ withval=$with_nagios_user; nagios_user=$withval
+else
+ nagios_user=nagios
+fi
+
+
+# Check whether --with-nagios_group was given.
+if test "${with_nagios_group+set}" = set; then :
+ withval=$with_nagios_group; nagios_group=$withval
+else
+ nagios_group=nagios
+fi
+
+NAGIOS_INSTALL_OPTS="-o $nagios_user -g $nagios_group"
+
+ if test "`uname -s`" = "HP-UX" ; then
+ LDFLAGS="$LDFLAGS -Wl,+allowdups";
+ fi
+
+# Check whether --enable-command-args was given.
+if test "${enable_command_args+set}" = set; then :
+ enableval=$enable_command_args;
+cat >>confdefs.h <<_ACEOF
+#define ENABLE_COMMAND_ARGUMENTS 1
+_ACEOF
+
+fi
+
+
+# Check whether --enable-bash-command-substitution was given.
+if test "${enable_bash_command_substitution+set}" = set; then :
+ enableval=$enable_bash_command_substitution;
+cat >>confdefs.h <<_ACEOF
+#define ENABLE_BASH_COMMAND_SUBSTITUTION 1
+_ACEOF
+
+fi
+
+
+
+# Extract the first word of "perl", so it can be a program name with args.
+set dummy perl; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_PERL+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $PERL in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_PERL="$PERL" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+PERL=$ac_cv_path_PERL
+if test -n "$PERL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5
+$as_echo "$PERL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+U=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+ ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+ # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
+ # will be set to the directory where LIBOBJS objects are built.
+ as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+
+: "${CONFIG_STATUS=./config.status}"
+ac_write_fail=0
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+ fi
+ $as_echo "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -pR'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -pR'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -pR'
+ fi
+else
+ as_ln_s='cp -pR'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p='mkdir -p "$as_dir"'
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by nrpe $as_me newdate, which was
+generated by GNU Autoconf 2.69. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
+
+case $ac_config_headers in *"
+"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
+esac
+
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ac_cs_usage="\
+\`$as_me' instantiates files and other configuration actions
+from templates according to the current configuration. Unless the files
+and actions are specified as TAGs, all are instantiated by default.
+
+Usage: $0 [OPTION]... [TAG]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number and configuration settings, then exit
+ --config print configuration, then exit
+ -q, --quiet, --silent
+ do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+ --header=FILE[:TEMPLATE]
+ instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Report bugs to <nagios-users@lists.sourceforge.net>.
+nrpe home page: <https://www.nagios.org/downloads/nagios-core-addons/>."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
+ac_cs_version="\\
+nrpe config.status newdate
+configured by $0, generated by GNU Autoconf 2.69,
+ with options \\"\$ac_cs_config\\"
+
+Copyright (C) 2012 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+test -n "\$AWK" || AWK=awk
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=?*)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ --*=)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=
+ ac_shift=:
+ ;;
+ *)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+ $as_echo "$ac_cs_version"; exit ;;
+ --config | --confi | --conf | --con | --co | --c )
+ $as_echo "$ac_cs_config"; exit ;;
+ --debug | --debu | --deb | --de | --d | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ '') as_fn_error $? "missing file argument" ;;
+ esac
+ as_fn_append CONFIG_FILES " '$ac_optarg'"
+ ac_need_defaults=false;;
+ --header | --heade | --head | --hea )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ as_fn_append CONFIG_HEADERS " '$ac_optarg'"
+ ac_need_defaults=false;;
+ --he | --h)
+ # Conflict between --help and --header
+ as_fn_error $? "ambiguous option: \`$1'
+Try \`$0 --help' for more information.";;
+ --help | --hel | -h )
+ $as_echo "$ac_cs_usage"; exit ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) as_fn_error $? "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
+
+ *) as_fn_append ac_config_targets " $1"
+ ac_need_defaults=false ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+if \$ac_cs_recheck; then
+ set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ shift
+ \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+ CONFIG_SHELL='$SHELL'
+ export CONFIG_SHELL
+ exec "\$@"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+ $as_echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+ case $ac_config_target in
+ "paths") CONFIG_FILES="$CONFIG_FILES paths" ;;
+ "include/config.h") CONFIG_HEADERS="$CONFIG_HEADERS include/config.h" ;;
+ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
+ "nrpe.spec") CONFIG_FILES="$CONFIG_FILES nrpe.spec" ;;
+ "uninstall") CONFIG_FILES="$CONFIG_FILES uninstall" ;;
+ "sample-config/nrpe.cfg") CONFIG_FILES="$CONFIG_FILES sample-config/nrpe.cfg" ;;
+ "startup/bsd-init") CONFIG_FILES="$CONFIG_FILES startup/bsd-init" ;;
+ "startup/debian-init") CONFIG_FILES="$CONFIG_FILES startup/debian-init" ;;
+ "startup/default-init") CONFIG_FILES="$CONFIG_FILES startup/default-init" ;;
+ "startup/default-inetd") CONFIG_FILES="$CONFIG_FILES startup/default-inetd" ;;
+ "startup/default-service") CONFIG_FILES="$CONFIG_FILES startup/default-service" ;;
+ "startup/default-socket") CONFIG_FILES="$CONFIG_FILES startup/default-socket" ;;
+ "startup/default-socket-svc") CONFIG_FILES="$CONFIG_FILES startup/default-socket-svc" ;;
+ "startup/default-xinetd") CONFIG_FILES="$CONFIG_FILES startup/default-xinetd" ;;
+ "startup/mac-init.plist") CONFIG_FILES="$CONFIG_FILES startup/mac-init.plist" ;;
+ "startup/mac-inetd.plist") CONFIG_FILES="$CONFIG_FILES startup/mac-inetd.plist" ;;
+ "startup/newbsd-init") CONFIG_FILES="$CONFIG_FILES startup/newbsd-init" ;;
+ "startup/openbsd-init") CONFIG_FILES="$CONFIG_FILES startup/openbsd-init" ;;
+ "startup/openrc-conf") CONFIG_FILES="$CONFIG_FILES startup/openrc-conf" ;;
+ "startup/openrc-init") CONFIG_FILES="$CONFIG_FILES startup/openrc-init" ;;
+ "startup/solaris-init.xml") CONFIG_FILES="$CONFIG_FILES startup/solaris-init.xml" ;;
+ "startup/solaris-inetd.xml") CONFIG_FILES="$CONFIG_FILES startup/solaris-inetd.xml" ;;
+ "startup/tmpfile.conf") CONFIG_FILES="$CONFIG_FILES startup/tmpfile.conf" ;;
+ "startup/upstart-init") CONFIG_FILES="$CONFIG_FILES startup/upstart-init" ;;
+ "startup/rh-upstart-init") CONFIG_FILES="$CONFIG_FILES startup/rh-upstart-init" ;;
+ "include/common.h") CONFIG_FILES="$CONFIG_FILES include/common.h" ;;
+
+ *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+ esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+ tmp= ac_tmp=
+ trap 'exit_status=$?
+ : "${ac_tmp:=$tmp}"
+ { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
+' 0
+ trap 'as_fn_exit 1' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+ test -d "$tmp"
+} ||
+{
+ tmp=./conf$$-$RANDOM
+ (umask 077 && mkdir "$tmp")
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
+
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
+if test -n "$CONFIG_FILES"; then
+
+
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+ eval ac_cr=\$\'\\r\'
+fi
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+ ac_cs_awk_cr='\\r'
+else
+ ac_cs_awk_cr=$ac_cr
+fi
+
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
+_ACEOF
+
+
+{
+ echo "cat >conf$$subs.awk <<_ACEOF" &&
+ echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+ echo "_ACEOF"
+} >conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ . ./conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+
+ ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+ if test $ac_delim_n = $ac_delim_num; then
+ break
+ elif $ac_last_try; then
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\)..*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\)..*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+ N
+ s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
+ for (key in S) S_is_set[key] = 1
+ FS = ""
+
+}
+{
+ line = $ 0
+ nfields = split(line, field, "@")
+ substed = 0
+ len = length(field[1])
+ for (i = 2; i < nfields; i++) {
+ key = field[i]
+ keylen = length(key)
+ if (S_is_set[key]) {
+ value = S[key]
+ line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+ len += length(value) + length(field[++i])
+ substed = 1
+ } else
+ len += 1 + keylen
+ }
+
+ print line
+}
+
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+ cat
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
+ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
+_ACEOF
+
+# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
+# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
+h
+s///
+s/^/:/
+s/[ ]*$/:/
+s/:\$(srcdir):/:/g
+s/:\${srcdir}:/:/g
+s/:@srcdir@:/:/g
+s/^:*//
+s/:*$//
+x
+s/\(=[ ]*\).*/\1/
+G
+s/\n//
+s/^[^=]*=[ ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+fi # test -n "$CONFIG_FILES"
+
+# Set up the scripts for CONFIG_HEADERS section.
+# No need to generate them if there are no CONFIG_HEADERS.
+# This happens for instance with `./config.status Makefile'.
+if test -n "$CONFIG_HEADERS"; then
+cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
+BEGIN {
+_ACEOF
+
+# Transform confdefs.h into an awk script `defines.awk', embedded as
+# here-document in config.status, that substitutes the proper values into
+# config.h.in to produce config.h.
+
+# Create a delimiter string that does not exist in confdefs.h, to ease
+# handling of long lines.
+ac_delim='%!_!# '
+for ac_last_try in false false :; do
+ ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
+ if test -z "$ac_tt"; then
+ break
+ elif $ac_last_try; then
+ as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+
+# For the awk script, D is an array of macro values keyed by name,
+# likewise P contains macro parameters if any. Preserve backslash
+# newline sequences.
+
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+sed -n '
+s/.\{148\}/&'"$ac_delim"'/g
+t rset
+:rset
+s/^[ ]*#[ ]*define[ ][ ]*/ /
+t def
+d
+:def
+s/\\$//
+t bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3"/p
+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p
+d
+:bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3\\\\\\n"\\/p
+t cont
+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
+t cont
+d
+:cont
+n
+s/.\{148\}/&'"$ac_delim"'/g
+t clear
+:clear
+s/\\$//
+t bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/"/p
+d
+:bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
+b cont
+' <confdefs.h | sed '
+s/'"$ac_delim"'/"\\\
+"/g' >>$CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ for (key in D) D_is_set[key] = 1
+ FS = ""
+}
+/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
+ line = \$ 0
+ split(line, arg, " ")
+ if (arg[1] == "#") {
+ defundef = arg[2]
+ mac1 = arg[3]
+ } else {
+ defundef = substr(arg[1], 2)
+ mac1 = arg[2]
+ }
+ split(mac1, mac2, "(") #)
+ macro = mac2[1]
+ prefix = substr(line, 1, index(line, defundef) - 1)
+ if (D_is_set[macro]) {
+ # Preserve the white space surrounding the "#".
+ print prefix "define", macro P[macro] D[macro]
+ next
+ } else {
+ # Replace #undef with comments. This is necessary, for example,
+ # in the case of _POSIX_SOURCE, which is predefined and required
+ # on some systems where configure will not decide to define it.
+ if (defundef == "undef") {
+ print "/*", prefix defundef, macro, "*/"
+ next
+ }
+ }
+}
+{ print }
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
+fi # test -n "$CONFIG_HEADERS"
+
+
+eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS "
+shift
+for ac_tag
+do
+ case $ac_tag in
+ :[FHLC]) ac_mode=$ac_tag; continue;;
+ esac
+ case $ac_mode$ac_tag in
+ :[FHL]*:*);;
+ :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
+ :[FH]-) ac_tag=-:-;;
+ :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+ esac
+ ac_save_IFS=$IFS
+ IFS=:
+ set x $ac_tag
+ IFS=$ac_save_IFS
+ shift
+ ac_file=$1
+ shift
+
+ case $ac_mode in
+ :L) ac_source=$1;;
+ :[FH])
+ ac_file_inputs=
+ for ac_f
+ do
+ case $ac_f in
+ -) ac_f="$ac_tmp/stdin";;
+ *) # Look for the file first in the build tree, then in the source tree
+ # (if the path is not absolute). The absolute path cannot be DOS-style,
+ # because $ac_f cannot contain `:'.
+ test -f "$ac_f" ||
+ case $ac_f in
+ [\\/$]*) false;;
+ *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+ esac ||
+ as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+ esac
+ case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+ as_fn_append ac_file_inputs " '$ac_f'"
+ done
+
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ configure_input='Generated from '`
+ $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+ `' by configure.'
+ if test x"$ac_file" != x-; then
+ configure_input="$ac_file. $configure_input"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
+ fi
+ # Neutralize special characters interpreted by sed in replacement strings.
+ case $configure_input in #(
+ *\&* | *\|* | *\\* )
+ ac_sed_conf_input=`$as_echo "$configure_input" |
+ sed 's/[\\\\&|]/\\\\&/g'`;; #(
+ *) ac_sed_conf_input=$configure_input;;
+ esac
+
+ case $ac_tag in
+ *:-:* | *:-) cat >"$ac_tmp/stdin" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
+ esac
+ ;;
+ esac
+
+ ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ as_dir="$ac_dir"; as_fn_mkdir_p
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+ case $ac_mode in
+ :F)
+ #
+ # CONFIG_FILE
+ #
+
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+ esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+ac_sed_dataroot='
+/datarootdir/ {
+ p
+ q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ ac_datarootdir_hack='
+ s&@datadir@&$datadir&g
+ s&@docdir@&$docdir&g
+ s&@infodir@&$infodir&g
+ s&@localedir@&$localedir&g
+ s&@mandir@&$mandir&g
+ s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s|@configure_input@|$ac_sed_conf_input|;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+$ac_datarootdir_hack
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \
+ "$ac_tmp/out"`; test -z "$ac_out"; } &&
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined" >&5
+$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined" >&2;}
+
+ rm -f "$ac_tmp/stdin"
+ case $ac_file in
+ -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+ *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
+ esac \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ ;;
+ :H)
+ #
+ # CONFIG_HEADER
+ #
+ if test x"$ac_file" != x-; then
+ {
+ $as_echo "/* $configure_input */" \
+ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
+ } >"$ac_tmp/config.h" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
+$as_echo "$as_me: $ac_file is unchanged" >&6;}
+ else
+ rm -f "$ac_file"
+ mv "$ac_tmp/config.h" "$ac_file" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ fi
+ else
+ $as_echo "/* $configure_input */" \
+ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
+ || as_fn_error $? "could not create -" "$LINENO" 5
+ fi
+ ;;
+
+
+ esac
+
+done # for ac_tag
+
+
+as_fn_exit 0
+_ACEOF
+ac_clean_files=$ac_clean_files_save
+
+test $ac_write_fail = 0 ||
+ as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || as_fn_exit 1
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
+fi
+
+
+echo ""
+echo ""
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: *** Configuration summary for $PKG_NAME $PKG_VERSION $PKG_REL_DATE ***:" >&5
+$as_echo "*** Configuration summary for $PKG_NAME $PKG_VERSION $PKG_REL_DATE ***:" >&6; }
+
+echo "";\
+echo " General Options:";\
+echo " -------------------------"
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: NRPE port: $nrpe_port" >&5
+$as_echo " NRPE port: $nrpe_port" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: NRPE user: $nrpe_user" >&5
+$as_echo " NRPE user: $nrpe_user" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: NRPE group: $nrpe_group" >&5
+$as_echo " NRPE group: $nrpe_group" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Nagios user: $nagios_user" >&5
+$as_echo " Nagios user: $nagios_user" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Nagios group: $nagios_group" >&5
+$as_echo " Nagios group: $nagios_group" >&6; }
+
+
+echo "";\
+echo "";\
+echo "Review the options above for accuracy. If they look okay,";\
+echo "type 'make all' to compile the NRPE daemon and client";\
+echo "or type 'make' to get a list of make options.";\
+echo ""
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..b22b2d6
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,397 @@
+dnl Process this -*-m4-*- file with autoconf to produce a configure script.
+
+dnl Disable caching
+define([AC_CACHE_LOAD],)
+define([AC_CACHE_SAVE],)
+
+m4_include([build-aux/custom_help.m4])
+AC_INIT([nrpe],[newdate],[nagios-users@lists.sourceforge.net],[nrpe],[https://www.nagios.org/downloads/nagios-core-addons/])
+AC_CONFIG_SRCDIR([src/nrpe.c])
+AC_CONFIG_AUX_DIR([build-aux])
+AC_PREFIX_DEFAULT(/usr/local/nagios)
+
+PKG_NAME=nrpe
+PKG_VERSION="3.2.1"
+PKG_HOME_URL="http://www.nagios.org/"
+PKG_REL_DATE="2017-09-01"
+RPM_RELEASE=1
+
+LANG=C
+LC_ALL=C
+LC_COLLATE=C
+LC_CTYPE=C
+LC_MESSAGES=C
+LC_MONETARY=C
+LC_NUMERIC=C
+LC_TIME=C
+
+AC_SUBST(PKG_NAME)
+AC_SUBST(PKG_VERSION)
+AC_SUBST(PKG_HOME_URL)
+AC_SUBST(PKG_REL_DATE)
+AC_SUBST(RPM_RELEASE)
+AC_SUBST(INSTALL)
+AC_SUBST(SNPRINTF_O)
+AC_SUBST(LDFLAGS)
+AC_SUBST(OTHERLIBS)
+AC_SUBST(SOCKETLIBS)
+AC_SUBST(LIBWRAPLIBS)
+AC_SUBST(NRPE_INSTALL_OPTS)
+AC_SUBST(log_facility)
+AC_SUBST(nrpe_user)
+AC_SUBST(nrpe_group)
+AC_SUBST(nrpe_port)
+AC_SUBST(nagios_user)
+AC_SUBST(nagios_group)
+AC_SUBST(NAGIOS_INSTALL_OPTS)
+AC_SUBST(TARGET_VER)
+AC_SUBST(TARGET_OS)
+AC_SUBST(TARGET_ARCH)
+AC_SUBST(TARGET_PLATFORM)
+
+dnl Figure out how to invoke "install" and what install options to use.
+AC_PROG_INSTALL
+
+dnl Get O/S, Distribution, init, inetd, system-specific directories
+AC_NAGIOS_GET_OS
+AC_NAGIOS_GET_DISTRIB_TYPE
+AC_NAGIOS_GET_INIT
+AC_NAGIOS_GET_INETD
+AC_NAGIOS_GET_PATHS
+AC_NAGIOS_GET_FILES
+
+if test "$dist_type" = solaris -a "$dist_ver" = 10; then
+ AC_DEFINE(SOLARIS_10,yes)
+fi
+
+dnl Do they just want to see where things will go?
+if test x${showdirs_only} = xyes; then
+ AC_CONFIG_FILES([paths])
+ AC_OUTPUT()
+ chmod 755 paths
+ ./paths
+ exit 0
+fi
+
+AC_CONFIG_HEADERS([include/config.h])
+AC_CONFIG_FILES([Makefile
+ src/Makefile
+ nrpe.spec
+ uninstall
+ sample-config/nrpe.cfg
+ startup/bsd-init
+ startup/debian-init
+ startup/default-init
+ startup/default-inetd
+ startup/default-service
+ startup/default-socket
+ startup/default-socket-svc
+ startup/default-xinetd
+ startup/mac-init.plist
+ startup/mac-inetd.plist
+ startup/newbsd-init
+ startup/openbsd-init
+ startup/openrc-conf
+ startup/openrc-init
+ startup/solaris-init.xml
+ startup/solaris-inetd.xml
+ startup/tmpfile.conf
+ startup/upstart-init
+ startup/rh-upstart-init
+ include/common.h
+])
+
+dnl Checks for programs.
+AC_PROG_CC
+AC_PROG_MAKE_SET
+
+dnl Checks for header files.
+AC_HEADER_STDC
+AC_HEADER_TIME
+AC_HEADER_SYS_WAIT
+AC_CHECK_HEADERS(ctype.h dirent.h errno.h fcntl.h getopt.h grp.h inttypes.h)
+AC_CHECK_HEADERS(netdb.h pwd.h signal.h stdint.h strings.h string.h syslog.h)
+AC_CHECK_HEADERS(tcpd.h unistd.h arpa/inet.h netinet/in.h socket.h sys/types.h)
+AC_CHECK_HEADERS(sys/time.h sys/resource.h sys/wait.h sys/socket.h sys/stat.h)
+AC_CHECK_HEADERS(paths.h)
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_STRUCT_TM
+AC_TYPE_MODE_T
+AC_TYPE_PID_T
+AC_TYPE_SIZE_T
+AC_TYPE_SIGNAL
+AC_TYPE_GETGROUPS
+
+dnl Check lengths for later tests of u_int32_t and int32_t
+AC_CHECK_SIZEOF(int)
+AC_CHECK_SIZEOF(short)
+AC_CHECK_SIZEOF(long)
+
+dnl Define u_int32_t if we don't have it already (Solaris, etc.)
+AC_CHECK_TYPE(uint32_t,unsigned int)
+AC_CHECK_TYPE(u_int32_t,unsigned int)
+if test "$ac_cv_type_u_int32_t" = no ; then
+ if test "$ac_cv_type_u_int32_t" = yes ; then
+ AC_DEFINE(U_INT32_T_IS_UINT32_T,[1],[u_int32_t is uint32_t])
+ else
+ if test "$ac_cv_sizeof_int" = 4 ; then
+ AC_DEFINE(U_INT32_T_IS_UINT,[1],[u_int32_t is uint])
+ else
+ if test "$ac_cv_sizeof_long" = 4 ; then
+ AC_DEFINE(U_INT32_T_IS_ULONG,[1],[u_int32_t is ulong])
+ else
+ if test "$ac_cv_sizeof_short" = 4 ; then
+ AC_DEFINE(U_INT32_T_IS_USHORT,[1],[u_int32_t is ushort])
+ fi
+ fi
+ fi
+ fi
+fi
+
+dnl Define int32_t if we don't have it already
+AC_CHECK_TYPE(int32_t,int)
+if test "$ac_cv_type_int32_t" = no ; then
+ if test "$ac_cv_sizeof_int" = 4 ; then
+ AC_DEFINE(INT32_T_IS_UINT,[1],[int32_t is uint])
+ else
+ if test "$ac_cv_sizeof_long" = 4 ; then
+ AC_DEFINE(INT32_T_IS_ULONG,[1],[int32_t is ulong])
+ else
+ if test "$ac_cv_sizeof_short" = 4 ; then
+ AC_DEFINE(INT32_T_IS_USHORT,[1],[int32_t is ushort])
+ fi
+ fi
+ fi
+fi
+
+dnl Check for struct sockaddr_storate
+AC_CHECK_TYPES([struct sockaddr_storage],[],[],[#include <sys/socket.h>])
+
+dnl Should we use seteuid() or setresuid()?
+AC_CHECK_FUNC(seteuid,
+ AC_DEFINE(SETEUID(id),[seteuid(id)]),
+ AC_DEFINE(SETEUID(id),[setresuid((uid_t) -1, id, (uid_t) -1)])
+)
+
+dnl Check for asprintf() and friends...
+AC_CACHE_CHECK([for va_copy],ac_cv_HAVE_VA_COPY,[
+AC_TRY_LINK([#include <stdarg.h>
+va_list ap1,ap2;], [va_copy(ap1,ap2);],
+ac_cv_HAVE_VA_COPY=yes,
+ac_cv_HAVE_VA_COPY=no)])
+if test x"$ac_cv_HAVE_VA_COPY" = x"yes"; then
+ AC_DEFINE(HAVE_VA_COPY,1,[Whether va_copy() is available])
+else
+ AC_CACHE_CHECK([for __va_copy],ac_cv_HAVE___VA_COPY,[
+ AC_TRY_LINK([#include <stdarg.h>
+ va_list ap1,ap2;], [__va_copy(ap1,ap2);],
+ ac_cv_HAVE___VA_COPY=yes,
+ ac_cv_HAVE___VA_COPY=no)])
+ if test x"$ac_cv_HAVE___VA_COPY" = x"yes"; then
+ AC_DEFINE(HAVE___VA_COPY,1,[Whether __va_copy() is available])
+ fi
+fi
+
+AC_CHECK_FUNC(vsnprintf,,SNPRINTF_O=./snprintf.o)
+AC_CHECK_FUNC(snprintf,,SNPRINTF_O=./snprintf.o)
+AC_CHECK_FUNC(asprintf,,SNPRINTF_O=./snprintf.o)
+AC_CHECK_FUNC(vasprintf,,SNPRINTF_O=./snprintf.o)
+
+AC_CACHE_CHECK([for C99 vsnprintf],ac_cv_HAVE_C99_VSNPRINTF,[
+AC_TRY_RUN([
+#include <sys/types.h>
+#include <stdarg.h>
+void foo(const char *format, ...) {
+ va_list ap;
+ int len;
+ char buf[5];
+
+ va_start(ap, format);
+ len = vsnprintf(buf, 0, format, ap);
+ va_end(ap);
+ if (len != 5) exit(1);
+
+ va_start(ap, format);
+ len = vsnprintf(0, 0, format, ap);
+ va_end(ap);
+ if (len != 5) exit(1);
+
+ if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
+
+ exit(0);
+}
+main() { foo("hello"); }
+],
+ac_cv_HAVE_C99_VSNPRINTF=yes,ac_cv_HAVE_C99_VSNPRINTF=no,ac_cv_HAVE_C99_VSNPRINTF=cross)])
+if test x"$ac_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
+ AC_DEFINE(HAVE_C99_VSNPRINTF,1,[Define if system has C99 compatible vsnprintf])
+fi
+
+dnl AC_CHECK_FUNC(snprintf,AC_DEFINE(HAVE_SNPRINTF),SNPRINTF_O=./snprintf.o)
+
+dnl Check for getopt_long (Solaris)
+AC_CHECK_FUNCS([getopt_long],,AC_CHECK_LIB([iberty],[getopt_long],OTHERLIBS="$OTHERLIBS -liberty"))
+
+dnl Checks for library functions.
+AC_CHECK_LIB(nsl,main,SOCKETLIBS="$SOCKETLIBS -lnsl")
+AC_CHECK_LIB(socket,socket,SOCKETLIBS="$SOCKETLIBS -lsocket")
+AC_CHECK_LIB(wrap,main,[
+ LIBWRAPLIBS="$LIBWRAPLIBS -lwrap"
+ AC_DEFINE(HAVE_LIBWRAP,[1],[Have the TCP wrappers library])
+ AC_TRY_LINK([#include <tcpd.h>
+ ],[int a = rfc931_timeout;],AC_DEFINE(HAVE_RFC931_TIMEOUT))
+ ])
+AC_CHECK_FUNCS(strdup strstr strtoul strtok_r initgroups closesocket sigaction scandir)
+
+dnl socklen_t check - from curl
+AC_CHECK_TYPE([socklen_t], ,[
+ AC_MSG_CHECKING([for socklen_t equivalent])
+ AC_CACHE_VAL([curl_cv_socklen_t_equiv],
+ [
+ # Systems have either "struct sockaddr *" or
+ # "void *" as the second argument to getpeername
+ curl_cv_socklen_t_equiv=
+ for arg2 in "struct sockaddr" void; do
+ for t in int size_t unsigned long "unsigned long"; do
+ AC_TRY_COMPILE([
+ #ifdef HAVE_SYS_TYPES_H
+ #include <sys/types.h>
+ #endif
+ #ifdef HAVE_SYS_SOCKET_H
+ #include <sys/socket.h>
+ #endif
+
+ int getpeername (int, $arg2 *, $t *);
+ ],[
+ $t len;
+ getpeername(0,0,&len);
+ ],[
+ curl_cv_socklen_t_equiv="$t"
+ break
+ ])
+ done
+ done
+
+ if test "x$curl_cv_socklen_t_equiv" = x; then
+ AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
+ fi
+ ])
+ AC_MSG_RESULT($curl_cv_socklen_t_equiv)
+ AC_DEFINE_UNQUOTED(socklen_t, $curl_cv_socklen_t_equiv,
+ [type to use in place of socklen_t if not defined])],
+ [#include <sys/types.h>
+#include <sys/socket.h>])
+
+
+AC_MSG_CHECKING(for type of socket size)
+AC_TRY_COMPILE([#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+],
+[int a = send(1, (const void *)0, (size_t *) 0, (int *) 0);],
+[AC_DEFINE(SOCKET_SIZE_TYPE, size_t, [Socket Size Type]) AC_MSG_RESULT(size_t)],
+[AC_DEFINE(SOCKET_SIZE_TYPE, int, [Socket Size Type]) AC_MSG_RESULT(int)])
+
+dnl Does user want to check for SSL?
+AC_ARG_ENABLE([ssl],
+ AS_HELP_STRING([--disable-ssl],[disables native SSL support @<:@default=check@:>@]),[
+ if test x$enableval = xyes; then
+ check_for_ssl=yes
+ else
+ check_for_ssl=no
+ fi
+ ],check_for_ssl=yes)
+
+need_dh=yes
+AC_ARG_WITH([need_dh],
+ AS_HELP_STRING([--with-need-dh],[set to 'no' to not include Diffie-Hellman SSL logic]),
+ [need_dh=$withval],
+ [nrpe_group=need_dh])
+
+dnl Optional SSL library and include paths
+if test x$check_for_ssl = xyes; then
+ # need_dh should only be set for NRPE
+ #need_dh=yes
+ AC_NAGIOS_GET_SSL
+fi
+
+AC_ARG_WITH([log_facility],
+ AS_HELP_STRING([--with-log-facility=<facility>],
+ [sets NRPE syslog facility]),
+ [log_facility=$withval],
+ [log_facility=daemon])
+AC_DEFINE_UNQUOTED(NRPE_LOG_FACILITY,["$log_facility"],[NRPE syslog facility])
+
+AC_ARG_WITH([nrpe_user],
+ AS_HELP_STRING([--with-nrpe-user=<user>],[sets user name to run NRPE]),
+ [nrpe_user=$withval],
+ [nrpe_user=nagios])
+
+AC_ARG_WITH([nrpe_group],
+ AS_HELP_STRING([--with-nrpe-group=<group>],[sets group name to run NRPE]),
+ [nrpe_group=$withval],
+ [nrpe_group=nagios])
+
+AC_ARG_WITH([nrpe_port],
+ AS_HELP_STRING([--with-nrpe-port=<port>],
+ [sets port number for NRPE to listen on]),
+ [nrpe_port=$withval],
+ [nrpe_port=5666])
+NRPE_INSTALL_OPTS="-o $nrpe_user -g $nrpe_group"
+AC_DEFINE_UNQUOTED(DEFAULT_SERVER_PORT,$nrpe_port,[Default port for NRPE daemon])
+
+AC_ARG_WITH([nagios_user],
+ AS_HELP_STRING([--with-nagios-user=<user>],
+ [sets user name for file permissions]),
+ [nagios_user=$withval],
+ [nagios_user=nagios])
+AC_ARG_WITH([nagios_group],
+ AS_HELP_STRING([--with-nagios-group=<grp>],
+ [sets group name file permissions]),
+ [nagios_group=$withval],
+ [nagios_group=nagios])
+NAGIOS_INSTALL_OPTS="-o $nagios_user -g $nagios_group"
+
+ dnl On HP-UX the compile will fail with a 'Duplicate symbol "setenv"' error
+ dnl in '/usr/local/lib/libwrap.a(setenv.o)' and '/usr/local/lib/libiberty.a(setenv.o)'
+ dnl so allow duplicate symbols, and use the first one
+ if test "`uname -s`" = "HP-UX" ; then
+ LDFLAGS="$LDFLAGS -Wl,+allowdups";
+ fi
+
+AC_ARG_ENABLE([command-args],
+ AS_HELP_STRING([--enable-command-args],[allows clients to specify command arguments. *** THIS IS A SECURITY RISK! *** Read the SECURITY file before using this option!]),
+ AC_DEFINE_UNQUOTED(ENABLE_COMMAND_ARGUMENTS,[1],[Enable command-line arguments]))
+
+AC_ARG_ENABLE([bash-command-substitution],
+ AS_HELP_STRING([--enable-bash-command-substitution],[allows clients to pass bash command substitutions of the form $(command). *** THIS IS A HIGH SECURITY RISK! *** Read the SECURITY file before using this option!]),
+ AC_DEFINE_UNQUOTED(ENABLE_BASH_COMMAND_SUBSTITUTION,[1],[Enable bash command substitution]))
+
+
+AC_PATH_PROG(PERL,perl)
+AC_OUTPUT()
+
+dnl Review options
+echo ""
+echo ""
+AC_MSG_RESULT([*** Configuration summary for $PKG_NAME $PKG_VERSION $PKG_REL_DATE ***:])
+
+echo "";\
+echo " General Options:";\
+echo " -------------------------"
+
+AC_MSG_RESULT([ NRPE port: $nrpe_port])
+AC_MSG_RESULT([ NRPE user: $nrpe_user])
+AC_MSG_RESULT([ NRPE group: $nrpe_group])
+AC_MSG_RESULT([ Nagios user: $nagios_user])
+AC_MSG_RESULT([ Nagios group: $nagios_group])
+
+
+echo "";\
+echo "";\
+echo "Review the options above for accuracy. If they look okay,";\
+echo "type 'make all' to compile the NRPE daemon and client";\
+echo "or type 'make' to get a list of make options.";\
+echo ""
diff --git a/contrib/README.nrpe_check_control b/contrib/README.nrpe_check_control
new file mode 100644
index 0000000..781b961
--- /dev/null
+++ b/contrib/README.nrpe_check_control
@@ -0,0 +1,64 @@
+NOTES:
+------
+
+The service definition below assumes you have a command called "check_tcp" already setup
+in your config files.
+
+The command definition below assumes that the $USER1$ macro is used to define the location
+of your Nagios plugins (i.e. "/usr/local/nagios/libexec") and that the nrpe_check_control
+service is located in that directory.
+
+
+
+SAMPLE CONFIG FILE SNIPPETS:
+----------------------------
+
+define service {
+ host_name <host name goes here>
+ description NRPE
+ ...
+ event_handler nrpe_check_control
+ check_command check_tcp!-p 5666
+ }
+
+define command {
+ command_name nrpe_check_control
+ command_line $USER1$/nrpe_check_control $SERVICESTATE$ $SERVICESTATETYPE$ $SERVICEATTEMPT$ "$HOSTNAME$"
+ }
+
+
+
+
+ORIGINAL EMAIL SNIPPET:
+-----------------------
+
+Date sent: Fri, 30 Mar 2001 18:51:48 -0500
+From: adam.bowen@<>
+Subject: Event Handler
+To: [nagios@nagios.org]
+
+I am attaching the source code for an event handler I wrote to
+control checks using nrpe. I add the following check to all remote hosts
+using nrpe:
+
+<see example above>
+
+I added this line to the commands.cfg file:
+
+<see example above>
+
+When the NRPE service check listed above has 3 failed connection
+attempts, it will run the nrpe_check_control which will search the
+services file for all services for $HOSTNAME$ that use the check_nrpe.
+
+It will then request that all these services be disabled. When the
+NRPE check returns to the OK state, it will request that all services
+using check_nrpe be re-enabled. This will prevent unnecessary e-mail
+when there is a problem with the NRPE daemon. This does require
+that external commands be enabled.
+
+(See attached file: nrpe_check_control.c)
+
+I thought some other [Nagios] users might find this useful.
+
+Adam G. Bowen
diff --git a/contrib/nrpe_check_control.c b/contrib/nrpe_check_control.c
new file mode 100644
index 0000000..04fa9e0
--- /dev/null
+++ b/contrib/nrpe_check_control.c
@@ -0,0 +1,121 @@
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+
+#define MAX_CHARS 1024
+#define SERVICE_COUNT 12
+
+#define COMMAND_FILE "/usr/local/nagios/var/rw/nagios.cmd"
+#define SERVICES_FILE "/usr/local/nagios/etc/services.cfg"
+
+int main(int argc, char *argv[])
+{
+ char check_name[MAX_CHARS];
+ char ent_type[MAX_CHARS];
+ char input_buffer[MAX_CHARS];
+ char host_name[MAX_CHARS];
+ char service_name[MAX_CHARS];
+ char state[MAX_CHARS];
+ char state_type[MAX_CHARS];
+ char temp_input[MAX_CHARS];
+ char temp_string[MAX_CHARS];
+ char test_host[MAX_CHARS];
+
+ char *temp_var;
+
+ FILE *command_fp;
+ FILE *services_fp;
+
+ int attempt;
+ int i;
+
+ time_t current_time;
+
+ strcpy(state,argv[1]);
+ strcpy(state_type,argv[2]);
+ attempt=atoi(argv[3]);
+ strcpy(host_name,argv[4]);
+
+ if(strcmp(state,"OK") == 0)
+ {
+ services_fp=fopen(SERVICES_FILE,"r");
+ command_fp=fopen(COMMAND_FILE,"a");
+ while((fgets(input_buffer,MAX_CHARS-1,services_fp)) != NULL)
+ {
+ if(input_buffer[0]=='#' || input_buffer[0]=='\x0' || input_buffer[0]=='\n' || input_buffer[0]=='\r')
+ {
+ continue;
+ }
+ else
+ {
+ strcpy(temp_input,input_buffer);
+ strcpy(temp_string,strtok(temp_input,"="));
+ strcpy(ent_type,strtok(temp_string,"["));
+ if(strcmp(ent_type,"service") == 0)
+ {
+ strcpy(test_host,strtok(NULL,"]"));
+ if(strcmp(test_host,host_name) == 0)
+ {
+ temp_var=strtok(input_buffer,"=");
+ strcpy(service_name,strtok(NULL,";"));
+ for(i=1;i<=SERVICE_COUNT;i++)
+ {
+ temp_var=strtok(NULL,";");
+ }
+ strcpy(check_name,strtok(temp_var,"!"));
+ if(strcmp(check_name,"check_nrpe") == 0)
+ {
+ time(&current_time);
+ fprintf(command_fp,"[%lu] ENABLE_SVC_CHECK;%s;%s\n",current_time,host_name,service_name);
+ }
+ }
+ }
+ }
+ }
+ fclose(command_fp);
+ fclose(services_fp);
+ }
+ else if(strcmp(state,"CRITICAL") == 0)
+ {
+ if(attempt == 3)
+ {
+ services_fp=fopen(SERVICES_FILE,"r");
+ command_fp=fopen(COMMAND_FILE,"a");
+ while((fgets(input_buffer,MAX_CHARS-1,services_fp)) != NULL)
+ {
+ if(input_buffer[0]=='#' || input_buffer[0]=='\x0' || input_buffer[0]=='\n' || input_buffer[0]=='\r')
+ {
+ continue;
+ }
+ else
+ {
+ strcpy(temp_input,input_buffer);
+ strcpy(temp_string,strtok(temp_input,"="));
+ strcpy(ent_type,strtok(temp_string,"["));
+ if(strcmp(ent_type,"service") == 0)
+ {
+ strcpy(test_host,strtok(NULL,"]"));
+ if(strcmp(test_host,host_name) == 0)
+ {
+ temp_var=strtok(input_buffer,"=");
+ strcpy(service_name,strtok(NULL,";"));
+ for(i=1;i<=SERVICE_COUNT;i++)
+ {
+ temp_var=strtok(NULL,";");
+ }
+ strcpy(check_name,strtok(temp_var,"!"));
+ if(strcmp(check_name,"check_nrpe") == 0)
+ {
+ time(&current_time);
+ fprintf(command_fp,"[%lu] DISABLE_SVC_CHECK;%s;%s\n",current_time,host_name,service_name);
+ }
+ }
+ }
+ }
+ }
+ fclose(command_fp);
+ fclose(services_fp);
+ }
+ }
+ return 0;
+}
diff --git a/docs/NRPE.odt b/docs/NRPE.odt
new file mode 100644
index 0000000..f5b906f
--- /dev/null
+++ b/docs/NRPE.odt
Binary files differ
diff --git a/docs/NRPE.pdf b/docs/NRPE.pdf
new file mode 100644
index 0000000..543daef
--- /dev/null
+++ b/docs/NRPE.pdf
Binary files differ
diff --git a/include/acl.h b/include/acl.h
new file mode 100644
index 0000000..9a661f6
--- /dev/null
+++ b/include/acl.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+ *
+ * acl.h - header file for acl.c
+ *
+ * License: GPLv2
+ * Copyright (c) 2011 Kaspersky Lab ZAO
+ *
+ * License Notice:
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ ****************************************************************************/
+
+#ifndef ACL_H_INCLUDED
+#define ACL_H_INCLUDED 1
+
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <netdb.h>
+#include <syslog.h>
+#include <stdarg.h>
+
+#define CHAR_TO_NUMBER(c) ((c) - '0')
+
+struct ip_acl {
+ int family;
+ struct in_addr addr;
+ struct in_addr mask;
+ struct in6_addr addr6;
+ struct in6_addr mask6;
+ struct ip_acl *next;
+};
+
+struct dns_acl {
+ char domain[255];
+ struct dns_acl *next;
+};
+
+/* Pointers to head ACL structs */
+static struct ip_acl *ip_acl_head, *ip_acl_prev;
+static struct dns_acl *dns_acl_head, *dns_acl_prev;
+
+/* Functions */
+void parse_allowed_hosts(char *allowed_hosts);
+int add_ipv4_to_acl(char *ipv4);
+int add_ipv6_to_acl(char *ipv6);
+int add_domain_to_acl(char *domain);
+//int is_an_allowed_host(struct in_addr);
+int is_an_allowed_host(int, void *);
+unsigned int prefix_from_mask(struct in_addr mask);
+void show_acl_lists(void);
+
+#endif /* ACL_H_INCLUDED */
diff --git a/include/common.h.in b/include/common.h.in
new file mode 100644
index 0000000..90f6272
--- /dev/null
+++ b/include/common.h.in
@@ -0,0 +1,106 @@
+/****************************************************************************
+ *
+ * common.h - NRPE Common header file
+ *
+ * License: GPLv2
+ * Copyright (c) 2006-2017 Nagios Enterprises
+ * 1999-2006 Ethan Galstad (nagios@nagios.org)
+ *
+ * License Notice:
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ ****************************************************************************/
+
+#include "config.h"
+
+#define SSL_TYPE_@SSL_TYPE@
+
+#ifdef HAVE_SSL
+#include <@SSL_INC_PREFIX@@SSL_HDR@>
+# ifdef SSL_TYPE_openssl
+# include <@SSL_INC_PREFIX@err.h>
+# include <@SSL_INC_PREFIX@rand.h>
+# include <@SSL_INC_PREFIX@engine.h>
+# endif
+#endif
+
+#define PROGRAM_VERSION "3.2.1"
+#define MODIFICATION_DATE "2017-09-01"
+
+#define OK 0
+#define ERROR -1
+
+#define TRUE 1
+#define FALSE 0
+
+#define STATE_UNKNOWN 3 /* service state return codes */
+#define STATE_CRITICAL 2
+#define STATE_WARNING 1
+#define STATE_OK 0
+
+
+#define DEFAULT_SOCKET_TIMEOUT 10 /* timeout after 10 seconds */
+#define DEFAULT_CONNECTION_TIMEOUT 300 /* timeout if daemon is waiting for connection more than this time */
+
+#define MAX_INPUT_BUFFER 2048 /* max size of most buffers we use */
+#define MAX_FILENAME_LENGTH 256
+#define MAX_HOST_ADDRESS_LENGTH 256 /* max size of a host address */
+#define MAX_COMMAND_ARGUMENTS 16
+
+#define NRPE_HELLO_COMMAND "_NRPE_CHECK"
+
+/**************** PACKET STRUCTURE DEFINITION **********/
+
+#define QUERY_PACKET 1 /* id code for a packet containing a query */
+#define RESPONSE_PACKET 2 /* id code for a packet containing a response */
+#define NRPE_PACKET_VERSION_3 3 /* packet version identifier */
+#define NRPE_PACKET_VERSION_2 2
+#define NRPE_PACKET_VERSION_1 1 /* older packet version identifiers (no longer supported) */
+
+#define MAX_PACKETBUFFER_LENGTH 1024 /* amount of data to send in one query/response vor version 2 */
+
+typedef struct _v2_packet {
+ int16_t packet_version;
+ int16_t packet_type;
+ u_int32_t crc32_value;
+ int16_t result_code;
+ char buffer[MAX_PACKETBUFFER_LENGTH];
+} v2_packet;
+typedef struct _v3_packet {
+ int16_t packet_version;
+ int16_t packet_type;
+ u_int32_t crc32_value;
+ int16_t result_code;
+ int16_t alignment;
+ int32_t buffer_length;
+ char buffer[1];
+} v3_packet;
+
+/**************** OPERATING SYSTEM SPECIFIC DEFINITIONS **********/
+#if defined(__sun) || defined(__hpux)
+
+# ifndef LOG_AUTHPRIV
+# define LOG_AUTHPRIV LOG_AUTH
+# endif
+# ifndef LOG_FTP
+# define LOG_FTP LOG_DAEMON
+# endif
+#elif defined(_AIX)
+# include <sys/select.h>
+# ifndef LOG_FTP
+# define LOG_FTP LOG_DAEMON
+# endif
+#endif
diff --git a/include/config.h.in b/include/config.h.in
new file mode 100644
index 0000000..4bedca3
--- /dev/null
+++ b/include/config.h.in
@@ -0,0 +1,354 @@
+/****************************************************************************
+ *
+ * config.h - NRPE Configuration header file
+ *
+ * License: GPLv2
+ * Copyright (c) 2006-2017 Nagios Enterprises
+ * 1999-2006 Ethan Galstad (nagios@nagios.org)
+ *
+ * License Notice:
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ ****************************************************************************/
+
+#ifndef _CONFIG_H
+#define _CONFIG_H
+
+#include <stdio.h>
+#include <stdlib.h>
+
+
+/* Default port for NRPE daemon */
+#undef DEFAULT_SERVER_PORT
+
+/* NRPE syslog facility */
+#undef NRPE_LOG_FACILITY
+
+/* Enable command-line arguments */
+#undef ENABLE_COMMAND_ARGUMENTS
+
+/* Enable bash command substitution */
+#undef ENABLE_BASH_COMMAND_SUBSTITUTION
+
+/* type to use in place of socklen_t if not defined */
+#undef socklen_t
+
+/* Define to 1 if you have the `getopt_long' function. */
+#undef HAVE_GETOPT_LONG
+
+/* Have the TCP wrappers library */
+#undef HAVE_LIBWRAP
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define to 1 if you have the `strdup' function. */
+#undef HAVE_STRDUP
+
+/* Define to 1 if you have the `strstr' function. */
+#undef HAVE_STRSTR
+
+/* Define to 1 if you have the `strtoul' function. */
+#undef HAVE_STRTOUL
+
+/* Define to 1 if you have the `strtok_r' function. */
+#undef HAVE_STRTOK_R
+
+/* Define to 1 if you have the `initgroups' function. */
+#undef HAVE_INITGROUPS
+
+/* Define to 1 if you have the `closesocket' function. */
+#undef HAVE_CLOSESOCKET
+
+/* Define to 1 if you have the `sigaction' function. */
+#undef HAVE_SIGACTION
+
+/* Define to 1 if you have the `scandir' function. */
+#undef HAVE_SCANDIR
+
+/* Set to 1 if you have rfc931_timeout */
+#undef HAVE_RFC931_TIMEOUT
+
+/* The size of `int', as computed by sizeof. */
+#undef SIZEOF_INT
+
+/* The size of `short', as computed by sizeof. */
+#undef SIZEOF_SHORT
+
+/* The size of `long', as computed by sizeof. */
+#undef SIZEOF_LONG
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Set to 1 to use SSL DH */
+#undef USE_SSL_DH
+
+/* stupid stuff for u_int32_t */
+#undef U_INT32_T_IS_USHORT
+#undef U_INT32_T_IS_UINT
+#undef U_INT32_T_IS_ULONG
+#undef U_INT32_T_IS_UINT32_T
+
+#ifdef U_INT32_T_IS_USHORT
+typedef unsigned short u_int32_t;
+#endif
+#ifdef U_INT32_T_IS_ULONG
+typedef unsigned long u_int32_t;
+#endif
+#ifdef U_INT32_T_IS_UINT
+typedef unsigned int u_int32_t;
+#endif
+#ifdef U_INT32_T_IS_UINT32_t
+typedef uint32_t u_int32_t;
+#endif
+
+/* stupid stuff for int32_t */
+#undef INT32_T_IS_SHORT
+#undef INT32_T_IS_INT
+#undef INT32_T_IS_LONG
+
+#ifdef INT32_T_IS_USHORT
+typedef short int32_t;
+#endif
+#ifdef INT32_T_IS_ULONG
+typedef long int32_t;
+#endif
+#ifdef INT32_T_IS_UINT
+typedef int int32_t;
+#endif
+
+
+/***** ASPRINTF() AND FRIENDS *****/
+
+/* Whether vsnprintf() is available */
+#undef HAVE_VSNPRINTF
+/* Whether snprintf() is available */
+#undef HAVE_SNPRINTF
+/* Whether aprintf() is available */
+#undef HAVE_ASPRINTF
+/* Whether vaprintf() is available */
+#undef HAVE_VASPRINTF
+/* Define if system has C99 compatible vsnprintf */
+#undef HAVE_C99_VSNPRINTF
+
+/* Whether va_copy() is available */
+#undef HAVE_VA_COPY
+
+/* Whether __va_copy() is available */
+#undef HAVE___VA_COPY
+
+
+/* Socket Size Type */
+#undef SOCKET_SIZE_TYPE
+
+/* Define to the type of elements in the array set by `getgroups'. Usually
+ this is either `int' or `gid_t'. */
+#undef GETGROUPS_T
+
+/* Define as the return type of signal handlers (`int' or `void'). */
+#undef RETSIGTYPE
+
+/* Define to 1 if the system has the type `struct sockaddr_storage'. */
+#undef HAVE_STRUCT_SOCKADDR_STORAGE
+
+/* Use seteuid() or setresuid() depending on the platform */
+#undef SETEUID
+
+/* Set to 1 if we are on Solaris 10 */
+#undef SOLARIS_10
+
+/* Define to 1 if you have the <getopt.h> header file. */
+#undef HAVE_GETOPT_H
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+/* Define to 1 if you have the <signal.h> header file. */
+#undef HAVE_SIGNAL_H
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
+#endif
+
+/* Define to 1 if you have the <syslog.h> header file. */
+#undef HAVE_SYSLOG_H
+#ifdef HAVE_SYSLOG_H
+#include <syslog.h>
+#endif
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+/* Define to 1 if you have the <sys/wait.h> header file. */
+#undef HAVE_SYS_WAIT_H
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+
+#ifndef WEXITSTATUS
+# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
+#endif
+#ifndef WIFEXITED
+# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
+#endif
+
+/* Define to 1 if you have the <errno.h> header file. */
+#undef HAVE_ERRNO_H
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#undef TIME_WITH_SYS_TIME
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#undef HAVE_SYS_SOCKET_H
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+
+/* Define to 1 if you have the <socket.h> header file. */
+#undef HAVE_SOCKET_H
+#ifdef HAVE_SOCKET_H
+#include <socket.h>
+#endif
+
+/* Define to 1 if you have the <tcpd.h> header file. */
+#undef HAVE_TCPD_H
+#ifdef HAVE_TCPD_H
+#include <tcpd.h>
+#endif
+
+/* Define to 1 if you have the <netinet/in.h> header file. */
+#undef HAVE_NETINET_IN_H
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+/* Define to 1 if you have the <arpa/inet.h> header file. */
+#undef HAVE_ARPA_INET_H
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+/* Define to 1 if you have the <netdb.h> header file. */
+#undef HAVE_NETDB_H
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+
+/* Define to 1 if you have the <ctype.h> header file. */
+#undef HAVE_CTYPE_H
+#ifdef HAVE_CTYPE_H
+#include <ctype.h>
+#endif
+
+/* Define to 1 if you have the <pwd.h> header file. */
+#undef HAVE_PWD_H
+#ifdef HAVE_PWD_H
+#include <pwd.h>
+#endif
+
+/* Define to 1 if you have the <grp.h> header file. */
+#undef HAVE_GRP_H
+#ifdef HAVE_GRP_H
+#include <grp.h>
+#endif
+
+/* Define to 1 if you have the <dirent.h> header file. */
+#undef HAVE_DIRENT_H
+#ifdef HAVE_DIRENT_H
+#include <dirent.h>
+#endif
+
+/* Have SSL support */
+#undef HAVE_SSL
+
+/* Have the krb5.h header file */
+#undef HAVE_KRB5_H
+#ifdef HAVE_KRB5_H
+#include <krb5.h>
+#endif
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#else
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#endif
+
+/* Define to 1 if you have the <paths.h> header file. */
+#undef HAVE_PATHS_H
+
+/* Define to 1 if you have the <sys/resource.h> header file. */
+#undef HAVE_SYS_RESOURCE_H
+
+#endif
diff --git a/include/nrpe.h b/include/nrpe.h
new file mode 100644
index 0000000..dc00c64
--- /dev/null
+++ b/include/nrpe.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+ *
+ * nrpe.h - Nagios Remote Plugin Executor header file
+ *
+ * License: GPLv2
+ * Copyright (c) 2006-2017 Nagios Enterprises
+ * 1999-2006 Ethan Galstad (nagios@nagios.org)
+ *
+ * License Notice:
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ ****************************************************************************/
+
+typedef struct command_struct {
+ char *command_name;
+ char *command_line;
+ struct command_struct *next;
+} command;
+
+int init(void);
+void init_ssl(void);
+void log_ssl_startup(void);
+void usage(int);
+void run_inetd(void);
+void run_src(void);
+void run_daemon(void);
+void set_stdio_sigs(void);
+void cleanup(void);
+int read_config_file(char *);
+int read_config_dir(char *);
+int get_log_facility(char *);
+int add_command(char *,char *);
+command *find_command(char *);
+void create_listener(struct addrinfo *ai);
+void wait_for_connections(void);
+void setup_wait_conn(void);
+int wait_conn_fork(int sock);
+void conn_check_peer(int sock);
+void handle_connection(int);
+void init_handle_conn(void);
+int handle_conn_ssl(int sock, void *ssl_ptr);
+int read_packet(int sock, void *ssl_ptr, v2_packet *v2_pkt, v3_packet **v3_pkt);
+void free_memory(void);
+int my_system(char*, int, int*, char**); /* executes a command via popen(), but also protects against timeouts */
+void my_system_sighandler(int); /* handles timeouts when executing commands via my_system() */
+void my_connection_sighandler(int); /* handles timeouts of connection */
+int drop_privileges(char *,char *, int);
+int write_pid_file(void);
+int remove_pid_file(void);
+int check_privileges(void);
+void sighandler(int);
+void child_sighandler(int);
+int validate_request(v2_packet *, v3_packet *);
+int contains_nasty_metachars(char *);
+int process_macros(char *,char *,int);
+int process_arguments(int,char **);
diff --git a/include/utils.h b/include/utils.h
new file mode 100644
index 0000000..75ebc0b
--- /dev/null
+++ b/include/utils.h
@@ -0,0 +1,53 @@
+/****************************************************************************
+ *
+ * utils.h - NRPE Utility Functions header file
+ *
+ * License: GPLv2
+ * Copyright (c) 2009-2017 Nagios Enterprises
+ * 1999-2008 Ethan Galstad (nagios@nagios.org)
+ *
+ * License Notice:
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ ****************************************************************************/
+
+
+#ifndef NRPE_UTILS_H_INCLUDED
+#define NRPE_UTILS_H_INCLUDED
+
+#include "../include/config.h"
+
+void generate_crc32_table(void);
+unsigned long calculate_crc32(char*, int);
+void randomize_buffer(char*,int);
+int my_tcp_connect(char*, int, int*);
+#ifdef HAVE_STRUCT_SOCKADDR_STORAGE
+int my_connect(const char*, struct sockaddr_storage*, u_short, int, const char*, int);
+#else
+int my_connect(const char*, struct sockaddr*, u_short, int, const char*, int);
+#endif
+void add_listen_addr(struct addrinfo**, int, char*, int);
+int clean_environ(const char *keep_env_vars, const char *nrpe_user);
+char* strip(char*);
+int sendall(int, char*, int*);
+int recvall(int, char*, int*, int);
+char *my_strsep(char**, const char*);
+void open_log_file();
+void logit(int priority, const char *format, ...);
+void close_log_file();
+void display_license(void);
+
+#endif
diff --git a/macros/.gitignore b/macros/.gitignore
new file mode 100644
index 0000000..80f408e
--- /dev/null
+++ b/macros/.gitignore
@@ -0,0 +1 @@
+nbproject/
diff --git a/macros/CHANGELOG.md b/macros/CHANGELOG.md
new file mode 100644
index 0000000..f71288f
--- /dev/null
+++ b/macros/CHANGELOG.md
@@ -0,0 +1,7 @@
+1.0.1
+-----
+ * Fix bug determining inetd,xinetd if neither are running (Bryan Heden)
+
+1.0.0
+-----
+ * Initial Release (John Frickson) \ No newline at end of file
diff --git a/macros/LICENSE b/macros/LICENSE
new file mode 100644
index 0000000..a983462
--- /dev/null
+++ b/macros/LICENSE
@@ -0,0 +1,264 @@
+The GNU General Public License, Version 2, June 1991 (GPLv2)
+============================================================
+
+> Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+> 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+Everyone is permitted to copy and distribute verbatim copies of this license
+document, but changing it is not allowed.
+
+
+Preamble
+--------
+
+The licenses for most software are designed to take away your freedom to share
+and change it. By contrast, the GNU General Public License is intended to
+guarantee your freedom to share and change free software--to make sure the
+software is free for all its users. This General Public License applies to most
+of the Free Software Foundation's software and to any other program whose
+authors commit to using it. (Some other Free Software Foundation software is
+covered by the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+When we speak of free software, we are referring to freedom, not price. Our
+General Public Licenses are designed to make sure that you have the freedom to
+distribute copies of free software (and charge for this service if you wish),
+that you receive source code or can get it if you want it, that you can change
+the software or use pieces of it in new free programs; and that you know you can
+do these things.
+
+To protect your rights, we need to make restrictions that forbid anyone to deny
+you these rights or to ask you to surrender the rights. These restrictions
+translate to certain responsibilities for you if you distribute copies of the
+software, or if you modify it.
+
+For example, if you distribute copies of such a program, whether gratis or for a
+fee, you must give the recipients all the rights that you have. You must make
+sure that they, too, receive or can get the source code. And you must show them
+these terms so they know their rights.
+
+We protect your rights with two steps: (1) copyright the software, and (2) offer
+you this license which gives you legal permission to copy, distribute and/or
+modify the software.
+
+Also, for each author's protection and ours, we want to make certain that
+everyone understands that there is no warranty for this free software. If the
+software is modified by someone else and passed on, we want its recipients to
+know that what they have is not the original, so that any problems introduced by
+others will not reflect on the original authors' reputations.
+
+Finally, any free program is threatened constantly by software patents. We wish
+to avoid the danger that redistributors of a free program will individually
+obtain patent licenses, in effect making the program proprietary. To prevent
+this, we have made it clear that any patent must be licensed for everyone's free
+use or not licensed at all.
+
+The precise terms and conditions for copying, distribution and modification
+follow.
+
+
+Terms And Conditions For Copying, Distribution And Modification
+---------------------------------------------------------------
+
+**0.** This License applies to any program or other work which contains a notice
+placed by the copyright holder saying it may be distributed under the terms of
+this General Public License. The "Program", below, refers to any such program or
+work, and a "work based on the Program" means either the Program or any
+derivative work under copyright law: that is to say, a work containing the
+Program or a portion of it, either verbatim or with modifications and/or
+translated into another language. (Hereinafter, translation is included without
+limitation in the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not covered by
+this License; they are outside its scope. The act of running the Program is not
+restricted, and the output from the Program is covered only if its contents
+constitute a work based on the Program (independent of having been made by
+running the Program). Whether that is true depends on what the Program does.
+
+**1.** You may copy and distribute verbatim copies of the Program's source code
+as you receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice and
+disclaimer of warranty; keep intact all the notices that refer to this License
+and to the absence of any warranty; and give any other recipients of the Program
+a copy of this License along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and you may at
+your option offer warranty protection in exchange for a fee.
+
+**2.** You may modify your copy or copies of the Program or any portion of it,
+thus forming a work based on the Program, and copy and distribute such
+modifications or work under the terms of Section 1 above, provided that you also
+meet all of these conditions:
+
+* **a)** You must cause the modified files to carry prominent notices stating
+ that you changed the files and the date of any change.
+
+* **b)** You must cause any work that you distribute or publish, that in whole
+ or in part contains or is derived from the Program or any part thereof, to
+ be licensed as a whole at no charge to all third parties under the terms of
+ this License.
+
+* **c)** If the modified program normally reads commands interactively when
+ run, you must cause it, when started running for such interactive use in the
+ most ordinary way, to print or display an announcement including an
+ appropriate copyright notice and a notice that there is no warranty (or
+ else, saying that you provide a warranty) and that users may redistribute
+ the program under these conditions, and telling the user how to view a copy
+ of this License. (Exception: if the Program itself is interactive but does
+ not normally print such an announcement, your work based on the Program is
+ not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If identifiable
+sections of that work are not derived from the Program, and can be reasonably
+considered independent and separate works in themselves, then this License, and
+its terms, do not apply to those sections when you distribute them as separate
+works. But when you distribute the same sections as part of a whole which is a
+work based on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the entire whole,
+and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest your
+rights to work written entirely by you; rather, the intent is to exercise the
+right to control the distribution of derivative or collective works based on the
+Program.
+
+In addition, mere aggregation of another work not based on the Program with the
+Program (or with a work based on the Program) on a volume of a storage or
+distribution medium does not bring the other work under the scope of this
+License.
+
+**3.** You may copy and distribute the Program (or a work based on it, under
+Section 2) in object code or executable form under the terms of Sections 1 and 2
+above provided that you also do one of the following:
+
+* **a)** Accompany it with the complete corresponding machine-readable source
+ code, which must be distributed under the terms of Sections 1 and 2 above on
+ a medium customarily used for software interchange; or,
+
+* **b)** Accompany it with a written offer, valid for at least three years, to
+ give any third party, for a charge no more than your cost of physically
+ performing source distribution, a complete machine-readable copy of the
+ corresponding source code, to be distributed under the terms of Sections 1
+ and 2 above on a medium customarily used for software interchange; or,
+
+* **c)** Accompany it with the information you received as to the offer to
+ distribute corresponding source code. (This alternative is allowed only for
+ noncommercial distribution and only if you received the program in object
+ code or executable form with such an offer, in accord with Subsection b
+ above.)
+
+The source code for a work means the preferred form of the work for making
+modifications to it. For an executable work, complete source code means all the
+source code for all modules it contains, plus any associated interface
+definition files, plus the scripts used to control compilation and installation
+of the executable. However, as a special exception, the source code distributed
+need not include anything that is normally distributed (in either source or
+binary form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component itself
+accompanies the executable.
+
+If distribution of executable or object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the source code
+from the same place counts as distribution of the source code, even though third
+parties are not compelled to copy the source along with the object code.
+
+**4.** You may not copy, modify, sublicense, or distribute the Program except as
+expressly provided under this License. Any attempt otherwise to copy, modify,
+sublicense or distribute the Program is void, and will automatically terminate
+your rights under this License. However, parties who have received copies, or
+rights, from you under this License will not have their licenses terminated so
+long as such parties remain in full compliance.
+
+**5.** You are not required to accept this License, since you have not signed
+it. However, nothing else grants you permission to modify or distribute the
+Program or its derivative works. These actions are prohibited by law if you do
+not accept this License. Therefore, by modifying or distributing the Program (or
+any work based on the Program), you indicate your acceptance of this License to
+do so, and all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+**6.** Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the original
+licensor to copy, distribute or modify the Program subject to these terms and
+conditions. You may not impose any further restrictions on the recipients'
+exercise of the rights granted herein. You are not responsible for enforcing
+compliance by third parties to this License.
+
+**7.** If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues), conditions
+are imposed on you (whether by court order, agreement or otherwise) that
+contradict the conditions of this License, they do not excuse you from the
+conditions of this License. If you cannot distribute so as to satisfy
+simultaneously your obligations under this License and any other pertinent
+obligations, then as a consequence you may not distribute the Program at all.
+For example, if a patent license would not permit royalty-free redistribution of
+the Program by all those who receive copies directly or indirectly through you,
+then the only way you could satisfy both it and this License would be to refrain
+entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply and the
+section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any patents or
+other property right claims or to contest validity of any such claims; this
+section has the sole purpose of protecting the integrity of the free software
+distribution system, which is implemented by public license practices. Many
+people have made generous contributions to the wide range of software
+distributed through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing to
+distribute software through any other system and a licensee cannot impose that
+choice.
+
+This section is intended to make thoroughly clear what is believed to be a
+consequence of the rest of this License.
+
+**8.** If the distribution and/or use of the Program is restricted in certain
+countries either by patents or by copyrighted interfaces, the original copyright
+holder who places the Program under this License may add an explicit
+geographical distribution limitation excluding those countries, so that
+distribution is permitted only in or among countries not thus excluded. In such
+case, this License incorporates the limitation as if written in the body of this
+License.
+
+**9.** The Free Software Foundation may publish revised and/or new versions of
+the General Public License from time to time. Such new versions will be similar
+in spirit to the present version, but may differ in detail to address new
+problems or concerns.
+
+Each version is given a distinguishing version number. If the Program specifies
+a version number of this License which applies to it and "any later version",
+you have the option of following the terms and conditions either of that version
+or of any later version published by the Free Software Foundation. If the
+Program does not specify a version number of this License, you may choose any
+version ever published by the Free Software Foundation.
+
+**10.** If you wish to incorporate parts of the Program into other free programs
+whose distribution conditions are different, write to the author to ask for
+permission. For software which is copyrighted by the Free Software Foundation,
+write to the Free Software Foundation; we sometimes make exceptions for this.
+Our decision will be guided by the two goals of preserving the free status of
+all derivatives of our free software and of promoting the sharing and reuse of
+software generally.
+
+
+No Warranty
+-----------
+
+**11.** BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
+THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE
+STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM
+"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+**12.** IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
+INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
+BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER
+OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. \ No newline at end of file
diff --git a/macros/LICENSE.md b/macros/LICENSE.md
new file mode 120000
index 0000000..7a694c9
--- /dev/null
+++ b/macros/LICENSE.md
@@ -0,0 +1 @@
+LICENSE \ No newline at end of file
diff --git a/macros/README.md b/macros/README.md
new file mode 100644
index 0000000..608b2ec
--- /dev/null
+++ b/macros/README.md
@@ -0,0 +1,199 @@
+autoconf-macros
+===============
+
+The purpose of Nagios autoconf-macros is to have a central place for
+autoconf macros that can be maintained in one place, but be used by any
+of the Nagios software. It is intended to be used as a git subtree.
+See the [Usage](#usage) and [References](#references) sections below.
+
+Since this project will be included in several parent projects, any
+changes must be as project-neutral as possible.
+
+Make sure to check out the [CHANGELOG](CHANGELOG.md) for relevant
+information, as well.
+
+
+Contents
+--------
+
+The collection consists of the following macros:
+
+### AX_NAGIOS_GET_OS alias AC_NAGIOS_GET_OS
+
+> Output Variable : `opsys`
+
+This macro detects the operating system, and transforms it into a generic
+label. The most common OS's that use Nagios software are recognized and
+used in subsequent macros.
+
+### AX_NAGIOS_GET_DISTRIB_TYPE alias AC_NAGIOS_GET_DISTRIB_TYPE
+
+> Output Variables : `dist_type`, `dist_ver`
+
+This macro detects the distribution type. For Linux, this would be rh
+(for Red Hat and derivitives), suse (OpenSUSE, SLES, derivitives), gentoo
+(Gentoo and derivitives), debian (Debian and derivitives), and so on.
+For BSD, this would be openbsd, netbsd, freebsd, dragonfly, etc. It can
+also be aix, solaris, osx, and so on for Unix operating systems.
+
+### AX_NAGIOS_GET_INIT alias AC_NAGIOS_GET_INIT
+
+> Output Variable : `init_type`
+
+This macro detects what software is used to start daemons on bootup
+or on request, generally knows as the "init system". The init_type
+will generally be one of sysv (many), bsd (Slackware), newbsd (*BSD),
+launchd (OS X), smf10 or smf11 (Solaris), systemd (newer Linux),
+gentoo (older Gentoo), upstart (several), or unknown.
+
+### AX_NAGIOS_GET_INETD alias AC_NAGIOS_GET_INETD
+
+> Output Variable : `inetd_type`
+
+This macro detects what software is used to start daemons or services
+on demand, which historically has been "inetd". The inetd_type
+will generally be one of inetd, xinetd, launchd (OS X), smf10 or smf11
+(Solaris), systemd (newer Linux), upstart (several), or unknown.
+
+### AX_NAGIOS_GET_PATHS alias AC_NAGIOS_GET_PATHS
+
+> Output Variables : **many!**
+
+This macro determines the installation paths for binaries, config files,
+PID files, and so on. For a "standard" install of Nagios, NRPE, NDO Utils,
+etc., most will be in the /usr/local/nagios hierarchy with startup files
+located in /etc. For distributions or software repositories, the
+"--enable-install-method=os" option can be used. This will determine the
+O/S dependant directories, such as /usr/bin, /usr/sbin, /var/lib/nagios,
+/usr/lib/nagios, etc. or for OS X, /Library/LaunchDaemons.
+
+### AX_NAGIOS_GET_FILES alias AC_NAGIOS_GET_FILES
+
+> Output Variables : `src_init`, `src_inetd`, `src_tmpfile`
+
+Each Nagios project will have a top-level directory named "/startup/".
+In that directory will be "*.in" files for the various "init_type" and
+"inetd_type" systems. This macro will determine which file(s) from
+that directory will be needed.
+
+### AX_NAGIOS_GET_SSL alias AC_NAGIOS_GET_SSL
+
+> Output Variables : `HAVE_KRB5_H`, `HAVE_SSL`, `SSL_INC_DIR`, `SSL_LIB_DIR`, `CFLAGS`, `LDFLAGS`, `LIBS`
+
+This macro checks various directories for SSL libraries and header files.
+The searches are based on known install locations on various operating
+systems and distributions, for openssl, gnutls-openssl, and nss_compat_ossl.
+If it finds the headers and libraries, it will then do an `AC_LINK_IFELSE`
+on a simple program to make sure a compile and link will work correctly.
+
+
+Usage
+-----
+
+This repo is intended to be used as a git subtree, so changes will
+automatically propogate, and still be reasonably easy to use.
+
+* First, Create, checkout, clone, or branch your project. If you do an
+`ls -AF` it might look something like this:
+
+ .git/ .gitignore ChangeLog LICENSE Makefile.in
+ README configure.ac include/ src/
+
+* Then make a reference to _this_ project inside your project.
+
+ git remote add autoconf-macros git@github.com:NagiosEnterprises/autoconf-macros
+ git subtree add --prefix=macros/ autoconf-macros master
+
+* After executing the above two commands, if you do an `ls -AF` now,
+it should look like this:
+
+ .git/ .gitignore ChangeLog LICENSE Makefile.in
+ README configure.ac include/ macros/ src/
+
+* The `macros/` directory has been added.
+
+* Now do a `git push` to save everything.
+
+* If you make any changes to autoconf-macros, commit them separately
+from any parent-project changes to keep from polluting the commit
+history with unrelated comments.
+
+* To submit your changes to autoconf-macros:
+
+ git subtree push --prefix=macros autoconf-macros peters-updates
+This will create a new branch called `peters-updates`. You then need to
+create a _pull request_ to get your changes merged into autoconf-macros
+master.
+
+* To get the latest version of `autoconf-macros` into your parent project:
+
+ git subtgree pull --squash --prefix=macros autoconf-macros master
+
+
+References
+----------
+
+Now that autoconf-macros is available to your project, you will need to
+reference it.
+
+* Create (or add these lines to) file `YourProject/aclocal.m4`
+
+ m4_include([macros/ax_nagios_get_os])
+ m4_include([macros/ax_nagios_get_distrib])
+ m4_include([macros/ax_nagios_get_init])
+ m4_include([macros/ax_nagios_get_inetd])
+ m4_include([macros/ax_nagios_get_paths])
+ m4_include([macros/ax_nagios_get_files])
+ m4_include([macros/ax_nagios_get_ssl])
+
+* In your `YourProject/configure.ac` add the following lines. A good place
+to put them would be right after any `AC_PROG_*` entries:
+
+ AC_NAGIOS_GET_OS
+ AC_NAGIOS_GET_DISTRIB_TYPE
+ AC_NAGIOS_GET_INIT
+ AC_NAGIOS_GET_INETD
+ AC_NAGIOS_GET_PATHS
+ AC_NAGIOS_GET_FILES
+
+* If you need SSL functionality, add the following to `YourProject/configure.ac`
+where you want to check for SSL:
+
+ AC_NAGIOS_GET_SSL
+
+* You will now be able to reference any of the variables in `config.h.in`
+and any files listed in the `AC_CONFIG_FILES` macro in `configure.ac`.
+
+
+License Notice
+--------------
+
+Copyright (c) 2016-2017 Nagios Enterprises, LLC
+
+This work is made available to you under the terms of Version 2 of
+the GNU General Public License. A copy of that license should have
+been provided with this software, but in any event can be obtained
+from http://www.fsf.org.
+
+This work 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; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 or visit their web page on the internet at
+http://www.fsf.org.
+
+
+Questions?
+----------
+
+If you have questions about this addon, or problems getting things
+working, first try searching the nagios-users mailing list archives.
+Details on searching the list archives can be found at
+http://www.nagios.org
+
+If you don't find an answer there, post a message in the Nagios
+Plugin Development forum at https://support.nagios.com/forum/viewforum.php?f=35
diff --git a/macros/add_group_user b/macros/add_group_user
new file mode 100755
index 0000000..5d1c212
--- /dev/null
+++ b/macros/add_group_user
@@ -0,0 +1,140 @@
+#!/bin/sh
+
+#----------------------
+# Initialize variables
+#----------------------
+dist="$1"
+uid="$2"
+gid="$3"
+rc=0
+
+#-------------------------------------
+# Check if the specified group exists
+#-------------------------------------
+group_exists(){
+ case $dist in
+ osx) rc=`dscl . -read /Groups/$gid >/dev/null 2>&1; echo $?` ;;
+ hpux) rc=`grget -n $gid >/dev/null 2>&1; echo $?` ;;
+ aix) rc=`lsgroup -a $gid >/dev/null 2>&1; echo $?` ;;
+ *) rc=`getent group $gid > /dev/null 2>&1; echo $?` ;;
+ esac
+
+ echo $rc
+}
+
+#------------------------
+# Add the specified user
+#------------------------
+add_user(){
+ rc=`id "$uid" > /dev/null 2>&1; echo $?`
+ if test $rc -eq 0; then
+ echo "User $uid already exists" > /dev/stderr
+ echo 0
+ return
+ fi
+
+ case $dist in
+ aix)
+ echo useradd -g $gid $uid > /dev/stderr
+ rc=`useradd -g $gid $uid; echo $?`
+ ;;
+
+ hpux)
+ echo useradd -m -g $gid $uid > /dev/stderr
+ rc=`useradd -m -g $gid $uid; echo $?`
+ ;;
+
+ solaris)
+ echo useradd -m -d /export/home/$uid -g $gid $uid > /dev/stderr
+ rc=`useradd -m -d /export/home/$uid -g $gid $uid; echo $?`
+ ;;
+
+ osx)
+ newid=`dscl . -list /Users UniqueID | tr -s ' ' | cut -d' ' -f2 | sort -n | tail -1`
+ newid=`expr 1 + $newid`
+ echo dscl . -create /Users/$uid > /dev/stderr
+ dscl . -create /Users/$uid
+ echo dscl . -create /Users/$uid UniqueID $newid > /dev/stderr
+ dscl . -create /Users/$uid UniqueID $newid
+ echo dscl . -create /Users/$uid UserShell /usr/bin/false > /dev/stderr
+ dscl . -create /Users/$uid UserShell /usr/bin/false
+ echo dscl . -create /Users/$uid PrimaryGroupID 20 > /dev/stderr
+ dscl . -create /Users/$uid PrimaryGroupID 20
+ echo dscl . -append /Groups/$gid GroupMembership $uid > /dev/stderr
+ rc=`dscl . -append /Groups/$gid GroupMembership $uid; echo $?`
+ ;;
+
+ freebsd)
+ echo pw add user $uid -g $gid -s /usr/bin/false > /dev/stderr
+ rc=`pw add user $uid -g $gid -s /usr/bin/false; echo $?`
+ ;;
+
+ netbsd|openbsd)
+ echo useradd -g $gid $uid > /dev/stderr
+ rc=`useradd -g $gid $uid; echo $?`
+ ;;
+
+ *)
+ echo useradd -r -g $gid $uid > /dev/stderr
+ rc=`useradd -r -g $gid $uid; echo $?`
+ ;;
+ esac
+
+ echo $rc
+}
+
+#-------------------------
+# Add the specified group
+#-------------------------
+add_group(){
+ rc=`group_exists`
+ if test $rc -eq 0; then
+ echo "Group $gid already exists" > /dev/stderr
+ echo 0
+ return
+ fi
+
+ case $dist in
+ aix)
+ echo mkgroup $gid > /dev/stderr
+ rc=`mkgroup "$gid"; echo $?`
+ ;;
+
+ hpux|solaris)
+ echo groupadd $gid > /dev/stderr
+ rc=`groupadd "$gid"; echo $?`
+ ;;
+
+ osx)
+ newid=`dscl . -list /Groups gid | tr -s ' ' | cut -d' ' -f2 | sort -n | tail -1`
+ newid=`expr 1 + $newid`
+ echo dscl . -create /Groups/$gid gid $newid > /dev/stderr
+ rc=`dscl . -create /Groups/$gid gid $newid; echo $?`
+ ;;
+
+ freebsd)
+ echo pw add group $gid > /dev/stderr
+ rc=`pw add group $gid; echo $?`
+ ;;
+
+ netbsd|openbsd)
+ echo groupadd $gid > /dev/stderr
+ rc=`groupadd $gid; echo $?`
+ ;;
+
+ *)
+ echo groupadd -r $gid > /dev/stderr
+ rc=`groupadd -r $gid; echo $?`
+ ;;
+ esac
+
+ echo $rc
+}
+
+
+rc=`add_group`
+if test $rc -ne 0; then
+ exit 1;
+fi
+rc=`add_user`
+exit $rc
diff --git a/macros/ax_nagios_get_distrib b/macros/ax_nagios_get_distrib
new file mode 100644
index 0000000..3bb26b0
--- /dev/null
+++ b/macros/ax_nagios_get_distrib
@@ -0,0 +1,160 @@
+# ===========================================================================
+# SYNOPSIS
+#
+# AX_NAGIOS_GET_DISTRIB_TYPE
+#
+# DESCRIPTION
+#
+# This macro determines the O/S distribution of the computer it is run on.
+# $dist_type will be set and will be one of:
+# unknown (could not be determined)
+# freebsd, netbsd, openbsd, dragonfly, etc (The BSDs)
+# suse, rh, debian, gentoo (and possibly their descendants)
+# Other major Linux distributions (and possibly their descendants)
+# The O/S name for the rest
+#
+# LICENSE
+#
+# Copyright (c) 2016 Nagios Core Development Team
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# 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. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+# ===========================================================================
+
+AU_ALIAS([AC_NAGIOS_GET_DISTRIB_TYPE], [AX_NAGIOS_GET_DISTRIB_TYPE])
+AC_DEFUN([AX_NAGIOS_GET_DISTRIB_TYPE],
+[
+
+AC_SUBST(dist_type)
+AC_SUBST(dist_ver)
+
+#
+# Get user hints for possible cross-compile
+#
+ AC_MSG_CHECKING(what the distribution type is )
+ AC_ARG_WITH(dist-type, AC_HELP_STRING([--with-dist-type=type],
+ [specify distribution type (suse, rh, debian, etc.)]),
+ [
+ #
+ # Run this if --with was specified
+ #
+ if test "x$withval" = x -o x$withval = xno; then
+ dist_type_wanted=yes
+ else
+ dist_type_wanted=no
+ dist_type="$withval"
+ dist_ver="unknown"
+ AC_MSG_RESULT($dist_type)
+ fi
+ ], [
+ #
+ # Run this if --with was not specified
+ #
+ dist_type_wanted=yes
+ ])
+
+ if test x$dist_type = xno; then
+ dist_type_wanted=yes
+ elif test x$dist_type = xyes; then
+ AC_MSG_ERROR([you must enter a distribution type if '--with-dist-type' is specified])
+ fi
+
+ #
+ # Determine distribution type if it wasn't supplied
+ #
+ dist_ver="unknown"
+
+ if test $dist_type_wanted=yes; then
+ dist_type="unknown"
+
+ if test "$opsys" != "linux"; then
+ dist_type="$opsys"
+ AS_CASE([$opsys],
+ [bsd],
+ dist_type=`uname -s | tr ["[A-Z]" "[a-z]"]`
+ dist_ver=`uname -r`,
+ [aix],
+ dist_ver="`uname -v`.`uname -r`",
+ [hp-ux],
+ dist_ver=`uname -r | cut -d'.' -f1-3`,
+ [solaris],
+ dist_ver=`uname -r | cut -d'.' -f2`,
+ [*],
+ dist_ver=$OSTYPE
+ )
+
+ else
+
+ if test -r "/etc/gentoo-release"; then
+ dist_type="gentoo"
+ dist_ver=`cat /etc/gentoo-release`
+
+ elif test -r "/etc/os-release"; then
+ . /etc/os-release
+ if test x"$ID_LIKE" != x; then
+ dist_type=`echo $ID_LIKE | cut -d' ' -f1 | tr ["[A-Z]" "[a-z]"]`
+ elif test x"$ID" = xol; then
+ dist_type=rh
+ else
+ dist_type=`echo $ID | tr ["[A-Z]" "[a-z]"]`
+ fi
+ if test x"$dist_type" = sles; then
+ dist_type=suse
+ fi
+ if test x"$VERSION_ID" != x; then
+ dist_ver=$VERSION_ID
+ elif test x"$VERSION" != x; then
+ dist_ver=`echo $VERSION | cut -d'.' -f1 | tr -d [:alpha:][:blank:][:punct:]`
+ fi
+
+ elif test -r "/etc/redhat-release"; then
+ dist_type=rh
+ dist_ver=`cat /etc/redhat-release`
+
+ elif test -r "/etc/debian_version"; then
+ dist_type="debian"
+ if test -r "/etc/lsb-release"; then
+ . /etc/lsb-release
+ dist_ver=`echo "$DISTRIB_RELEASE"`
+ else
+ dist_ver=`cat /etc/debian_version`
+ fi
+
+ elif test -r "/etc/SuSE-release"; then
+ dist_type=suse
+ dist_ver=`grep VERSION /etc/SuSE-release`
+
+ fi
+
+ fi
+
+ if test "$dist_ver" != "unknown"; then
+ dist_ver=`echo "$dist_ver" | cut -d'.' -f1 | tr -d [:alpha:][:blank:][:punct:]`
+ fi
+ fi
+
+ AC_MSG_RESULT($dist_type)
+])
diff --git a/macros/ax_nagios_get_files b/macros/ax_nagios_get_files
new file mode 100644
index 0000000..f8c5a9b
--- /dev/null
+++ b/macros/ax_nagios_get_files
@@ -0,0 +1,131 @@
+# ===========================================================================
+# SYNOPSIS
+#
+# AX_NAGIOS_GET_FILES
+#
+# DESCRIPTION
+#
+# This macro figures out which init and/or inetd files to use based
+# on the results of the AX_NAGIOS_GET_OS, AX_NAGIOS_GET_DISTRIB_TYPE,
+# AX_NAGIOS_GET_INIT and AX_NAGIOS_GET_INETD macros. It will select
+# the appropriate files(s) from the 'startup' directory and copy it.
+#
+# LICENSE
+#
+# Copyright (c) 2016 Nagios Core Development Team
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# 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. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+# ===========================================================================
+
+AU_ALIAS([AC_NAGIOS_GET_FILES], [AX_NAGIOS_GET_FILES])
+AC_DEFUN([AX_NAGIOS_GET_FILES],
+[
+
+AC_SUBST(src_init)
+AC_SUBST(src_inetd)
+AC_SUBST(src_tmpfile)
+AC_SUBST(bsd_enable)
+
+src_inetd=""
+src_init=""
+bsd_enable=""
+
+AC_MSG_CHECKING(for which init file to use )
+
+AS_CASE([$init_type],
+
+ [sysv],
+ src_init=default-init,
+
+ [systemd],
+ src_tmpfile=tmpfile.conf
+ src_init=default-service,
+
+ [bsd],
+ src_init=bsd-init,
+
+ [newbsd],
+ if test $dist_type = freebsd ; then
+ bsd_enable="_enable"
+ src_init=newbsd-init
+ elif test $dist_type = openbsd ; then
+ bsd_enable="_flags"
+ src_init=openbsd-init
+ elif test $dist_type = netbsd ; then
+ bsd_enable=""
+ src_init=newbsd-init
+ fi,
+
+# [gentoo],
+
+ [openrc],
+ src_init=openrc-init,
+
+ [smf*],
+ src_init="solaris-init.xml"
+ src_inetd="solaris-inetd.xml",
+
+ [upstart],
+ if test $dist_type = rh ; then
+ src_init=rh-upstart-init
+ else
+ src_init=upstart-init
+ fi,
+
+ [launchd],
+ src_init="mac-init.plist",
+
+ [*],
+ src_init="unknown"
+)
+AC_MSG_RESULT($src_init)
+
+AC_MSG_CHECKING(for which inetd files to use )
+
+if test x$src_inetd = x; then
+
+ AS_CASE([$inetd_type],
+ [inetd*],
+ src_inetd=default-inetd,
+
+ [xinetd],
+ src_inetd=default-xinetd,
+
+ [systemd],
+ src_inetd=default-socket,
+
+ [launchd],
+ src_inetd="mac-inetd.plist",
+
+ [*],
+ src_inetd="unknown"
+ )
+
+fi
+AC_MSG_RESULT($src_inetd)
+
+])
diff --git a/macros/ax_nagios_get_inetd b/macros/ax_nagios_get_inetd
new file mode 100644
index 0000000..7c75372
--- /dev/null
+++ b/macros/ax_nagios_get_inetd
@@ -0,0 +1,146 @@
+# ===========================================================================
+# SYNOPSIS
+#
+# AX_NAGIOS_GET_INETD
+#
+# DESCRIPTION
+#
+# This macro determines whether inetd or xinetd is being used
+# The argument are:
+# the init type as determined by AX_NAGIOS_GET_INIT
+# $inetd_type will be set and will be one of:
+# unknown (could not be determined)
+# launchd (Mac OS X)
+# smf10 (Solaris)
+# smf11 (Solaris)
+# upstart (Older Debian)
+# xinetd (Most Linux, BSD)
+# inetd (The rest)
+#
+# LICENSE
+#
+# Copyright (c) 2016 Nagios Core Development Team
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# 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. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+# ===========================================================================
+
+AU_ALIAS([AC_NAGIOS_GET_INETD], [AX_NAGIOS_GET_INETD])
+AC_DEFUN([AX_NAGIOS_GET_INETD],
+[
+
+AC_SUBST(inetd_type)
+
+#
+# Get user hints for possible cross-compile
+#
+ AC_MSG_CHECKING(what inetd is being used )
+ AC_ARG_WITH(inetd_type, AC_HELP_STRING([--with-inetd-type=type],
+ [which super-server the system runs (inetd, xinetd, systemd, launchd,
+ smf10, smf11, etc.)]),
+ [
+ inetd_type_wanted=yes
+ #
+ # Run this if --with was specified
+ #
+ if test "x$withval" = x -o x$withval = xno; then
+ inetd_type_wanted=yes
+ else
+ inetd_type_wanted=no
+ inetd_type="$withval"
+ AC_MSG_RESULT($inetd_type)
+ fi
+ ], [
+ #
+ # Run this if --with was not specified
+ #
+ inetd_type_wanted=yes
+ ])
+
+ if test x$inetd_type = xno; then
+ inetd_type_wanted=yes
+ elif test x$inetd_type = xyes; then
+ AC_MSG_ERROR([you must enter an inetd type if '--with-inetd-type' is specified])
+ fi
+
+ #
+ # Determine inetd type if it wasn't supplied
+ #
+ if test $inetd_type_wanted = yes; then
+
+ inetd_disabled=""
+
+ AS_CASE([$dist_type],
+ [solaris],
+ if test x"$init_type" = "xsmf10" -o x"$init_type" = "xsmf11"; then
+ inetd_type="$init_type"
+ else
+ inetd_type="inetd"
+ fi,
+
+ [*bsd*],
+ inetd_type=`ps -A -o comm -c | grep inetd`,
+
+ [osx],
+ inetd_type=`launchd`,
+
+ [aix|hp-ux],
+ inetd_type=`UNIX95= ps -A -o comm | grep inetd | head -1`,
+
+ [*],
+ inetd_type=[`ps -C "inetd,xinetd" -o fname | grep -vi COMMAND | head -1`])
+
+ if test x"$inetd_type" = x; then
+ if test -f /etc/xinetd.conf -a -d /etc/xinetd.d; then
+ inetd_disabled="(Not running)"
+ inetd_type=xinetd
+ elif test -f /etc/inetd.conf -o -f /usr/sbin/inetd; then
+ inetd_type=inetd
+ inetd_disabled="(Not running)"
+ fi
+ fi
+
+ if test x"$inetd_type" = x; then
+ if test x"$init_type" = "xupstart"; then
+ inetd_type="upstart"
+ fi
+ fi
+
+ if test x"$inetd_type" = x; then
+ if test x"$init_type" = "xsystemd"; then
+ inetd_type="systemd"
+ else
+ inetd_type="unknown"
+ fi
+ fi
+
+ if test -n "$inetd_disabled"; then
+ AC_MSG_RESULT($inetd_type $inetd_disabled)
+ else
+ AC_MSG_RESULT($inetd_type)
+ fi
+ fi
+])
diff --git a/macros/ax_nagios_get_init b/macros/ax_nagios_get_init
new file mode 100644
index 0000000..5ef27f4
--- /dev/null
+++ b/macros/ax_nagios_get_init
@@ -0,0 +1,200 @@
+# ===========================================================================
+# SYNOPSIS
+#
+# AX_NAGIOS_GET_INIT
+#
+# DESCRIPTION
+#
+# This macro determines the O/S distribution of the computer it is run on.
+# $init_type will be set and will be one of:
+# unknown (could not be determined)
+# launchd (Mac OS X)
+# bsd (Slackware Linux)
+# newbsd (FreeBSD, OpenBSD, NetBSD, Dragonfly, etc)
+# smf10 (Solaris)
+# smf11 (Solaris)
+# systemd (Linux SystemD)
+# gentoo (Older Gentoo)
+# openrc (Recent Gentoo and some others)
+# upstart (Older Debian)
+# sysv (The rest)
+#
+# LICENSE
+#
+# Copyright (c) 2016 Nagios Core Development Team
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# 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. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+# ===========================================================================
+
+AU_ALIAS([AC_NAGIOS_GET_INIT], [AX_NAGIOS_GET_INIT])
+AC_DEFUN([AX_NAGIOS_GET_INIT],
+[
+
+AC_SUBST(init_type)
+
+#
+# Get user hints for possible cross-compile
+#
+ AC_MSG_CHECKING(what init system is being used )
+ AC_ARG_WITH(init_type,AC_HELP_STRING([--with-init-type=type],
+ [specify init type (bsd, sysv, systemd, launchd, smf10, smf11, upstart,
+ openrc, etc.)]),
+ [
+ #
+ # Run this if --with was specified
+ #
+ if test "x$withval" = x -o x$withval = xno; then
+ init_type_wanted=yes
+ else
+ init_type_wanted=no
+ init_type="$withval"
+ AC_MSG_RESULT($init_type)
+ fi
+ ], [
+ #
+ # Run this if --with was not specified
+ #
+ init_type_wanted=yes
+ ])
+
+ if test x$init_type = xno; then
+ init_type_wanted=yes
+ elif test x$init_type = xyes; then
+ AC_MSG_ERROR([you must enter an init type if '--with-init-type' is specified])
+ fi
+
+ #
+ # Determine init type if it wasn't supplied
+ #
+ if test $init_type_wanted = yes; then
+ init_type=""
+
+ if test x"$opsys" = x; then
+ init_type="unknown"
+ init_type_wanted=no
+ elif test x"$dist_type" = x; then
+ init_type="unknown"
+ init_type_wanted=no
+ elif test "$opsys" = "osx"; then
+ init_type="launchd"
+ init_type_wanted=no
+ elif test "$opsys" = "bsd"; then
+ init_type="newbsd"
+ init_type_wanted=no
+ elif test "$dist_type" = "solaris"; then
+ if test -d "/lib/svc/manifest"; then
+ init_type="smf11"
+ init_type_wanted=no
+ elif test -d "/lib/svc/monitor"; then
+ init_type="smf10"
+ init_type_wanted=no
+ else
+ init_type="sysv"
+ init_type_wanted=no
+ fi
+ elif test "$dist_type" = "slackware"; then
+ init_type="bsd"
+ init_type_wanted=no
+ elif test "$dist_type" = "aix"; then
+ init_type="bsd"
+ init_type_wanted=no
+ elif test "$dist_type" = "hp-ux"; then
+ init_type="unknown"
+ init_type_wanted=no
+ fi
+ fi
+
+ PSCMD="ps -p1 -o args"
+ if test $dist_type = solaris; then
+ PSCMD="env UNIX95=1; ps -p1 -o args"
+ fi
+
+ if test "$init_type_wanted" = yes; then
+ pid1=`$PSCMD | grep -vi COMMAND | cut -d' ' -f1`
+ if test x"$pid1" = "x"; then
+ init_type="unknown"
+ init_type_wanted=no
+ fi
+ if `echo $pid1 | grep "systemd" > /dev/null`; then
+ init_type="systemd"
+ init_type_wanted=no
+ fi
+
+ if test "$init_type_wanted" = yes; then
+ if test "$pid1" = "init"; then
+ if test -e "/sbin/init"; then
+ pid1="/sbin/init";
+ elif test -e "/usr/sbin/init"; then
+ pid1="/usr/sbin/init"
+ else
+ init_type="unknown"
+ init_type_wanted=no
+ fi
+ fi
+ if test -L "$pid1"; then
+ pid1=`readlink "$pid1"`
+ fi
+ fi
+
+ if test "$init_type_wanted" = yes; then
+ if `echo $pid1 | grep "systemd" > /dev/null`; then
+ init_type="systemd"
+ init_type_wanted=no
+ elif test -f "/sbin/rc"; then
+ if test -f /sbin/runscript; then
+ init_type_wanted=no
+ if `/sbin/start-stop-daemon -V | grep "OpenRC" > /dev/null`; then
+ init_type="openrc"
+ else
+ init_type="gentoo"
+ fi
+ fi
+ fi
+ fi
+
+ if test "$init_type_wanted" = yes; then
+ if test "$pid1" = "/sbin/init" -o "$pid1" = "/usr/sbin/init"; then
+ if `$pid1 --version 2>/dev/null | grep "upstart" >/dev/null`; then
+ init_type="upstart"
+ init_type_wanted=no
+ elif test -f "/etc/rc" -a ! -L "/etc/rc"; then
+ init_type="newbsd"
+ init_type_wanted=no
+ else
+ init_type="sysv"
+ init_type_wanted=no
+ fi
+ fi
+ fi
+
+ if test "$init_type_wanted" = yes; then
+ init_type="unknown"
+ fi
+ fi
+
+ AC_MSG_RESULT($init_type)
+])
diff --git a/macros/ax_nagios_get_os b/macros/ax_nagios_get_os
new file mode 100644
index 0000000..5683158
--- /dev/null
+++ b/macros/ax_nagios_get_os
@@ -0,0 +1,101 @@
+# ===========================================================================
+# SYNOPSIS
+#
+# AX_NAGIOS_GET_OS
+#
+# DESCRIPTION
+#
+# This macro determines the operating system of the computer it is run on.
+#
+# LICENSE
+#
+# Copyright (c) 2016 Nagios Core Development Team
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# 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. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+# ===========================================================================
+
+AU_ALIAS([AC_NAGIOS_GET_OS], [AX_NAGIOS_GET_OS])
+AC_DEFUN([AX_NAGIOS_GET_OS],
+[
+
+AC_SUBST(opsys)
+AC_SUBST(arch)
+
+#
+# Get user hints
+#
+ AC_MSG_CHECKING(what the operating system is )
+ AC_ARG_WITH(opsys, AC_HELP_STRING([--with-opsys=OS],
+ [specify operating system (linux, osx, bsd, solaris, irix, cygwin,
+ aix, hp-ux, etc.)]),
+ [
+ #
+ # Run this if --with was specified
+ #
+ if test "x$withval" = x -o x$withval = xno; then
+ opsys_wanted=yes
+ else
+ opsys_wanted=no
+ opsys="$withval"
+ AC_MSG_RESULT($opsys)
+ fi
+ ], [
+ #
+ # Run this if --with was not specified
+ #
+ opsys_wanted=yes
+ ])
+
+ if test x$opsys = xno; then
+ opsys=""
+ opsys_wanted=yes
+ elif test x$opsys = xyes; then
+ AC_MSG_ERROR([you must enter an O/S type if '--with-opsys' is specified])
+ fi
+
+ #
+ # Determine operating system if it wasn't supplied
+ #
+ if test $opsys_wanted=yes; then
+ opsys=`uname -s | tr ["[A-Z]" "[a-z]"]`
+ if test x"$opsys" = "x"; then opsys="unknown"; fi
+ AS_CASE([$opsys],
+ [darwin*], opsys="osx",
+ [*bsd*], opsys="bsd",
+ [dragonfly], opsys="bsd",
+ [sunos], opsys="solaris",
+ [gnu/hurd], opsys="linux",
+ [irix*], opsys="irix",
+ [cygwin*], opsys="cygwin",
+ [mingw*], opsys="mingw",
+ [msys*], opsys="msys")
+ fi
+
+ arch=`uname -m | tr ["[A-Z]" "[a-z]"]`
+
+ AC_MSG_RESULT($opsys)
+])
diff --git a/macros/ax_nagios_get_paths b/macros/ax_nagios_get_paths
new file mode 100644
index 0000000..4fde1cb
--- /dev/null
+++ b/macros/ax_nagios_get_paths
@@ -0,0 +1,738 @@
+# ===========================================================================
+# SYNOPSIS
+#
+# AX_NAGIOS_GET_PATHS
+#
+# DESCRIPTION
+#
+# This macro figures out the installation & run paths for various systems
+# The argument are:
+# the O/S determined by the AX_NAGIOS_GET_OS macro.
+# the distribution type as determined by AX_NAGIOS_GET_DISTRIB_TYPE
+# the init type as determined by AX_NAGIOS_GET_INIT
+# the inetd type as determined by AX_NAGIOS_GET_INETD
+#
+# LICENSE
+#
+# Copyright (c) 2016 Nagios Core Development Team
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# 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. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+# ===========================================================================
+
+AU_ALIAS([AC_NAGIOS_GET_PATHS], [AX_NAGIOS_GET_PATHS])
+AC_DEFUN([AX_NAGIOS_GET_PATHS],
+[
+
+AC_SUBST(pkgsysconfdir)
+AC_SUBST(objsysconfdir)
+AC_SUBST(sbindir)
+AC_SUBST(initname)
+AC_SUBST(inetdname)
+AC_SUBST(pluginsdir)
+AC_SUBST(brokersdir)
+AC_SUBST(cgibindir)
+AC_SUBST(webdir)
+AC_SUBST(privatesysconfdir)
+AC_SUBST(pkglocalstatedir)
+AC_SUBST(logdir)
+AC_SUBST(piddir)
+AC_SUBST(pipedir)
+AC_SUBST(spooldir)
+AC_SUBST(initdir)
+AC_SUBST(inetddir)
+AC_SUBST(tmpfilesd)
+AC_SUBST(subsyslockdir)
+AC_SUBST(subsyslockfile)
+
+if test x$DBG_PATHS != x; then
+ echo
+ echo Incoming paths:
+ echo " prefix $prefix"
+ echo " exec_prefix $exec_prefix"
+ echo " bindir $bindir"
+ echo " sbindir $sbindir"
+ echo " libexecdir $libexecdir"
+ echo " sysconfdir $sysconfdir"
+ echo " localstatedir $localstatedir"
+ echo " datarootdir $datarootdir"
+ echo " datadir $datadir"
+ echo " localedir $localedir"
+ echo
+fi
+
+AC_MSG_CHECKING(for which paths to use )
+
+AC_ARG_ENABLE(install_method,
+ AC_HELP_STRING([--enable-install-method=<method>],
+ [sets the install method to use: 'default' (the default) will install to
+ /usr/local/nagios, 'os' will try to determine which method to use based
+ on OS type and distribution. Fine tuning using the '--bindir', etc.
+ overrides above will still work]),
+ install_method=$enableval,
+ install_method=default
+)
+
+AC_ARG_ENABLE(showdirs_only,
+ AC_HELP_STRING([--enable-showdirs-only=yes],
+ [This option will cause 'configure' to stop after determining the install
+ locations based on '--enable-install-method', so you can see the
+ destinations before a full './configure', 'make', 'make install'
+ process.]),
+ showdirs_only=$enableval,
+ showdirs_only=no
+)
+
+AS_CASE([$install_method],
+ [yes], install_method="os",
+ [no], install_method="default",
+ [default|os], :,
+ [*], echo >&6; AC_MSG_ERROR(['--enable-install-method=$install_method' is invalid])
+)
+
+if test $showdirs_only != "no"; then showdirs_only="yes"; fi
+
+AS_CASE([$dist_type],
+ [*solaris*|*hp-ux*|*aix*|*osx*], opsys=unix)
+
+
+ # Does this package need to know:
+need_cgi=no # where the cgi-bin directory is
+need_web=no # where the website directory is
+need_brk=no # where the event broker modules directory is
+need_plg=no # where the plugins directory is
+need_pipe=no # where the pipe directory is
+need_spl=no # where the spool directory is
+need_loc=no # where the locale directory is
+need_log_subdir=no # where the loc sub-directory is
+need_etc_subdir=no # where the etc sub-directory is
+need_pls_dir=no # where the package locate state directory is
+
+if test x"$INIT_PROG" = x; then
+ INIT_PROG="$PKG_NAME"
+fi
+
+AS_CASE([$PKG_NAME],
+ [nagios],
+ need_log_subdir=yes
+ need_etc_subdir=yes
+ need_pls_dir=yes
+ need_brk=yes
+ need_pipe=yes
+ need_spl=yes
+ need_loc=yes
+ need_cgi=yes
+ need_web=yes,
+
+ [ndoutils],
+ need_brk=yes
+ need_spl=yes,
+
+ [nrpe],
+ need_plg=yes,
+
+ [nsca],
+ need_cgi=no,
+
+ [plugins],
+ need_loc=yes
+ need_plg=yes
+)
+
+AC_ARG_WITH(pkgsysconfdir, AC_HELP_STRING([--with-pkgsysconfdir=DIR],
+ [where configuration files should be placed]),
+ if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
+ pkgsysconfdir="$withval"
+ fi)
+AC_ARG_WITH(objsysconfdir, AC_HELP_STRING([--with-objsysconfdir=DIR],
+ [where object configuration files should be placed]),
+ if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
+ objsysconfdir="$withval"
+ fi)
+AC_ARG_WITH(privatesysconfdir, AC_HELP_STRING([--with-privatesysconfdir=DIR],
+ [where private configuration files should be placed]),
+ if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
+ privatesysconfdir="$withval"
+ fi)
+AC_ARG_WITH(webdir, AC_HELP_STRING([--with-webdir=DIR],
+ [where the website files should be placed]),
+ if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
+ webdir="$withval"
+ fi)
+AC_ARG_WITH(pluginsdir, AC_HELP_STRING([--with-pluginsdir=DIR],
+ [where the plugins should be placed]),
+ if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
+ pluginsdir="$withval"
+ fi)
+AC_ARG_WITH(brokersdir, AC_HELP_STRING([--with-brokersdir=DIR],
+ [where the broker modules should be placed]),
+ if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
+ brokersdir="$withval"
+ fi)
+AC_ARG_WITH(cgibindir, AC_HELP_STRING([--with-cgibindir=DIR],
+ [where the CGI programs should be placed]),
+ if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
+ cgibindir="$withval"
+ fi)
+AC_ARG_WITH(logdir, AC_HELP_STRING([--with-logdir=DIR],
+ [where log files should be placed]),
+ if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
+ logdir="$withval"
+ fi)
+AC_ARG_WITH(piddir, AC_HELP_STRING([--with-piddir=DIR],
+ [where the PID file should be placed]),
+ if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
+ piddir="$withval"
+ fi)
+AC_ARG_WITH(pipedir, AC_HELP_STRING([--with-pipedir=DIR],
+ [where socket and pipe files should be placed]),
+ if test x$withval != x -a x$withval != xno -a x$withval != xyes; then
+ pipedir="$withval"
+ fi)
+
+
+#
+# Setup the base directory
+#
+
+if test $install_method = "default"; then
+ if test $opsys = "unix"; then
+ if test x"$prefix" = "xNONE"; then prefix="/usr/local/nagios"; fi
+ else
+ if test x"$prefix" = "xNONE"; then prefix=${ac_default_prefix}; fi
+ fi
+ datarootdir=${datarootdir="$prefix"}
+
+else
+ if test x"$datadir" = x'${datarootdir}'; then AS_UNSET(datadir); fi
+ if test x"$sysconfdir" = x'${prefix}/etc'; then AS_UNSET(sysconfdir); fi
+
+ if test x"$prefix" = "xNONE"; then
+ if test $dist_type = freebsd -o $dist_type = openbsd -o $dist_type = osx; then
+ prefix="/usr/local"
+ elif test $dist_type = netbsd; then
+ prefix="/usr/pkg"
+ else
+ prefix="/usr"
+ fi
+ fi
+ if test x"$exec_prefix" = "xNONE"; then exec_prefix=$prefix; fi
+ if test x"$localstatedir" = x'${prefix}/var'; then
+ if test $dist_type = "osx"; then
+ localstatedir="/private/var"
+ else
+ localstatedir="/var"
+ fi
+ fi
+
+ if test $opsys = "unix"; then
+ if test x"$datarootdir" = x'${prefix}/share'; then
+ if test $dist_type = "hp-ux"; then
+ datarootdir="/usr/local/share"
+ if test x"$libexecdir" = x'${exec_prefix}/libexec'; then
+ libexecdir="/usr/nagios"
+ fi
+ elif test $dist_type = "osx"; then
+ datarootdir="/usr/local/share"
+ if test x"$libexecdir" = x'${exec_prefix}/libexec'; then
+ libexecdir="/usr/local/nagios"
+ fi
+ elif test x"$libexecdir" = x'${exec_prefix}/libexec'; then
+ libexecdir="/usr/lib/nagios"
+ fi
+ fi
+ if test $dist_type = "osx"; then
+ if test x"$sbindir" = x'${exec_prefix}/sbin'; then
+ sbindir="$libexecdir"
+ fi
+ if test x"$libexecdir" = x'${exec_prefix}/libexec'; then
+ libexecdir="/usr/local/libexec/nagios"
+ fi
+ fi
+ elif test $opsys = "bsd"; then
+ if test x"$libexecdir" = x'${exec_prefix}/libexec'; then
+ libexecdir=${exec_prefix}/libexec/nagios;
+ fi
+ elif test x"$libexecdir" = x'${exec_prefix}/lib'; then
+ libexecdir=${libexecdir}/nagios;
+ elif test x"$libexecdir" = x'${exec_prefix}/libexec'; then
+ libexecdir=${exec_prefix}/lib/nagios;
+ fi
+
+fi
+
+if test x"$exec_prefix" = "xNONE"; then exec_prefix=${prefix}; fi
+
+tmpfilesd=${tmpfilesd="/usr/lib/tmpfiles.d"}
+if test ! -d "$tmpfilesd"; then
+ tmpfilesd="N/A"
+else
+ tmpfilesd="$tmpfilesd/$INIT_PROG.conf"
+fi
+subsyslockdir=${subsyslockdir="/var/lock/subsys"}
+if test ! -d "$subsyslockdir"; then
+ subsyslockdir="N/A"
+ subsyslockfile="N/A"
+else
+ subsyslockfile="$subsyslockdir/$INIT_PROG"
+fi
+if test "$need_loc" = no; then
+ localedir="N/A"
+fi
+
+if test $install_method = "default" ; then
+ #
+ # Do the default setup
+ #
+ sbindir=${bindir}
+ datadir=${datadir="$datarootdir"}
+ if test $need_web = yes; then
+ webdir=${webdir="$datadir"}
+ else
+ webdir="N/A"
+ fi
+ if test $opsys = "unix"; then
+ sysconfdir=${sysconfdir="/etc/opt"}
+ fi
+ pkgsysconfdir=${pkgsysconfdir="$sysconfdir"}
+ if test $need_etc_subdir = yes; then
+ objsysconfdir=${objsysconfdir="$pkgsysconfdir/objects"}
+ else
+ objsysconfdir="N/A"
+ fi
+ privatesysconfdir=${privatesysconfdir="$pkgsysconfdir"}
+ logdir=${logdir="$localstatedir"}
+ piddir=${piddir="$localstatedir"}
+ if test "$need_pipe" = yes; then
+ pipedir=${pipedir="$localstatedir/rw"}
+ else
+ pipedir="N/A"
+ fi
+ if test "$need_pls_dir" = yes; then
+ pkglocalstatedir=${pkglocalstatedir="$localstatedir"}
+ else
+ pkglocalstatedir="N/A"
+ fi
+ if test "$need_spl" = yes; then
+ spooldir=${spooldir="$localstatedir/var"}
+ else
+ spooldir="N/A"
+ fi
+ if test $need_brk = yes; then
+ brokersdir=${brokersdir="$bindir"}
+ else
+ brokersdir="N/A"
+ fi
+ if test $need_plg = yes; then
+ pluginsdir=${pluginsdir="$libexecdir"}
+ else
+ pluginsdir="N/A"
+ fi
+ if test $need_cgi = yes; then
+ cgibindir=${cgibindir="$prefix/sbin"}
+ else
+ cgibindir="N/A"
+ fi
+
+elif test $opsys = "linux"; then
+
+ #
+ # Linux "Standard" install
+ #
+ install_method="$install_method : FHS"
+ datadir=${datadir="$datarootdir/nagios"}
+ if test $need_web = yes; then
+ webdir=${webdir="$datadir/html"}
+ else
+ webdir="N/A"
+ fi
+ sysconfdir=${sysconfdir="/etc"}
+ pkgsysconfdir=${pkgsysconfdir="$sysconfdir/nagios"}
+ if test $need_etc_subdir = yes; then
+ objsysconfdir=${objsysconfdir="$pkgsysconfdir/objects"}
+ else
+ objsysconfdir="N/A"
+ fi
+ privatesysconfdir=${privatesysconfdir="$pkgsysconfdir/private"}
+ if test $need_log_subdir = yes; then
+ logdir=${logdir="$localstatedir/log/$INIT_PROG"}
+ else
+ logdir=${logdir="$localstatedir/log"}
+ fi
+ piddir=${piddir="$localstatedir/run/${INIT_PROG}"}
+ if test "$need_pipe" = yes; then
+ pipedir=${pipedir="$localstatedir/run/${INIT_PROG}"}
+ else
+ pipedir="N/A"
+ fi
+ if test "$need_pls_dir" = yes; then
+ pkglocalstatedir=${pkglocalstatedir="$localstatedir/lib/$INIT_PROG"}
+ else
+ pkglocalstatedir="N/A"
+ fi
+ if test "$need_spl" = yes; then
+ spooldir=${spooldir="$localstatedir/spool/$INIT_PROG"}
+ else
+ spooldir="N/A"
+ fi
+ if test $need_brk = yes; then
+ brokersdir=${brokersdir="$libexecdir/brokers"}
+ else
+ brokersdir="N/A"
+ fi
+ if test $need_plg = yes; then
+ pluginsdir=${pluginsdir="$libexecdir/plugins"}
+ else
+ pluginsdir="N/A"
+ fi
+ if test $need_cgi = yes; then
+ cgibindir=${cgibindir="$libexecdir/cgi-bin"}
+ else
+ cgibindir="N/A"
+ fi
+
+elif test $opsys = "unix"; then
+
+ #
+ # "Standard" Unix install
+ #
+ install_method="$install_method : Unix Standard"
+ if test $dist_type = osx; then
+ install_method="$install_method : OS X Standard"
+ sbindir=${sbindir="/usr/local/libexec"}
+ fi
+ datadir=${datadir="$datarootdir/nagios"}
+ if test $need_web = yes; then
+ webdir=${webdir="$datadir/html"}
+ else
+ webdir="N/A"
+ fi
+ if test $dist_type = osx; then
+ sysconfdir=${sysconfdir="/private/etc"}
+ else
+ sysconfdir=${sysconfdir="/etc"}
+ fi
+ pkgsysconfdir=${pkgsysconfdir="$sysconfdir/nagios"}
+ if test $need_etc_subdir = yes; then
+ objsysconfdir=${objsysconfdir="$pkgsysconfdir/objects"}
+ else
+ objsysconfdir="N/A"
+ fi
+ privatesysconfdir=${privatesysconfdir="$pkgsysconfdir/private"}
+ if test "$need_pls_dir" = yes; then
+ pkglocalstatedir=${pkglocalstatedir="$localstatedir/lib/$INIT_PROG"}
+ else
+ pkglocalstatedir="N/A"
+ fi
+ if test "$need_loc" = yes; then
+ localedir=${localedir="/usr/local/share/locale/<lang>/LC_MESSAGES/nagios-plugins.mo"}
+ fi
+ if test "$need_spl" = yes; then
+ spooldir=${spooldir="$localstatedir/spool/$INIT_PROG"}
+ else
+ spooldir="N/A"
+ fi
+ if test $need_brk = yes; then
+ brokersdir=${brokersdir="$libexecdir/brokers"}
+ else
+ brokersdir="N/A"
+ fi
+ if test $need_plg = yes; then
+ pluginsdir=${pluginsdir="$libexecdir/plugins"}
+ else
+ pluginsdir="N/A"
+ fi
+ if test $need_cgi = yes; then
+ cgibindir=${cgibindir="$libexecdir/cgi-bin"}
+ else
+ cgibindir="N/A"
+ fi
+ AS_CASE([$dist_type],
+ [*hp-ux*],
+ piddir=${piddir="$pkgsysconfdir"}
+ pipedir=${pipedir="$pkglocalstatedir"}
+ logdir=${logdir="$pkglocalstatedir/log"},
+
+ [*],
+ piddir=${piddir="$localstatedir/run/${INIT_PROG}"}
+ if test "$need_pipe" = yes; then
+ pipedir=${pipedir="$localstatedir/run/${INIT_PROG}"}
+ else
+ pipedir="N/A"
+ fi
+ if test $need_log_subdir = yes; then
+ logdir=${logdir="$localstatedir/log/$INIT_PROG"}
+ else
+ logdir=${logdir="$localstatedir/log"}
+ fi
+ )
+
+elif test $opsys = "bsd"; then
+
+ #
+ # "Standard" BSD install
+ #
+ install_method="$install_method : BSD"
+ if test $dist_type = freebsd -o $dist_type = openbsd; then
+ prefix=${prefix="/usr/local"}
+ exec_prefix=${exec_prefix="/usr/local"}
+ if test $dist_type = freebsd; then
+ install_method="$install_method : FreeBSD"
+ else
+ install_method="$install_method : OpenBSD"
+ fi
+ elif test $dist_type = netbsd; then
+ prefix=${prefix="/usr/pkg"}
+ exec_prefix=${exec_prefix="/usr/pkg"}
+ install_method="$install_method : NetBSD"
+ fi
+ datadir=${datadir="$datarootdir/nagios"}
+ if test $need_web = yes -o $need_cgi = yes; then
+ if test $dist_type = freebsd; then
+ webdir=${webdir="$prefix/www/nagios"}
+ elif test $dist_type = netbsd; then
+ webdir=${webdir="$prefix/share/nagios"}
+ elif test $dist_type = openbsd; then
+ webdir=${webdir="/var/www/nagios"}
+ fi
+ else
+ webdir="N/A"
+ fi
+ if test $dist_type = freebsd; then
+ sysconfdir=${sysconfdir="/usr/local/etc"}
+ else
+ sysconfdir=${sysconfdir="/etc"}
+ fi
+ pkgsysconfdir=${pkgsysconfdir="$sysconfdir/nagios"}
+ if test $need_etc_subdir = yes; then
+ objsysconfdir=${objsysconfdir="$pkgsysconfdir/objects"}
+ else
+ objsysconfdir="N/A"
+ fi
+ privatesysconfdir=${privatesysconfdir="$pkgsysconfdir/private"}
+ if test "$need_pls_dir" = yes; then
+ pkglocalstatedir=${pkglocalstatedir="$localstatedir/lib/$INIT_PROG"}
+ else
+ pkglocalstatedir="N/A"
+ fi
+ if test "$need_loc" = yes; then
+ localedir=${localedir="/usr/local/share/locale/<lang>/LC_MESSAGES/nagios-plugins.mo"}
+ fi
+ if test "$need_spl" = yes; then
+ spooldir=${spooldir="$localstatedir/spool/$INIT_PROG"}
+ else
+ spooldir="N/A"
+ fi
+ if test $need_brk = yes; then
+ brokersdir=${brokersdir="$libexecdir/brokers"}
+ else
+ brokersdir="N/A"
+ fi
+ if test $need_plg = yes; then
+ pluginsdir=${pluginsdir="$libexecdir/plugins"}
+ else
+ pluginsdir="N/A"
+ fi
+ if test $need_cgi = yes; then
+ if test $dist_type = freebsd; then
+ cgibindir=${cgibindir="$webdir/cgi-bin"}
+ elif test $dist_type = netbsd; then
+ cgibindir=${pluginsdir="$libexecdir/cgi-bin"}
+ elif test $dist_type = openbsd; then
+ cgibindir=${pluginsdir="/var/www/cgi-bin/nagios"}
+ fi
+ else
+ cgibindir="N/A"
+ fi
+ piddir=${piddir="$localstatedir/run/${INIT_PROG}"}
+ if test "$need_pipe" = yes; then
+ pipedir=${pipedir="$localstatedir/run/${INIT_PROG}"}
+ else
+ pipedir="N/A"
+ fi
+ if test $need_log_subdir = yes; then
+ logdir=${logdir="$localstatedir/log/$INIT_PROG"}
+ else
+ logdir=${logdir="$localstatedir/log"}
+ fi
+
+else
+
+ #
+ # Unknown install
+ #
+ install_method="unknown"
+ webdir=unknown
+ pkgsysconfdir=unknown
+ objsysconfdir=unknown
+ privatesysconfdir=unknown
+ logdir=unknown
+ piddir=unknown
+ pipedir=unknown
+ pkglocalstatedir=unknown
+ spooldir=unknown
+ brokersdir=unknown
+ pluginsdir=unknown
+ cgibindir=unknown
+
+fi
+
+eval prefix=$prefix
+eval exec_prefix=$exec_prefix
+eval bindir=$bindir
+eval sbindir=$sbindir
+eval datarootdir=$datarootdir
+eval datadir=$datadir
+eval libexecdir=$libexecdir
+eval brokersdir=$brokersdir
+eval pluginsdir=$pluginsdir
+eval cgibindir=$cgibindir
+eval localstatedir=$localstatedir
+eval pkglocalstatedir=$pkglocalstatedir
+eval webdir=$webdir
+eval localedir=$localedir
+eval sysconfdir=$sysconfdir
+eval pkgsysconfdir=$pkgsysconfdir
+eval logdir=$logdir
+eval piddir=$piddir
+
+#
+# Init scripts/files
+#
+AS_CASE([$init_type],
+
+ [sysv],
+ if test $dist_type = "hp-ux"; then
+ initdir=${initdir="/sbin/init.d"}
+ else
+ initdir=${initdir="/etc/init.d"}
+ fi
+ initname=${initname="$INIT_PROG"}
+ initconfdir=${initconfdir="/etc/conf.d"}
+ initconf=${initconf="$initconfdir/$INIT_PROG"},
+
+ [systemd],
+ if test $dist_type = "debian"; then
+ initdir=${initdir="/lib/systemd/system"}
+ else
+ initdir=${initdir="/usr/lib/systemd/system"}
+ fi
+ initname=${initname="$INIT_PROG.service"},
+
+ [bsd],
+ if test $dist_type = "aix"; then
+ initdir=${initdir="/sbin/rc.d/init.d"}
+ initname=${initname="$INIT_PROG"}
+ else
+ initdir=${initdir="/etc/rc.d"}
+ initname=${initname="rc.$INIT_PROG"}
+ fi,
+
+ [newbsd],
+ initdir=${initdir="/etc/rc.d"}
+ initname=${initname="$INIT_PROG"},
+
+ [gentoo],
+ initdir=${initdir="/etc/init.d"}
+ initname=${initname="$INIT_PROG"}
+ initconfdir=${initconfdir="/etc/init.d"}
+ initconf=${initconf="$initconfdir/$INIT_PROG"},
+
+ [openrc],
+ initdir=${initdir="/etc/init.d"}
+ initname=${initname="$INIT_PROG"}
+ initconfdir=${initconfdir="/etc/conf.d"}
+ initconf=${initconf="$initconfdir/$INIT_PROG"},
+
+ [smf*],
+ if test $init_type = smf10; then
+ initdir=${initdir="/var/svc/manifest/network/nagios"}
+ else
+ initdir=${initdir="/lib/svc/manifest/network/nagios"}
+ fi
+ initname=${initname="$INIT_PROG.xml"}
+ initconfdir=unknown
+ initconf=unknown,
+
+ [upstart],
+ initdir=${initdir="/etc/init"}
+ initname=${initname="$INIT_PROG.conf"}
+ initconfdir=${initconfdir="/etc/default"}
+ initconf=${initconf="$initconfdir/$INIT_PROG"},
+
+ [launchd],
+ initdir=${initdir="/Library/LaunchDaemons"}
+ initname=${initname="org.nagios.$INIT_PROG.plist"},
+# initconfdir=${initconfdir="/private/etc"}
+# initconf=${initconf="$initconfdir/$INIT_PROG"},
+
+
+ [*],
+ initdir=unknown
+ initname=unknown)
+
+#
+# Inetd (per connection) scripts/files
+#
+AS_CASE([$inetd_type],
+ [inetd*],
+ inetddir=${inetddir="/etc"}
+ inetdname=${inetdname="inetd.conf"},
+
+ [xinetd],
+ inetddir=${inetddir="/etc/xinetd.d"}
+ inetdname=${inetdname="$INIT_PROG"},
+
+ [systemd],
+ if test $dist_type = "debian"; then
+ inetddir=${inetddir="/lib/systemd/system"}
+ else
+ inetddir=${inetddir="/usr/lib/systemd/system"}
+ fi
+ netdname=${inetdname="$INIT_PROG.socket"},
+
+ [smf*],
+ if test $init_type = smf10; then
+ inetddir=${inetddir="/var/svc/manifest/network/nagios"}
+ else
+ inetddir=${inetddir="/lib/svc/manifest/network/nagios"}
+ fi
+ inetdname=${inetdname="$INIT_PROG.xml"},
+
+# [upstart],
+# inetddir=${inetddir="/etc/init.d"}
+# inetdname=${inetdname="$INIT_PROG"},
+
+ [launchd],
+ inetddir=${inetddir="/Library/LaunchDaemons"}
+ inetdname=${inetdname="org.nagios.$INIT_PROG.plist"},
+
+ [*],
+ inetddir=${inetddir="unknown"}
+ inetdname=${inetdname="unknown"})
+
+AC_MSG_RESULT($install_method)
+])
diff --git a/macros/ax_nagios_get_ssl b/macros/ax_nagios_get_ssl
new file mode 100644
index 0000000..ca32333
--- /dev/null
+++ b/macros/ax_nagios_get_ssl
@@ -0,0 +1,303 @@
+# ===========================================================================
+# SYNOPSIS
+#
+# AX_NAGIOS_GET_SSL
+#
+# DESCRIPTION
+#
+# This macro finds the openssl binary, the header files directory and
+# the library files directory. It will also search for the gnutls
+# compatibility library/headers and the nss compatibility library/headers.
+#
+# LICENSE
+#
+# Copyright (c) 2016 Nagios Core Development Team
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# 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. If not, see <http://www.gnu.org/licenses/>.
+#
+# As a special exception, the respective Autoconf Macro's copyright owner
+# gives unlimited permission to copy, distribute and modify the configure
+# scripts that are the output of Autoconf when processing the Macro. You
+# need not follow the terms of the GNU General Public License when using
+# or distributing such scripts, even though portions of the text of the
+# Macro appear in them. The GNU General Public License (GPL) does govern
+# all other use of the material that constitutes the Autoconf Macro.
+#
+# This special exception to the GPL applies to versions of the Autoconf
+# Macro released by the Autoconf Archive. When you make and distribute a
+# modified version of the Autoconf Macro, you may extend this special
+# exception to the GPL to apply to your modified version as well.
+# ===========================================================================
+
+AU_ALIAS([AC_NAGIOS_GET_SSL], [AX_NAGIOS_GET_SSL])
+AC_DEFUN([AX_NAGIOS_GET_SSL],
+[
+
+# -------------------------------
+# SSL library and include paths
+# -------------------------------
+
+SSL_TYPE=openssl
+try_pkg_config=1
+ssl_dir=
+ssl_inc_dir=
+ssl_lib_dir=
+SSL_INC_DIR=
+SSL_INC_PREFIX=
+SSL_HDR=
+SSL_LIB_DIR=
+
+AC_SUBST(HAVE_SSL)
+AC_SUBST(SSL_TYPE)
+AC_SUBST(SSL_INC_DIR)
+AC_SUBST(SSL_HDR)
+AC_SUBST(SSL_INC_PREFIX)
+AC_SUBST(SSL_LIB_DIR)
+
+
+# gnutls/openssl.h
+# nss_compat_ossl/nss_compat_ossl.h
+
+dnl # Which type - openssl, gnutls-openssl, nss
+dnl AC_ARG_WITH([ssl-type],
+dnl dnl AS_HELP_STRING([--with-ssl-type=TYPE],[replace TYPE with gnutls or nss to use one of these instead of openssl]),
+dnl AS_HELP_STRING([--with-ssl-type=TYPE],[replace TYPE with gnutls to use that instead of openssl]),
+dnl [SSL_TYPE=$withval])
+
+AC_ARG_WITH([ssl],
+ AS_HELP_STRING([--with-ssl=DIR],[sets location of the SSL installation]),
+ [ssl_dir=$withval])
+AC_ARG_WITH([ssl-inc],
+ AS_HELP_STRING([--with-ssl-inc=DIR],
+ [sets location of the SSL include files]),
+ [ssl_inc_dir=$withval])
+AC_ARG_WITH([ssl-lib],
+ AS_HELP_STRING([--with-ssl-lib=DIR],[sets location of the SSL libraries]),
+ [ssl_lib_dir=$withval])
+
+if test x$ssl_inc_dir != x -o x$ssl_lib_dir != x; then
+ try_pkg_config=0
+fi
+
+AC_ARG_WITH([kerberos-inc],
+ AS_HELP_STRING([--with-kerberos-inc=DIR],
+ [sets location of the Kerberos include files]),
+ [kerberos_inc_dir=$withval])
+
+if test x$SSL_TYPE = xyes; then
+ SSL_TYPE=openssl
+fi
+
+
+dflt_hdrs="$ssl_inc_dir $ssl_dir $ssl_inc_dir/include $ssl_dir/include \
+ /usr/local/opt/{BBB} /usr/include/{BBB} /usr/local/include/{BBB} \
+ /usr/local/{AAA} /usr/local/{BBB} /usr/lib/{AAA} /usr/lib/{BBB} \
+ /usr/{AAA} /usr/pkg /usr/local /usr /usr/freeware/lib/{BBB} \
+ /usr/sfw /usr/sfw/include /opt/{BBB}"
+
+dflt_libs="$ssl_lib_dir {ssldir} {ssldir}/lib {ssldir}/lib64 /usr/lib64 \
+ /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/i386-linux-gnu \
+ /usr/local/lib /usr/lib/{AAA} /usr/{AAA}/lib /usr/{BBB}/lib \
+ /usr/pkg/lib /usr/freeware/lib/{BBB} /usr/sfw/lib /opt/freeware/lib \
+ /opt/{BBB}/lib/hpux64 /opt/{BBB}/lib/pa20_64 /opt/{BBB}/lib/hpux32 \
+ /opt/{BBB}/lib /opt/{BBB}";
+
+
+AS_CASE([$SSL_TYPE],
+ [no], [SSL_TYPE=NONE],
+ [yes|openssl],
+ [ssl_hdr_dirs=`echo "$dflt_hdrs" | sed -e 's/{AAA}/ssl/g' | sed -e 's/{BBB}/openssl/g'`
+ ssl_lib_dirs=`echo "$dflt_libs" | sed -e 's/{AAA}/ssl/g' | sed -e 's/{BBB}/openssl/g'`
+ SSL_INC_PREFIX=openssl
+ SSL_HDR=ssl.h
+ ssl_lib=libssl],
+ [gnutls],
+ [ssl_hdr_dirs=`echo "$dflt_hdrs" | sed -e 's/{AAA}/gnutls/g' | sed -e 's/{BBB}/gnutls/g'`
+ ssl_lib_dirs=`echo "$dflt_libs" | sed -e 's/{AAA}/gnutls/g' | sed -e 's/{BBB}/gnutls/g'`
+ SSL_INC_PREFIX=gnutls
+ SSL_TYPE=gnutls_compat
+ SSL_HDR=compat.h
+ ssl_lib=libgnutls],
+ [nss],
+ [ssl_hdr_dirs=`echo "$dflt_hdrs" | sed -e 's/{AAA}/nss_compat_ossl/g' | sed -e 's/{BBB}/nss_compat_ossl/g'`
+ ssl_lib_dirs=`echo "$dflt_libs" | sed -e 's/{AAA}/nss_compat_ossl/g' | sed -e 's/{BBB}/nss_compat_ossl/g'`
+ SSL_HDR=nss_compat_ossl.h
+ ssl_lib=libnss_compat],
+ [*], echo >&6; AC_MSG_ERROR(['--with-ssl-type=$SSL_TYPE' is invalid])
+)
+
+
+# Check for SSL support
+
+if test x$SSL_TYPE != xNONE; then
+
+ found_ssl=no
+
+ # RedHat 8.0 and 9.0 include openssl compiled with kerberos,
+ # so we must include header file
+ # Must come before openssl checks for Redhat EL 3
+ AC_MSG_CHECKING(for Kerberos include files)
+ found_kerberos=no
+ for dir in $kerberos_inc_dir /usr/kerberos/include /usr/include/krb5 \
+ /usr/include; do
+ kerbdir="$dir"
+ if test -f "$dir/krb5.h"; then
+ found_kerberos=yes
+ CFLAGS="$CFLAGS -I$kerbdir"
+ AC_DEFINE_UNQUOTED(HAVE_KRB5_H,[1],[Have the krb5.h header file])
+ break
+ fi
+ done
+
+ if test x_$found_kerberos != x_yes; then
+ AC_MSG_WARN(could not find include files)
+ else
+ AC_MSG_RESULT(found Kerberos include files in $kerbdir)
+ fi
+
+ # First, try using pkg_config
+ AC_CHECK_TOOL([PKG_CONFIG], [pkg-config])
+ if test x"$PKG_CONFIG" != x -a $try_pkg_config -ne 0 ; then
+ cflags=`$PKG_CONFIG $SSL_TYPE --cflags-only-I 2>/dev/null`
+ if test $? -eq 0; then
+ CFLAGS="$CFLAGS $cflags"
+ LDFLAGS="$LDFLAGS `$PKG_CONFIG $SSL_TYPE --libs-only-L 2>/dev/null`"
+ LIBS="$LIBS `$PKG_CONFIG $SSL_TYPE --libs-only-l 2>/dev/null`"
+ found_ssl=yes
+ AC_DEFINE_UNQUOTED(HAVE_SSL,[1],[Have SSL support])
+ fi
+ fi
+
+ if test x_$found_ssl != x_yes; then
+
+ # Find the SSL Headers
+ AC_MSG_CHECKING(for SSL headers)
+ for dir in $ssl_hdr_dirs; do
+ if test "$dir" = "/include"; then
+ continue
+ fi
+ ssldir="$dir"
+ if test -f "$dir/include/$SSL_INC_PREFIX/$SSL_HDR"; then
+ found_ssl=yes
+ CFLAGS="$CFLAGS -I$dir/include/$SSL_INC_PREFIX -I$ssldir/include"
+ SSL_INC_DIR="$dir/include/$SSL_INC_PREFIX"
+ break
+ fi
+ if test -f "$dir/include/$SSL_HDR"; then
+ found_ssl=yes
+ if test "$SSL_HDR" != compat.h ; then
+ SSL_INC_PREFIX=""
+ fi
+ CFLAGS="$CFLAGS -I$dir/include"
+ SSL_INC_DIR="$dir/include"
+ break
+ fi
+ if test -f "$dir/$SSL_HDR"; then
+ found_ssl=yes
+ SSL_INC_PREFIX=""
+ CFLAGS="$CFLAGS -I$dir"
+ SSL_INC_DIR="$dir"
+ break
+ fi
+ if test -f "$dir/$SSL_INC_PREFIX/$SSL_HDR"; then
+ found_ssl=yes
+ CFLAGS="$CFLAGS -I$dir/$SSL_INC_PREFIX"
+ SSL_INC_DIR="$dir/$SSL_INC_PREFIX"
+ ssldir="$dir/.."
+ break
+ fi
+ done
+
+ if test x_$found_ssl != x_yes; then
+ AC_MSG_ERROR(Cannot find ssl headers)
+ else
+ AC_MSG_RESULT(found in $ssldir)
+
+ # Now try and find SSL libraries
+
+ AC_MSG_CHECKING(for SSL libraries)
+ found_ssl=no
+ ssl_lib_dirs=`echo "$ssl_lib_dirs" | sed -e "s|{ssldir}|$ssldir|g"`
+
+ if test "`uname -s`" = "Darwin" ; then
+ soext="dylib"
+ elif test "`uname -s`" = "HP-UX" ; then
+ if test x$arch = "xia64"; then
+ soext="so"
+ else
+ soext="sl"
+ fi
+ elif test "`uname -s`" = "AIX" ; then
+ soext="a"
+ else
+ soext="so"
+ fi
+
+ for dir in $ssl_lib_dirs; do
+ if test -f "$dir/$ssl_lib.$soext"; then
+ found_ssl=yes
+ SSL_LIB_DIR="$dir"
+ break
+ fi
+ done
+
+ if test x_$found_ssl != x_yes; then
+ AC_MSG_ERROR(Cannot find ssl libraries)
+ else
+ AC_MSG_RESULT(found in $SSL_LIB_DIR)
+
+ LDFLAGS="$LDFLAGS -L$SSL_LIB_DIR";
+ LIBS="$LIBS -l`echo $ssl_lib | sed -e 's/^lib//'` -lcrypto";
+ AC_DEFINE_UNQUOTED(HAVE_SSL,[1],[Have SSL support])
+ fi
+ fi
+ fi
+
+ if test x$found_ssl = xyes ; then
+ if test -n "$SSL_INC_PREFIX" ; then
+ SSL_INC_PREFIX="${SSL_INC_PREFIX}/"
+ fi
+
+ # try to compile and link to see if SSL is set up properly
+ AC_MSG_CHECKING([whether compiling and linking against SSL works])
+
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([#include <${SSL_INC_PREFIX}${SSL_HDR}>], [SSL_new(NULL)])],
+ [
+ AC_MSG_RESULT([yes])
+ $1
+ ], [
+ AC_MSG_ERROR([no])
+ $2
+ ])
+ fi
+
+ if test x$found_ssl = xyes -a x$need_dh = xyes; then
+
+ # Find the openssl program
+
+ if test x$need_dh = xyes; then
+ AC_PATH_PROG(sslbin,openssl,value-if-not-found,$ssl_dir/sbin$PATH_SEPARATOR$ssl_dir/bin$PATH_SEPARATOR$PATH)
+ AC_DEFINE(USE_SSL_DH)
+ # Generate DH parameters
+ if test -f "$sslbin"; then
+ echo ""
+ echo "*** Generating DH Parameters for SSL/TLS ***"
+ # awk to strip off meta data at bottom of dhparam output
+ $sslbin dhparam -C 2048 | awk '/^-----/ {exit} {print}' > include/dh.h
+ fi
+ fi
+ fi
+fi
+])
diff --git a/nrpe.spec.in b/nrpe.spec.in
new file mode 100644
index 0000000..572c245
--- /dev/null
+++ b/nrpe.spec.in
@@ -0,0 +1,208 @@
+%define isaix %(test "`uname -s`" = "AIX" && echo "1" || echo "0")
+%define islinux %(test "`uname -s`" = "Linux" && echo "1" || echo "0")
+
+%if %{isaix}
+ %define _prefix /opt/nagios
+ %define _docdir %{_prefix}/doc/@PACKAGE_NAME@-@PACKAGE_VERSION@
+ %define nshome /opt/nagios
+ %define _make gmake
+%endif
+%if %{islinux}
+ %define _init_dir @initdir@
+ %define _init_type @init_type@
+ %define _exec_prefix %{_prefix}/sbin
+ %define _bindir %{_prefix}/sbin
+ %define _sbindir %{_prefix}/lib/nagios/cgi
+ %define _libexecdir %{_prefix}/lib/nagios/plugins
+ %define _datadir %{_prefix}/share/nagios
+ %define _localstatedir /var/log/nagios
+ %define nshome /var/log/nagios
+ %define _make make
+%endif
+%define _sysconfdir /etc/nagios
+
+%define name @PACKAGE_NAME@
+%define version 3.2.1
+%define release @RPM_RELEASE@
+%define nsusr @nrpe_user@
+%define nsgrp @nrpe_group@
+%define nsport @nrpe_port@
+%define ns_src_tmpfile "@src_tmpfile@"
+
+# Reserve option to override port setting with:
+# rpm -ba|--rebuild --define 'nsport 5666'
+%{?port:%define nsport %{port}}
+
+# Macro that print messages to syslog at package (un)install time
+%define nnmmsg logger -t %{name}/rpm
+
+Summary: Host/service/network monitoring agent for Nagios
+URL: http://www.nagios.org
+Name: %{name}
+Version: %{version}
+Release: %{release}
+License: GPL
+Group: Application/System
+Source0: %{name}-%{version}.tar.gz
+BuildRoot: %{_tmppath}/%{name}-buildroot
+Prefix: %{_prefix}
+Prefix: @initdir@
+Prefix: /etc/nagios
+%if %{isaix}
+Requires: nagios-plugins
+%endif
+%if %{islinux}
+Requires: bash, grep, nagios-plugins, util-linux, chkconfig, shadow-utils, sed, initscripts, mktemp
+%endif
+
+%description
+NPRE (Nagios Remote Plugin Executor) is a system daemon that
+will execute various Nagios plugins locally on behalf of a
+remote (monitoring) host that uses the check_nrpe plugin.
+Various plugins that can be executed by the daemon are available
+at: http://sourceforge.net/projects/nagiosplug
+
+This package provides the client-side NRPE agent (daemon).
+
+%package plugin
+Group: Application/System
+Summary: Provides nrpe plugin for Nagios.
+Requires: nagios-plugins
+
+%description plugin
+NPRE (Nagios Remote Plugin Executor) is a system daemon that
+will execute various Nagios plugins locally on behalf of a
+remote (monitoring) host that uses the check_nrpe plugin.
+Various plugins that can be executed by the daemon are available
+at: http://sourceforge.net/projects/nagiosplug
+
+This package provides the server-side NRPE plugin for
+Nagios-related applications.
+
+%prep
+%setup -q
+
+%if %{isaix}
+# Check to see if the nrpe service is running and, if so, stop it.
+/usr/bin/lssrc -s nrpe > /dev/null 2> /dev/null
+if [ $? -eq 0 ] ; then
+ status=`/usr/bin/lssrc -s nrpe | /usr/bin/gawk '$1=="nrpe" {print $NF}'`
+ if [ "$status" = "active" ] ; then
+ /usr/bin/stopsrc -s nrpe
+ fi
+fi
+%endif
+
+%if %{isaix}
+%post
+/usr/bin/lssrc -s nrpe > /dev/null 2> /dev/null
+if [ $? -eq 1 ] ; then
+ /usr/bin/mkssys -p %{_bindir}/nrpe -s nrpe -u 0 -a "-c %{_sysconfdir}/nrpe.cfg -d -s" -Q -R -S -n 15 -f 9
+fi
+/usr/bin/startsrc -s nrpe
+%endif
+
+%preun
+%if %{isaix}
+status=`/usr/bin/lssrc -s nrpe | /usr/bin/gawk '$1=="nrpe" {print $NF}'`
+if [ "$status" = "active" ] ; then
+ /usr/bin/stopsrc -s nrpe
+fi
+/usr/bin/rmssys -s nrpe
+%endif
+%if %{islinux}
+if [ "$1" = 0 ]; then
+ /sbin/service nrpe stop > /dev/null 2>&1
+ /sbin/chkconfig --del nrpe
+fi
+%endif
+
+%if %{islinux}
+%postun
+if [ "$1" -ge "1" ]; then
+ /sbin/service nrpe condrestart >/dev/null 2>&1 || :
+fi
+%endif
+
+%build
+export PATH=$PATH:/usr/sbin
+CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" \
+MAKE=%{_make} ./configure \
+ --with-init-type=%{_init_type} \
+ --with-nrpe-port=%{nsport} \
+ --with-nrpe-user=%{nsusr} \
+ --with-nrpe-group=%{nsgrp} \
+ --prefix=%{_prefix} \
+ --exec-prefix=%{_exec_prefix} \
+ --bindir=%{_bindir} \
+ --sbindir=%{_sbindir} \
+ --libexecdir=%{_libexecdir} \
+ --datadir=%{_datadir} \
+ --sysconfdir=%{_sysconfdir} \
+ --localstatedir=%{_localstatedir} \
+ --enable-command-args
+%{_make} all
+
+%install
+[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
+%if %{islinux}
+install -d -m 0755 ${RPM_BUILD_ROOT}%{_init_dir}
+%endif
+DESTDIR=${RPM_BUILD_ROOT} %{_make} install-groups-users install install-config install-init
+
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+
+%files
+%if %{islinux}
+%defattr(755,root,root)
+@initdir@/@initname@
+%endif
+%{_bindir}/nrpe
+%dir %{_sysconfdir}
+%defattr(600,%{nsusr},%{nsgrp})
+%config(noreplace) %{_sysconfdir}/*.cfg
+%defattr(755,%{nsusr},%{nsgrp})
+%if %{ns_src_tmpfile} != ""
+@tmpfilesd@
+%endif
+%{_bindir}/nrpe-uninstall
+%doc CHANGELOG.md LEGAL README.md README.SSL.md SECURITY.md
+
+%files plugin
+%defattr(755,%{nsusr},%{nsgrp})
+%{_libexecdir}
+%defattr(644,%{nsusr},%{nsgrp})
+%doc CHANGELOG.md LEGAL README.md
+
+%changelog
+* Thu Aug 18 2016 John Frickson jfrickson<@>nagios.com
+- Changed 'make install-daemon-config' to 'make install-config'
+- Added make targets 'install-groups-users' and 'install-init'
+- Misc. changes
+
+* Mon Mar 12 2012 Eric Stanley estanley<@>nagios.com
+- Created autoconf input file
+- Updated to support building on AIX
+- Updated install to use make install*
+
+* Mon Jan 23 2006 Andreas Kasenides ank<@>cs.ucy.ac.cy
+- fixed nrpe.cfg relocation to sample-config
+- replaced Copyright label with License
+- added --enable-command-args to enable remote arg passing (if desired can be disabled by commenting out)
+
+* Wed Nov 12 2003 Ingimar Robertsson <iar@skyrr.is>
+- Added adding of nagios group if it does not exist.
+
+* Tue Jan 07 2003 James 'Showkilr' Peterson <showkilr@showkilr.com>
+- Removed the lines which removed the nagios user and group from the system
+- changed the patch release version from 3 to 1
+
+* Mon Jan 06 2003 James 'Showkilr' Peterson <showkilr@showkilr.com>
+- Removed patch files required for nrpe 1.5
+- Update spec file for version 1.6 (1.6-1)
+
+* Sat Dec 28 2002 James 'Showkilr' Peterson <showkilr@showkilr.com>
+- First RPM build (1.5-1)
diff --git a/paths.in b/paths.in
new file mode 100755
index 0000000..fa1cc44
--- /dev/null
+++ b/paths.in
@@ -0,0 +1,85 @@
+#!/bin/sh
+
+wrout () {
+ if test "$2" != "N/A"; then printf " %-25s %s\n" "$1" "$2"; fi
+}
+
+echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
+echo "Detected Environment:"
+echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
+wrout "Operating System" "@opsys@"
+wrout "Architecture" "@arch@"
+wrout "Distribution type" "@dist_type@ Version @dist_ver@"
+wrout "Init type" "@init_type@"
+wrout "Inetd type" "@inetd_type@"
+echo
+echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
+echo "Paths are:"
+echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
+wrout "prefix" "@prefix@"
+wrout "exec_prefix" "@prefix@"
+if test "@PKG_NAME@" = "nagios"; then
+ wrout "bindir" "@bindir@"
+fi
+wrout "sbindir" "@sbindir@"
+wrout "sysconfdir" "@sysconfdir@"
+wrout "pkgsysconfdir" "@pkgsysconfdir@"
+if test "@PKG_NAME@" = "nagios"; then
+ wrout "privatesysconfdir" "@privatesysconfdir@"
+fi
+wrout "localstatedir" "@localstatedir@"
+wrout "pkglocalstatedir" "@pkglocalstatedir@"
+wrout "datarootdir" "@datarootdir@"
+wrout "datadir" "@datadir@"
+wrout "webdir" "@webdir@"
+wrout "localedir" "@localedir@"
+wrout "logdir" "@logdir@"
+wrout "piddir" "@piddir@"
+wrout "pipedir" "@pipedir@"
+wrout "spooldir" "@spooldir@"
+wrout "libexecdir" "@libexecdir@"
+wrout "brokersdir" "@brokersdir@"
+wrout "pluginsdir" "@pluginsdir@"
+wrout "cgibindir" "@cgibindir@"
+wrout "initdir" "@initdir@"
+wrout "inetddir" "@inetddir@"
+wrout "subsyslockdir" "@subsyslockdir@"
+echo
+echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
+echo '@PKG_NAME@ files will be installed or created as follows:'
+echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
+wrout "Config file" "@pkgsysconfdir@/@PKG_NAME@.cfg"
+wrout "Object config dir" "@objsysconfdir@"
+wrout "daemon" "@sbindir@/@PKG_NAME@"
+if test "@PKG_NAME@" = "nrpe"; then
+ wrout "check_@PKG_NAME@" "@pluginsdir@/check_@PKG_NAME@"
+fi
+if test "@PKG_NAME@" = "nagios"; then
+ wrout "nagiostats (prog)" "@bindir@/nagiostats"
+ wrout "Website password file" "@pkgsysconfdir@/passwd"
+ wrout "resource.cfg" "@privatesysconfdir@/resource.cfg"
+ wrout "event handlers dir" "@brokersdir@"
+ wrout "cgi program dir" "@cgibindir@"
+ wrout "website file dir" "@webdir@"
+ wrout "status.dat" "@pkglocalstatedir@/status.dat"
+ wrout "retention.dat" "@pkglocalstatedir@/retention.dat"
+ wrout "object cache dir" "@pkglocalstatedir@"
+ wrout "log file" "@logdir@/@PKG_NAME@.log"
+ wrout "log archive dir" "@logdir@/archives"
+ wrout "@PKG_NAME@.configtest" "@logdir@/@PKG_NAME@.configtest"
+ wrout "@PKG_NAME@.cmd" "@pipedir@/@PKG_NAME@.cmd"
+ wrout "@PKG_NAME@.qh" "@pipedir@/@PKG_NAME@.qh"
+ wrout "perfdata file dir" "@spooldir@"
+ wrout "checkresult files" "@spooldir@/checkresults"
+else
+ wrout "inetd config" "@inetddir@/@inetdname@"
+fi
+wrout "init script" "@initdir@/@initname@"
+wrout "@PKG_NAME@.conf (tmpfiles.d)" "@tmpfilesd@"
+wrout "@PKG_NAME@ lock file" "@piddir@/@PKG_NAME@.pid"
+wrout "language files" "@localedir@"
+wrout "init lock file" "@subsyslockfile@"
+wrout "init source file" "@src_init@"
+wrout "inetd source file" "@src_inetd@"
+echo
+echo "To show this list again, type './paths' at the prompt"
diff --git a/sample-config/nrpe.cfg.in b/sample-config/nrpe.cfg.in
new file mode 100644
index 0000000..1d503c9
--- /dev/null
+++ b/sample-config/nrpe.cfg.in
@@ -0,0 +1,361 @@
+#############################################################################
+#
+# Sample NRPE Config File
+#
+# Notes:
+#
+# This is a sample configuration file for the NRPE daemon. It needs to be
+# located on the remote host that is running the NRPE daemon, not the host
+# from which the check_nrpe client is being executed.
+#
+#############################################################################
+
+
+# LOG FACILITY
+# The syslog facility that should be used for logging purposes.
+
+log_facility=@log_facility@
+
+
+
+# LOG FILE
+# If a log file is specified in this option, nrpe will write to
+# that file instead of using syslog.
+
+#log_file=@logdir@/nrpe.log
+
+
+
+# DEBUGGING OPTION
+# This option determines whether or not debugging messages are logged to the
+# syslog facility.
+# Values: 0=debugging off, 1=debugging on
+
+debug=0
+
+
+
+# PID FILE
+# The name of the file in which the NRPE daemon should write it's process ID
+# number. The file is only written if the NRPE daemon is started by the root
+# user and is running in standalone mode.
+
+pid_file=@piddir@/nrpe.pid
+
+
+
+# PORT NUMBER
+# Port number we should wait for connections on.
+# NOTE: This must be a non-privileged port (i.e. > 1024).
+# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
+
+server_port=@nrpe_port@
+
+
+
+# SERVER ADDRESS
+# Address that nrpe should bind to in case there are more than one interface
+# and you do not want nrpe to bind on all interfaces.
+# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
+
+#server_address=127.0.0.1
+
+
+
+# LISTEN QUEUE SIZE
+# Listen queue size (backlog) for serving incoming connections.
+# You may want to increase this value under high load.
+
+#listen_queue_size=5
+
+
+
+# NRPE USER
+# This determines the effective user that the NRPE daemon should run as.
+# You can either supply a username or a UID.
+#
+# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
+
+nrpe_user=@nrpe_user@
+
+
+
+# NRPE GROUP
+# This determines the effective group that the NRPE daemon should run as.
+# You can either supply a group name or a GID.
+#
+# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
+
+nrpe_group=@nrpe_group@
+
+
+
+# ALLOWED HOST ADDRESSES
+# This is an optional comma-delimited list of IP address or hostnames
+# that are allowed to talk to the NRPE daemon. Network addresses with a bit mask
+# (i.e. 192.168.1.0/24) are also supported. Hostname wildcards are not currently
+# supported.
+#
+# Note: The daemon only does rudimentary checking of the client's IP
+# address. I would highly recommend adding entries in your /etc/hosts.allow
+# file to allow only the specified host to connect to the port
+# you are running this daemon on.
+#
+# NOTE: This option is ignored if NRPE is running under either inetd or xinetd
+
+allowed_hosts=127.0.0.1,::1
+
+
+
+# COMMAND ARGUMENT PROCESSING
+# This option determines whether or not the NRPE daemon will allow clients
+# to specify arguments to commands that are executed. This option only works
+# if the daemon was configured with the --enable-command-args configure script
+# option.
+#
+# *** ENABLING THIS OPTION IS A SECURITY RISK! ***
+# Read the SECURITY file for information on some of the security implications
+# of enabling this variable.
+#
+# Values: 0=do not allow arguments, 1=allow command arguments
+
+dont_blame_nrpe=0
+
+
+
+# BASH COMMAND SUBSTITUTION
+# This option determines whether or not the NRPE daemon will allow clients
+# to specify arguments that contain bash command substitutions of the form
+# $(...). This option only works if the daemon was configured with both
+# the --enable-command-args and --enable-bash-command-substitution configure
+# script options.
+#
+# *** ENABLING THIS OPTION IS A HIGH SECURITY RISK! ***
+# Read the SECURITY file for information on some of the security implications
+# of enabling this variable.
+#
+# Values: 0=do not allow bash command substitutions,
+# 1=allow bash command substitutions
+
+allow_bash_command_substitution=0
+
+
+
+# COMMAND PREFIX
+# This option allows you to prefix all commands with a user-defined string.
+# A space is automatically added between the specified prefix string and the
+# command line from the command definition.
+#
+# *** THIS EXAMPLE MAY POSE A POTENTIAL SECURITY RISK, SO USE WITH CAUTION! ***
+# Usage scenario:
+# Execute restricted commmands using sudo. For this to work, you need to add
+# the nagios user to your /etc/sudoers. An example entry for allowing
+# execution of the plugins from might be:
+#
+# nagios ALL=(ALL) NOPASSWD: /usr/lib/nagios/plugins/
+#
+# This lets the nagios user run all commands in that directory (and only them)
+# without asking for a password. If you do this, make sure you don't give
+# random users write access to that directory or its contents!
+
+# command_prefix=/usr/bin/sudo
+
+
+# MAX COMMANDS
+# This specifies how many children processes may be spawned at any one
+# time, essentially limiting the fork()s that occur.
+# Default (0) is set to unlimited
+# max_commands=0
+
+
+
+# COMMAND TIMEOUT
+# This specifies the maximum number of seconds that the NRPE daemon will
+# allow plugins to finish executing before killing them off.
+
+command_timeout=60
+
+
+
+# CONNECTION TIMEOUT
+# This specifies the maximum number of seconds that the NRPE daemon will
+# wait for a connection to be established before exiting. This is sometimes
+# seen where a network problem stops the SSL being established even though
+# all network sessions are connected. This causes the nrpe daemons to
+# accumulate, eating system resources. Do not set this too low.
+
+connection_timeout=300
+
+
+
+# WEAK RANDOM SEED OPTION
+# This directive allows you to use SSL even if your system does not have
+# a /dev/random or /dev/urandom (on purpose or because the necessary patches
+# were not applied). The random number generator will be seeded from a file
+# which is either a file pointed to by the environment valiable $RANDFILE
+# or $HOME/.rnd. If neither exists, the pseudo random number generator will
+# be initialized and a warning will be issued.
+# Values: 0=only seed from /dev/[u]random, 1=also seed from weak randomness
+
+#allow_weak_random_seed=1
+
+
+
+# SSL/TLS OPTIONS
+# These directives allow you to specify how to use SSL/TLS.
+
+# SSL VERSION
+# This can be any of: SSLv2 (only use SSLv2), SSLv2+ (use any version),
+# SSLv3 (only use SSLv3), SSLv3+ (use SSLv3 or above), TLSv1 (only use
+# TLSv1), TLSv1+ (use TLSv1 or above), TLSv1.1 (only use TLSv1.1),
+# TLSv1.1+ (use TLSv1.1 or above), TLSv1.2 (only use TLSv1.2),
+# TLSv1.2+ (use TLSv1.2 or above)
+# If an "or above" version is used, the best will be negotiated. So if both
+# ends are able to do TLSv1.2 and use specify SSLv2, you will get TLSv1.2.
+# If you are using openssl 1.1.0 or above, the SSLv2 options are not available.
+
+#ssl_version=SSLv2+
+
+# SSL USE ADH
+# This is for backward compatibility and is DEPRECATED. Set to 1 to enable
+# ADH or 2 to require ADH. 1 is currently the default but will be changed
+# in a later version.
+
+#ssl_use_adh=1
+
+# SSL CIPHER LIST
+# This lists which ciphers can be used. For backward compatibility, this
+# defaults to 'ssl_cipher_list=ALL:!MD5:@STRENGTH' for < OpenSSL 1.1.0,
+# and 'ssl_cipher_list=ALL:!MD5:@STRENGTH:@SECLEVEL=0' for OpenSSL 1.1.0 and
+# greater.
+
+#ssl_cipher_list=ALL:!MD5:@STRENGTH
+#ssl_cipher_list=ALL:!MD5:@STRENGTH:@SECLEVEL=0
+#ssl_cipher_list=ALL:!aNULL:!eNULL:!SSLv2:!LOW:!EXP:!RC4:!MD5:@STRENGTH
+
+# SSL Certificate and Private Key Files
+
+#ssl_cacert_file=/etc/ssl/servercerts/ca-cert.pem
+#ssl_cert_file=/etc/ssl/servercerts/nagios-cert.pem
+#ssl_privatekey_file=/etc/ssl/servercerts/nagios-key.pem
+
+# SSL USE CLIENT CERTS
+# This options determines client certificate usage.
+# Values: 0 = Don't ask for or require client certificates (default)
+# 1 = Ask for client certificates
+# 2 = Require client certificates
+
+#ssl_client_certs=0
+
+# SSL LOGGING
+# This option determines which SSL messages are send to syslog. OR values
+# together to specify multiple options.
+
+# Values: 0x00 (0) = No additional logging (default)
+# 0x01 (1) = Log startup SSL/TLS parameters
+# 0x02 (2) = Log remote IP address
+# 0x04 (4) = Log SSL/TLS version of connections
+# 0x08 (8) = Log which cipher is being used for the connection
+# 0x10 (16) = Log if client has a certificate
+# 0x20 (32) = Log details of client's certificate if it has one
+# -1 or 0xff or 0x2f = All of the above
+
+#ssl_logging=0x00
+
+
+
+# NASTY METACHARACTERS
+# This option allows you to override the list of characters that cannot
+# be passed to the NRPE daemon.
+
+# nasty_metachars="|`&><'\\[]{};\r\n"
+
+
+
+# COMMAND DEFINITIONS
+# Command definitions that this daemon will run. Definitions
+# are in the following format:
+#
+# command[<command_name>]=<command_line>
+#
+# When the daemon receives a request to return the results of <command_name>
+# it will execute the command specified by the <command_line> argument.
+#
+# Unlike Nagios, the command line cannot contain macros - it must be
+# typed exactly as it should be executed.
+#
+# Note: Any plugins that are used in the command lines must reside
+# on the machine that this daemon is running on! The examples below
+# assume that you have plugins installed in a /usr/local/nagios/libexec
+# directory. Also note that you will have to modify the definitions below
+# to match the argument format the plugins expect. Remember, these are
+# examples only!
+
+
+# The following examples use hardcoded command arguments...
+# This is by far the most secure method of using NRPE
+
+command[check_users]=@pluginsdir@/check_users -w 5 -c 10
+command[check_load]=@pluginsdir@/check_load -r -w .15,.10,.05 -c .30,.25,.20
+command[check_hda1]=@pluginsdir@/check_disk -w 20% -c 10% -p /dev/hda1
+command[check_zombie_procs]=@pluginsdir@/check_procs -w 5 -c 10 -s Z
+command[check_total_procs]=@pluginsdir@/check_procs -w 150 -c 200
+
+
+# The following examples allow user-supplied arguments and can
+# only be used if the NRPE daemon was compiled with support for
+# command arguments *AND* the dont_blame_nrpe directive in this
+# config file is set to '1'. This poses a potential security risk, so
+# make sure you read the SECURITY file before doing this.
+
+### MISC SYSTEM METRICS ###
+#command[check_users]=@pluginsdir@/check_users $ARG1$
+#command[check_load]=@pluginsdir@/check_load $ARG1$
+#command[check_disk]=@pluginsdir@/check_disk $ARG1$
+#command[check_swap]=@pluginsdir@/check_swap $ARG1$
+#command[check_cpu_stats]=@pluginsdir@/check_cpu_stats.sh $ARG1$
+#command[check_mem]=@pluginsdir@/custom_check_mem -n $ARG1$
+
+### GENERIC SERVICES ###
+#command[check_init_service]=sudo @pluginsdir@/check_init_service $ARG1$
+#command[check_services]=@pluginsdir@/check_services -p $ARG1$
+
+### SYSTEM UPDATES ###
+#command[check_yum]=@pluginsdir@/check_yum
+#command[check_apt]=@pluginsdir@/check_apt
+
+### PROCESSES ###
+#command[check_all_procs]=@pluginsdir@/custom_check_procs
+#command[check_procs]=@pluginsdir@/check_procs $ARG1$
+
+### OPEN FILES ###
+#command[check_open_files]=@pluginsdir@/check_open_files.pl $ARG1$
+
+### NETWORK CONNECTIONS ###
+#command[check_netstat]=@pluginsdir@/check_netstat.pl -p $ARG1$ $ARG2$
+
+### ASTERISK ###
+#command[check_asterisk]=@pluginsdir@/check_asterisk.pl $ARG1$
+#command[check_sip]=@pluginsdir@/check_sip $ARG1$
+#command[check_asterisk_sip_peers]=sudo @pluginsdir@/check_asterisk_sip_peers.sh $ARG1$
+#command[check_asterisk_version]=@pluginsdir@/nagisk.pl -c version
+#command[check_asterisk_peers]=@pluginsdir@/nagisk.pl -c peers
+#command[check_asterisk_channels]=@pluginsdir@/nagisk.pl -c channels
+#command[check_asterisk_zaptel]=@pluginsdir@/nagisk.pl -c zaptel
+#command[check_asterisk_span]=@pluginsdir@/nagisk.pl -c span -s 1
+
+
+
+# INCLUDE CONFIG FILE
+# This directive allows you to include definitions from an external config file.
+
+#include=<somefile.cfg>
+
+
+
+# INCLUDE CONFIG DIRECTORY
+# This directive allows you to include definitions from config files (with a
+# .cfg extension) in one or more directories (with recursion).
+
+#include_dir=<somedirectory>
+#include_dir=<someotherdirectory>
diff --git a/src/Makefile.in b/src/Makefile.in
new file mode 100644
index 0000000..ba0d381
--- /dev/null
+++ b/src/Makefile.in
@@ -0,0 +1,87 @@
+###############################
+#
+# NRPE Makefile
+#
+###############################
+
+srcdir=@srcdir@
+
+# Source code directories
+SRC_INCLUDE=@srcdir@/../include
+CFG_INCLUDE=../include
+
+# Mainly used for rpmbuild
+# DESTDIR=
+
+CC=@CC@
+CFLAGS=@CFLAGS@ @DEFS@ -I $(CFG_INCLUDE) -I $(SRC_INCLUDE)
+LDFLAGS=@LDFLAGS@ @LIBS@
+SOCKETLIBS=@SOCKETLIBS@
+LIBWRAPLIBS=@LIBWRAPLIBS@
+OTHERLIBS=@OTHERLIBS@
+
+CP=@CP@
+
+prefix=$(DESTDIR)@prefix@
+exec_prefix=$(DESTDIR)@exec_prefix@
+CFGDIR=$(DESTDIR)@pkgsysconfdir@
+BINDIR=$(DESTDIR)@bindir@
+SBINDIR=$(DESTDIR)@sbindir@
+LIBEXECDIR=$(DESTDIR)@libexecdir@
+INSTALL=@INSTALL@
+NAGIOS_INSTALL_OPTS=@NAGIOS_INSTALL_OPTS@
+NRPE_INSTALL_OPTS=@NRPE_INSTALL_OPTS@
+
+PLUGINSDIR=$(DESTDIR)@pluginsdir@
+PIDDIR=$(DESTDIR)@piddir@
+TMPFILESDIR=$(DESTDIR)@tmpfilesd@
+SRC_TMPFILE=@src_tmpfile@
+
+
+# Generated automatically from configure script
+SNPRINTF_O=@SNPRINTF_O@
+
+
+all: nrpe check_nrpe
+
+nrpe: $(srcdir)/nrpe.c $(srcdir)/utils.c $(srcdir)/acl.c $(SRC_INCLUDE)/nrpe.h $(SRC_INCLUDE)/utils.h $(SRC_INCLUDE)/common.h $(CFG_INCLUDE)/config.h $(SRC_INCLUDE)/acl.h $(SNPRINTF_O)
+ $(CC) $(CFLAGS) -o $@ $(srcdir)/nrpe.c $(srcdir)/utils.c $(srcdir)/acl.c $(LDFLAGS) $(SOCKETLIBS) $(LIBWRAPLIBS) $(SNPRINTF_O) $(OTHERLIBS)
+
+check_nrpe: $(srcdir)/check_nrpe.c $(srcdir)/utils.c $(SRC_INCLUDE)/utils.h $(SRC_INCLUDE)/common.h $(CFG_INCLUDE)/config.h
+ $(CC) $(CFLAGS) -o $@ $(srcdir)/check_nrpe.c $(srcdir)/utils.c $(LDFLAGS) $(SOCKETLIBS) $(SNPRINTF_O) $(OTHERLIBS)
+
+install:
+ $(MAKE) install-plugin
+ $(MAKE) install-daemon
+
+install-plugin: install-uninstall
+ $(INSTALL) -m 775 $(NAGIOS_INSTALL_OPTS) -d $(LIBEXECDIR)
+ $(INSTALL) -m 775 $(NAGIOS_INSTALL_OPTS) -d $(PLUGINSDIR)
+ $(INSTALL) -m 775 $(NAGIOS_INSTALL_OPTS) check_nrpe $(PLUGINSDIR)
+
+install-daemon: install-uninstall
+ $(INSTALL) -m 755 nrpe $(SBINDIR)
+ @if test ! -d "$(PIDDIR)" ; then \
+ echo $(INSTALL) -m 755 $(NRPE_INSTALL_OPTS) -d $(PIDDIR); \
+ $(INSTALL) -m 755 $(NRPE_INSTALL_OPTS) -d $(PIDDIR); \
+ fi
+ @if test "$(TMPFILESDIR)" != "N/A" -a x$(SRC_TMPFILE) != x ; then \
+ echo $(INSTALL) -m 755 -d `dirname $(TMPFILESDIR)`; \
+ $(INSTALL) -m 755 -d `dirname $(TMPFILESDIR)`; \
+ echo $(INSTALL) -m 644 ../startup/$(SRC_TMPFILE) $(TMPFILESDIR); \
+ $(INSTALL) -m 644 ../startup/$(SRC_TMPFILE) $(TMPFILESDIR); \
+ fi
+
+install-uninstall:
+ $(INSTALL) -m 755 -d $(SBINDIR)
+ $(INSTALL) -m 755 ../uninstall $(SBINDIR)/nrpe-uninstall
+
+clean:
+ rm -f core nrpe check_nrpe $(SNPRINTF_O)
+ rm -f *~ */*~
+ rm -rf nrpe.dSYM check_nrpe.dSYM
+
+distclean: clean
+ rm -f Makefile
+
+devclean: distclean
diff --git a/src/acl.c b/src/acl.c
new file mode 100644
index 0000000..f38c321
--- /dev/null
+++ b/src/acl.c
@@ -0,0 +1,705 @@
+/****************************************************************************
+ *
+ * acl.c - a small library for nrpe.c. It adds IPv4 subnets support to ACL in nrpe.
+ *
+ * License: GPLv2
+ * Copyright (c) 2011 Kaspersky Lab ZAO
+ *
+ * Description:
+ *
+ * acl.c creates two linked lists. One is for IPv4 hosts and networks, another
+ * is for domain names. All connecting hosts (if allowed_hosts is defined)
+ * are checked in these two lists.
+ *
+ * Note:
+ * Only ANCII names are supported in ACL.
+ *
+ * License Notice:
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ ****************************************************************************/
+
+#include "../include/config.h"
+#include "../include/common.h"
+#include "../include/utils.h"
+
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <netdb.h>
+#include <stdarg.h>
+
+#include "../include/acl.h"
+
+extern int debug;
+
+/* This function checks if a char argument from valid char range.
+ * Valid range is: ASCII only, a number or a letter, a space, a dot, a slash, a dash, a comma.
+ *
+ * Returns:
+ * 0 - char isn't from valid group
+ * 1 - char is a number
+ * 2 - char is a letter
+ * 3 - char is a space(' ')
+ * 4 - char is a dot('.')
+ * 5 - char is a slash('/')
+ * 6 - char is a dash('-')
+ * 7 - char is a comma(',')
+ */
+
+int isvalidchar(int c) {
+ if (!isascii(c))
+ return 0;
+
+ if (isdigit(c))
+ return 1;
+
+ if (isalpha(c))
+ return 2;
+
+ if (isspace(c))
+ return 3;
+
+ switch (c) {
+ case '.':
+ return 4;
+ case '/':
+ return 5;
+ case '-':
+ return 6;
+ case ',':
+ return 7;
+ default:
+ return 0;
+ }
+}
+
+/*
+ * Get substring from allowed_hosts from s position to e position.
+ */
+
+char * acl_substring(char *string, int s, int e) {
+ char *substring;
+ int len = e - s;
+
+ if (len < 0)
+ return NULL;
+
+ if ( (substring = malloc(len + 1)) == NULL)
+ return NULL;
+
+ memmove(substring, string + s, len + 1);
+ return substring;
+}
+
+/*
+ * Add IPv4 host or network to IP ACL. IPv4 format is X.X.X.X[/X].
+ * Host will be added to ACL only if it has passed IPv4 format check.
+ *
+ * Returns:
+ * 1 - on success
+ * 0 - on failure
+ *
+ * States for IPv4 format check:
+ * 0 - numbers(-> 1), dot(-> -1), slash(-> -1), other(-> -1)
+ * 1 - numbers(-> 1), dot(-> 2), slash(-> -1), other(-> -1)
+ * 2 - numbers(-> 3), dot(-> -1), slash(-> -1), other(-> -1)
+ * 3 - numbers(-> 3), dot(-> 4), slash(-> -1), other(-> -1)
+ * 4 - numbers(-> 5), dot(-> -1), slash(-> -1), other(-> -1)
+ * 5 - numbers(-> 5), dot(-> 6), slash(-> -1), other(-> -1)
+ * 6 - numbers(-> 7), dot(-> -1), slash(-> -1), other(-> -1)
+ * 7 - numbers(-> 7), dor(-> -1), slash(-> 8), other(-> -1)
+ * 8 - numbers(-> 9), dor(-> -1), slash(-> -1), other(-> -1)
+ * 9 - numbers(-> 9), dot(-> -1), slash(-> -1), other(-> -1)
+ *
+ * Good states are 7(IPv4 host) and 9(IPv4 network)
+ */
+
+int add_ipv4_to_acl(char *ipv4) {
+
+ int state = 0;
+ int octet = 0;
+ int index = 0; /* position in data array */
+ int data[5]; /* array to store ip octets and mask */
+ int len = strlen(ipv4);
+ int i, c;
+ unsigned long ip, mask;
+ struct ip_acl *ip_acl_curr;
+
+ if(debug == TRUE)
+ logit(LOG_INFO, "add_ipv4_to_acl: checking ip-address >%s<", ipv4);
+
+ /* Check for min and max IPv4 valid length */
+ if (len < 7 || len > 18) {
+ logit(LOG_INFO, "add_ipv4_to_acl: Error, ip-address >%s< incorrect length", ipv4);
+ return 0;
+ }
+
+ /* default mask for ipv4 */
+ data[4] = 32;
+
+ /* Basic IPv4 format check */
+ for (i = 0; i < len; i++) {
+ /* Return 0 on error state */
+ if (state == -1) {
+ if(debug == TRUE)
+ logit(LOG_INFO, "add_ipv4_to_acl: Error, ip-address >%s< incorrect "
+ "format, continue with next check ...", ipv4);
+ return 0;
+ }
+
+ c = ipv4[i];
+
+ switch (c) {
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ octet = octet * 10 + CHAR_TO_NUMBER(c);
+ switch (state) {
+ case 0: case 2: case 4: case 6: case 8:
+ state++;
+ break;
+ }
+ break;
+ case '.':
+ switch (state) {
+ case 1: case 3: case 5:
+ data[index++] = octet;
+ octet = 0;
+ state++;
+ break;
+ default:
+ state = -1;
+ }
+ break;
+ case '/':
+ switch (state) {
+ case 7:
+ data[index++] = octet;
+ octet = 0;
+ state++;
+ break;
+ default:
+ state = -1;
+ }
+ break;
+ default:
+ state = -1;
+ }
+ }
+
+ /* Exit state handling */
+ switch (state) {
+ case 7: case 9:
+ data[index] = octet;
+ break;
+ default:
+ /* Bad states */
+ logit(LOG_INFO, "add_ipv4_to_acl: Error, ip-address >%s< bad state", ipv4);
+ return 0;
+ }
+
+ /*
+ * Final IPv4 format check.
+ */
+ for (i=0; i < 4; i++) {
+ if (data[i] < 0 || data[i] > 255) {
+ logit(LOG_ERR,"Invalid IPv4 address/network format(%s) in allowed_hosts option\n",ipv4);
+ return 0;
+ }
+ }
+
+ if (data[4] < 0 || data[4] > 32) {
+ logit(LOG_ERR,"Invalid IPv4 network mask format(%s) in allowed_hosts option\n",ipv4);
+ return 0;
+ }
+
+ /* Convert ip and mask to unsigned long */
+ ip = htonl((data[0] << 24) + (data[1] << 16) + (data[2] << 8) + data[3]);
+ mask = htonl(-1 << (32 - data[4]));
+
+ /* Wrong network address */
+ if ( (ip & mask) != ip) {
+ logit(LOG_ERR,"IP address and mask do not match in %s\n",ipv4);
+ return 0;
+ }
+
+ /* Add addr to ip_acl list */
+ if ( (ip_acl_curr = malloc(sizeof(*ip_acl_curr))) == NULL) {
+ logit(LOG_ERR,"Can't allocate memory for ACL, malloc error\n");
+ return 0;
+ }
+
+ /* Save result in ACL ip list */
+ ip_acl_curr->family = AF_INET;
+ ip_acl_curr->addr.s_addr = ip;
+ ip_acl_curr->mask.s_addr = mask;
+ ip_acl_curr->next = NULL;
+
+ if (ip_acl_head == NULL) {
+ ip_acl_head = ip_acl_curr;
+ } else {
+ ip_acl_prev->next = ip_acl_curr;
+ }
+ ip_acl_prev = ip_acl_curr;
+
+ if(debug == TRUE)
+ logit(LOG_INFO, "add_ipv4_to_acl: ip-address >%s< correct, adding.", ipv4);
+
+ return 1;
+}
+
+/*
+ * Add IPv6 host or network to IP ACL. Host will be added to ACL only if
+ * it has passed IPv6 format check.
+ *
+ */
+
+int add_ipv6_to_acl(char *ipv6) {
+ char *ipv6tmp;
+ char *addr_part, *mask_part;
+ struct in6_addr addr;
+ struct in6_addr mask;
+ int maskval;
+ int byte, bit;
+ int nbytes = sizeof(mask.s6_addr) / sizeof(mask.s6_addr[0]);
+ int x;
+ struct ip_acl *ip_acl_curr;
+
+ /* Save temporary copy of ipv6 so we can use the original in error
+ messages if needed */
+ ipv6tmp = strdup(ipv6);
+ if(NULL == ipv6tmp) {
+ logit(LOG_ERR, "Memory allocation failed for copy of address: %s\n",
+ ipv6);
+ return 0;
+ }
+
+ addr_part = ipv6tmp;
+ mask_part = strchr(ipv6tmp, '/');
+ if (mask_part) {
+ *mask_part = '\0';
+ ++mask_part;
+ }
+
+ /* Parse the address itself */
+ if(inet_pton(AF_INET6, addr_part, &addr) <= 0) {
+ free(ipv6tmp);
+ return 0;
+ }
+
+ /* Check whether there is a netmask */
+ if (mask_part && *mask_part) {
+ /* If so, build a netmask */
+ /* Get the number of bits in the mask */
+ maskval = atoi(mask_part);
+ if(maskval < 0 || maskval > 128) {
+ free(ipv6tmp);
+ return 0;
+ }
+
+ /* Initialize to zero */
+ for(x = 0; x < nbytes; x++) {
+ mask.s6_addr[x] = 0;
+ }
+
+ /* Set mask based on mask bits */
+ byte = 0;
+ bit = 7;
+ while(maskval > 0) {
+ mask.s6_addr[byte] |= 1 << bit;
+ bit -= 1;
+ if(bit < 0) {
+ bit = 7;
+ byte++;
+ }
+ maskval--;
+ }
+ }
+ else {
+ /* Otherwise, this is a single address */
+ for(x = 0; x < nbytes; x++) {
+ mask.s6_addr[x] = 0xFF;
+ }
+ }
+
+ /* Add address to ip_acl list */
+ ip_acl_curr = malloc(sizeof(*ip_acl_curr));
+ if(NULL == ip_acl_curr) {
+ logit(LOG_ERR, "Memory allocation failed for ACL: %s\n", ipv6);
+ return 0;
+ }
+
+ /* Save result in ACL ip list */
+ ip_acl_curr->family = AF_INET6;
+ for(x = 0; x < nbytes; x++) {
+ ip_acl_curr->addr6.s6_addr[x] =
+ addr.s6_addr[x] & mask.s6_addr[x];
+ ip_acl_curr->mask6.s6_addr[x] = mask.s6_addr[x];
+ }
+ ip_acl_curr->next = NULL;
+
+ if(NULL == ip_acl_head) {
+ ip_acl_head = ip_acl_curr;
+ }
+ else {
+ ip_acl_prev->next = ip_acl_curr;
+ }
+ ip_acl_prev = ip_acl_curr;
+
+ free(ipv6tmp);
+ return 1;
+ }
+
+/*
+ * Add domain to DNS ACL list
+ * Domain will be added only if it has passed domain name check.
+ *
+ * In this case domain valid format is:
+ * 1) Domain names must use only alphanumeric characters and dashes (-).
+ * 2) Domain names mustn't begin or end with dashes (-).
+ * 3) Domain names mustn't have more than 63 characters.
+ *
+ * Return:
+ * 1 - for success
+ * 0 - for failure
+ *
+ * 0 - alpha(-> 1), number(-> 1), dot(-> -1), dash(-> -1), all other(-> -1)
+ * 1 - alpha(-> 1), number(-> 1), dot(-> 2), dash(-> 6), all other(-> -1)
+ * 2 - alpha(-> 3), number(-> 1), dot(-> -1), dash(-> -1), all other(-> -1)
+ * 3 - alpha(-> 4), number(-> 1), dot(-> 2), dash(-> 6), all other(-> -1)
+ * 4 - alpha(-> 5), number(-> 1), dot(-> 2), dash(-> 6), all other(-> -1)
+ * 5 - alpha(-> 1), number(-> 1), dot(-> 2), dash(-> 6), all other(-> -1)
+ * 6 - alpha(-> 1), number(-> 1), dot(-> 2), dash(-> 6), all other(-> -1)
+
+ * For real FQDN only 4 and 5 states are good for exit.
+ * I don't check if top domain exists (com, ru and etc.)
+ * But in real life NRPE could work in LAN,
+ * with local domain zones like .local or with names like 'mars' added to /etc/hosts.
+ * So 1 is good state too. And maybe this check is not necessary at all...
+ */
+
+int add_domain_to_acl(char *domain) {
+ int state = 0;
+ int len = strlen(domain);
+ int i, c;
+
+ struct dns_acl *dns_acl_curr;
+
+ if (len > 63) {
+ logit(LOG_INFO,
+ "ADD_DOMAIN_TO_ACL: Error, did not add >%s< to acl list, too long!",
+ domain);
+ return 0;
+ }
+
+ for (i = 0; i < len; i++) {
+ c = domain[i];
+ switch (isvalidchar(c)) {
+ case 1:
+ state = 1;
+ break;
+ case 2:
+ switch (state) {
+ case 0: case 1: case 5: case 6:
+ state = 1;
+ break;
+ case 2: case 3: case 4:
+ state++;
+ break;
+ }
+ break;
+
+ case 4:
+ switch (state) {
+ case 0: case 2:
+ state = -1;
+ break;
+ default:
+ state = 2;
+ }
+ break;
+ case 6:
+ switch (state) {
+ case 0: case 2:
+ state = -1;
+ break;
+ default:
+ state = 6;
+ }
+ break;
+ default:
+ logit(LOG_INFO,
+ "ADD_DOMAIN_TO_ACL: Error, did not add >%s< to acl list, "
+ "invalid chars!", domain);
+ /* Not valid chars */
+ return 0;
+ }
+ }
+
+ /* Check exit code */
+ switch (state) {
+ case 1: case 4: case 5:
+ /* Add name to domain ACL list */
+ if ( (dns_acl_curr = malloc(sizeof(*dns_acl_curr))) == NULL) {
+ logit(LOG_ERR,"Can't allocate memory for ACL, malloc error\n");
+ return 0;
+ }
+ strcpy(dns_acl_curr->domain, domain);
+ dns_acl_curr->next = NULL;
+
+ if (dns_acl_head == NULL)
+ dns_acl_head = dns_acl_curr;
+ else
+ dns_acl_prev->next = dns_acl_curr;
+
+ dns_acl_prev = dns_acl_curr;
+ if(debug == TRUE)
+ logit(LOG_INFO, "ADD_DOMAIN_TO_ACL: added >%s< to acl list!", domain);
+ return 1;
+ default:
+ logit(LOG_INFO,
+ "ADD_DOMAIN_TO_ACL: ERROR, did not add >%s< to acl list, "
+ "check allowed_host in config file!", domain);
+ return 0;
+ }
+}
+
+/* Checks connection host in ACL
+ *
+ * Returns:
+ * 1 - on success
+ * 0 - on failure
+ */
+
+int is_an_allowed_host(int family, void *host)
+{
+ struct ip_acl *ip_acl_curr = ip_acl_head;
+ int nbytes;
+ int x;
+ struct dns_acl *dns_acl_curr = dns_acl_head;
+ struct sockaddr_in *addr;
+ struct sockaddr_in6 addr6;
+ struct addrinfo *res, *ai;
+ struct in_addr tmp;
+
+ while (ip_acl_curr != NULL) {
+ if(ip_acl_curr->family == family) {
+ switch(ip_acl_curr->family) {
+ case AF_INET:
+ if (debug == TRUE) {
+ tmp.s_addr = ((struct in_addr*)host)->s_addr;
+ logit(LOG_INFO, "is_an_allowed_host (AF_INET): is host >%s< "
+ "an allowed host >%s<\n",
+ inet_ntoa(tmp), inet_ntoa(ip_acl_curr->addr));
+ }
+ if((((struct in_addr *)host)->s_addr &
+ ip_acl_curr->mask.s_addr) ==
+ ip_acl_curr->addr.s_addr) {
+ if (debug == TRUE)
+ logit(LOG_INFO, "is_an_allowed_host (AF_INET): host is in allowed host list!");
+ return 1;
+ }
+ break;
+ case AF_INET6:
+ nbytes = sizeof(ip_acl_curr->mask6.s6_addr) /
+ sizeof(ip_acl_curr->mask6.s6_addr[0]);
+ for(x = 0; x < nbytes; x++) {
+ if((((struct in6_addr *)host)->s6_addr[x] &
+ ip_acl_curr->mask6.s6_addr[x]) !=
+ ip_acl_curr->addr6.s6_addr[x]) {
+ break;
+ }
+ }
+ if(x == nbytes) {
+ /* All bytes in host's address pass the netmask mask */
+ return 1;
+ }
+ break;
+ }
+ }
+ ip_acl_curr = ip_acl_curr->next;
+ }
+
+ while(dns_acl_curr != NULL) {
+ if (!getaddrinfo(dns_acl_curr->domain, NULL, NULL, &res)) {
+
+ for (ai = res; ai; ai = ai->ai_next) {
+
+ switch(ai->ai_family) {
+
+ case AF_INET:
+ if(debug == TRUE) {
+ tmp.s_addr=((struct in_addr *)host)->s_addr;
+ logit(LOG_INFO, "is_an_allowed_host (AF_INET): is host >%s< "
+ "an allowed host >%s<\n",
+ inet_ntoa(tmp), dns_acl_curr->domain);
+ }
+
+ addr = (struct sockaddr_in*)(ai->ai_addr);
+ if (addr->sin_addr.s_addr == ((struct in_addr*)host)->s_addr) {
+ if (debug == TRUE)
+ logit(LOG_INFO, "is_an_allowed_host (AF_INET): "
+ "host is in allowed host list!");
+ return 1;
+ }
+ break;
+
+ case AF_INET6:
+ memcpy((char*)&addr6, ai->ai_addr, sizeof(addr6));
+ if (!memcmp(&addr6.sin6_addr, &host, sizeof(addr6.sin6_addr)))
+ return 1;
+ break;
+ }
+ }
+ }
+
+ dns_acl_curr = dns_acl_curr->next;
+ }
+ return 0;
+}
+
+/* The trim() function takes a source string and copies it to the destination string,
+ * stripped of leading and training whitespace. The destination string must be
+ * allocated at least as large as the source string.
+ */
+
+void trim( char *src, char *dest) {
+ char *sptr, *dptr;
+
+ for( sptr = src; isspace( *sptr) && *sptr; sptr++); /* Jump past leading spaces */
+ for( dptr = dest; !isspace( *sptr) && *sptr; ) {
+ *dptr = *sptr;
+ sptr++;
+ dptr++;
+ }
+ *dptr = '\0';
+ return;
+}
+
+/* This function splits allowed_hosts to substrings with comma(,) as a delimiter.
+ * It doesn't check validness of ACL record (add_ipv4_to_acl() and add_domain_to_acl() do),
+ * just trims spaces from ACL records.
+ * After this it sends ACL records to add_ipv4_to_acl() or add_domain_to_acl().
+ */
+
+void parse_allowed_hosts(char *allowed_hosts) {
+ char *hosts = strdup( allowed_hosts); /* Copy since strtok* modifies original */
+ char *saveptr;
+ char *tok;
+ const char *delim = ",";
+ char *trimmed_tok;
+ int add_to_acl = 0;
+
+ if (debug == TRUE)
+ logit(LOG_INFO,
+ "parse_allowed_hosts: parsing the allowed host string >%s< to add to ACL list\n",
+ allowed_hosts);
+
+#ifdef HAVE_STRTOK_R
+ tok = strtok_r(hosts, delim, &saveptr);
+#else
+ if (debug == TRUE)
+ logit(LOG_INFO,"parse_allowed_hosts: using strtok, this might lead to "
+ "problems in the allowed_hosts string determination!\n");
+ tok = strtok(hosts, delim);
+#endif
+ while( tok) {
+ trimmed_tok = malloc(sizeof(char) * (strlen(tok) + 1));
+ trim(tok, trimmed_tok);
+ if (debug == TRUE)
+ logit(LOG_DEBUG, "parse_allowed_hosts: ADDING this record (%s) to ACL list!\n", trimmed_tok);
+ if (strlen(trimmed_tok) > 0) {
+
+ /* lets check the type of the address before we try and add it to the acl */
+
+ if (strchr(trimmed_tok, ':') != NULL) {
+
+ /* its an ipv6 address */
+ add_to_acl = add_ipv6_to_acl(trimmed_tok);
+
+ } else {
+
+ /* its either a fqdn or an ipv4 address
+ unfortunately, i don't want to re-invent the wheel here
+ the logic exists inside of add_ipv4_to_acl() to detect
+ whether or not it is a ip or not */
+ add_to_acl = add_ipv4_to_acl(trimmed_tok);
+ }
+
+ /* but we only try to add it to a domain if the other tests have failed */
+ if (!add_to_acl && !add_domain_to_acl(trimmed_tok)) {
+ logit(LOG_ERR,"Can't add to ACL this record (%s). Check allowed_hosts option!\n",trimmed_tok);
+ } else if (debug == TRUE)
+ logit(LOG_DEBUG,"parse_allowed_hosts: Record added to ACL list!\n");
+ }
+ free( trimmed_tok);
+#ifdef HAVE_STRTOK_R
+ tok = strtok_r(NULL, delim, &saveptr);
+#else
+ tok = strtok(NULL, delim);
+#endif
+ }
+
+ free( hosts);
+}
+
+/*
+ * Converts mask in unsigned long format to two digit prefix
+ */
+
+unsigned int prefix_from_mask(struct in_addr mask) {
+ int prefix = 0;
+ unsigned long bit = 1;
+ int i;
+
+ for (i = 0; i < 32; i++) {
+ if (mask.s_addr & bit)
+ prefix++;
+
+ bit = bit << 1;
+ }
+ return (prefix);
+}
+
+/*
+ * It shows all hosts in ACL lists
+ */
+
+void show_acl_lists(void)
+{
+ struct ip_acl *ip_acl_curr = ip_acl_head;
+ struct dns_acl *dns_acl_curr = dns_acl_head;
+
+ logit(LOG_INFO, "Showing ACL lists for both IP and DOMAIN acl's:\n" );
+
+ while (ip_acl_curr != NULL) {
+ logit(LOG_INFO, " IP ACL: %s/%u %u\n", inet_ntoa(ip_acl_curr->addr),
+ prefix_from_mask(ip_acl_curr->mask), ip_acl_curr->addr.s_addr);
+ ip_acl_curr = ip_acl_curr->next;
+ }
+
+ while (dns_acl_curr != NULL) {
+ logit(LOG_INFO, " DNS ACL: %s\n", dns_acl_curr->domain);
+ dns_acl_curr = dns_acl_curr->next;
+ }
+}
diff --git a/src/check_nrpe.c b/src/check_nrpe.c
new file mode 100644
index 0000000..ace7041
--- /dev/null
+++ b/src/check_nrpe.c
@@ -0,0 +1,1633 @@
+/****************************************************************************
+ *
+ * check_nrpe.c - NRPE Plugin For Nagios
+ *
+ * License: GPLv2
+ * Copyright (c) 2009-2017 Nagios Enterprises
+ * 1999-2008 Ethan Galstad (nagios@nagios.org)
+ *
+ * Command line:
+ *
+ * check_nrpe -H <host_address> [-p port] [-c command] [-to to_sec]
+ *
+ * Description:
+ *
+ * This plugin will attempt to connect to the NRPE daemon on the specified
+ * server and port. The daemon will attempt to run the command
+ * defined as [command]. Program output and return code are sent back
+ * from the daemon and displayed as this plugin's own
+ * output and return code.
+ *
+ * License Notice:
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ ****************************************************************************/
+
+#include "config.h"
+#include "common.h"
+#include "utils.h"
+
+#define DEFAULT_NRPE_COMMAND "_NRPE_CHECK" /* check version of NRPE daemon */
+
+u_short server_port = 0;
+char *server_name = NULL;
+char *bind_address = NULL;
+char *config_file = NULL;
+#ifdef HAVE_STRUCT_SOCKADDR_STORAGE
+struct sockaddr_storage hostaddr;
+#else
+struct sockaddr hostaddr;
+#endif
+int address_family = AF_UNSPEC;
+char *command_name = NULL;
+int socket_timeout = DEFAULT_SOCKET_TIMEOUT;
+char timeout_txt[10];
+int timeout_return_code = -1;
+int stderr_to_stdout = 0;
+int sd;
+
+char rem_host[MAX_HOST_ADDRESS_LENGTH];
+char query[MAX_INPUT_BUFFER] = "";
+
+int show_help = FALSE;
+int show_license = FALSE;
+int show_version = FALSE;
+int packet_ver = NRPE_PACKET_VERSION_3;
+int force_v2_packet = 0;
+int payload_size = 0;
+extern char *log_file;
+
+#ifdef HAVE_SSL
+# if (defined(__sun) && defined(SOLARIS_10)) || defined(_AIX) || defined(__hpux)
+SSL_METHOD *meth;
+# else
+const SSL_METHOD *meth;
+# endif
+SSL_CTX *ctx;
+SSL *ssl;
+int use_ssl = TRUE;
+unsigned long ssl_opts = SSL_OP_ALL;
+#else
+int use_ssl = FALSE;
+#endif
+
+/* SSL/TLS parameters */
+typedef enum _SSL_VER {
+ SSL_Ver_Invalid = 0, SSLv2 = 1, SSLv2_plus, SSLv3, SSLv3_plus,
+ TLSv1, TLSv1_plus, TLSv1_1, TLSv1_1_plus, TLSv1_2, TLSv1_2_plus
+} SslVer;
+
+typedef enum _CLNT_CERTS { Ask_For_Cert = 1, Require_Cert = 2 } ClntCerts;
+
+typedef enum _SSL_LOGGING {
+ SSL_NoLogging = 0, SSL_LogStartup = 1, SSL_LogIpAddr = 2,
+ SSL_LogVersion = 4, SSL_LogCipher = 8, SSL_LogIfClientCert = 16,
+ SSL_LogCertDetails = 32,
+} SslLogging;
+
+struct _SSL_PARMS {
+ char *cert_file;
+ char *cacert_file;
+ char *privatekey_file;
+ char cipher_list[MAX_FILENAME_LENGTH];
+ SslVer ssl_proto_ver;
+ int allowDH;
+ ClntCerts client_certs;
+ SslLogging log_opts;
+} sslprm = {
+NULL, NULL, NULL, "", SSL_Ver_Invalid, -1, 0, SSL_NoLogging};
+int have_log_opts = FALSE;
+
+int process_arguments(int, char **, int);
+int read_config_file(char *);
+const char *state_text (int result);
+int translate_state (char *state_text);
+void set_timeout_state (char *state);
+int parse_timeout_string (char *timeout_str);
+void usage(int result);
+void setup_ssl();
+void set_sig_handlers();
+int connect_to_remote();
+int send_request();
+int read_response();
+int read_packet(int sock, void *ssl_ptr, v2_packet ** v2_pkt, v3_packet ** v3_pkt);
+#ifdef HAVE_SSL
+static int verify_callback(int ok, X509_STORE_CTX * ctx);
+#endif
+void alarm_handler(int);
+int graceful_close(int, int);
+
+int main(int argc, char **argv)
+{
+ int16_t result;
+
+ result = process_arguments(argc, argv, 0);
+
+ if (result != OK || show_help == TRUE || show_license == TRUE || show_version == TRUE)
+ usage(result); /* usage() will call exit() */
+
+ snprintf(timeout_txt, sizeof(timeout_txt), "%d", socket_timeout);
+
+ if (server_port == 0)
+ server_port = DEFAULT_SERVER_PORT;
+ if (socket_timeout == -1)
+ socket_timeout = DEFAULT_SOCKET_TIMEOUT;
+ if (timeout_return_code == -1)
+ timeout_return_code = STATE_CRITICAL;
+ if (sslprm.cipher_list[0] == '\0')
+#if OPENSSL_VERSION_NUMBER >= 0x10100000
+ strncpy(sslprm.cipher_list, "ALL:!MD5:@STRENGTH:@SECLEVEL=0", MAX_FILENAME_LENGTH - 1);
+#else
+ strncpy(sslprm.cipher_list, "ALL:!MD5:@STRENGTH", MAX_FILENAME_LENGTH - 1);
+#endif
+ if (sslprm.ssl_proto_ver == SSL_Ver_Invalid)
+ sslprm.ssl_proto_ver = TLSv1_plus;
+ if (sslprm.allowDH == -1)
+ sslprm.allowDH = TRUE;
+
+ generate_crc32_table(); /* generate the CRC 32 table */
+ setup_ssl(); /* Do all the SSL/TLS set up */
+ set_sig_handlers(); /* initialize alarm signal handling */
+ result = connect_to_remote(); /* Make the connection */
+ if (result != STATE_OK) {
+ alarm(0);
+ return result;
+ }
+
+ result = send_request(); /* Send the request */
+ if (result != STATE_OK)
+ return result;
+
+ result = read_response(); /* Get the response */
+
+ if (result == -1) {
+ /* Failure reading from remote, so try version 2 packet */
+ logit(LOG_INFO, "Remote %s does not support Version 3 Packets", rem_host);
+ packet_ver = NRPE_PACKET_VERSION_2;
+
+ /* Rerun the setup */
+ setup_ssl();
+ set_sig_handlers();
+ result = connect_to_remote(); /* Connect */
+ if (result != STATE_OK) {
+ alarm(0);
+ close_log_file(); /* close the log file */
+ return result;
+ }
+
+ result = send_request(); /* Send the request */
+ if (result != STATE_OK) {
+ close_log_file(); /* close the log file */
+ return result;
+ }
+
+ result = read_response(); /* Get the response */
+ }
+
+ if (result != -1 && force_v2_packet == 0 && packet_ver == NRPE_PACKET_VERSION_2)
+ logit(LOG_DEBUG, "Remote %s accepted a Version %d Packet", rem_host, packet_ver);
+
+ close_log_file(); /* close the log file */
+ return result;
+}
+
+/* process command line arguments */
+int process_arguments(int argc, char **argv, int from_config_file)
+{
+ char optchars[MAX_INPUT_BUFFER];
+ int argindex = 0;
+ int c = 1;
+ int i = 1;
+ int has_cert = 0, has_priv_key = 0, rc;
+
+#ifdef HAVE_GETOPT_LONG
+ int option_index = 0;
+ static struct option long_options[] = {
+ {"host", required_argument, 0, 'H'},
+ {"config-file", required_argument, 0, 'f'},
+ {"bind", required_argument, 0, 'b'},
+ {"command", required_argument, 0, 'c'},
+ {"args", required_argument, 0, 'a'},
+ {"no-ssl", no_argument, 0, 'n'},
+ {"unknown-timeout", no_argument, 0, 'u'},
+ {"v2-packets-only", no_argument, 0, '2'},
+ {"ipv4", no_argument, 0, '4'},
+ {"ipv6", no_argument, 0, '6'},
+ {"use-adh", required_argument, 0, 'd'},
+ {"ssl-version", required_argument, 0, 'S'},
+ {"cipher-list", required_argument, 0, 'L'},
+ {"client-cert", required_argument, 0, 'C'},
+ {"key-file", required_argument, 0, 'K'},
+ {"ca-cert-file", required_argument, 0, 'A'},
+ {"ssl-logging", required_argument, 0, 's'},
+ {"timeout", required_argument, 0, 't'},
+ {"port", required_argument, 0, 'p'},
+ {"payload-size", required_argument, 0, 'P'},
+ {"log-file", required_argument, 0, 'g'},
+ {"help", no_argument, 0, 'h'},
+ {"license", no_argument, 0, 'l'},
+ {"version", no_argument, 0, 'V'},
+ {"stderr-to-stdout", no_argument, 0, 'E'},
+ {0, 0, 0, 0}
+ };
+#endif
+
+ /* no options were supplied */
+ if (argc < 2)
+ return ERROR;
+
+ optind = 0;
+ snprintf(optchars, MAX_INPUT_BUFFER, "H:f:b:c:a:t:p:S:L:C:K:A:d:s:P:g:246hlnuVE");
+
+ while (1) {
+ if (argindex > 0)
+ break;
+#ifdef HAVE_GETOPT_LONG
+ c = getopt_long(argc, argv, optchars, long_options, &option_index);
+#else
+ c = getopt(argc, argv, optchars);
+#endif
+ if (c == -1 || c == EOF)
+ break;
+
+ /* process all arguments */
+ switch (c) {
+
+ case '?':
+ case 'h':
+ show_help = TRUE;
+ break;
+
+ case 'b':
+ bind_address = strdup(optarg);
+ break;
+
+ case 'f':
+ if (from_config_file) {
+ printf("Error: The config file should not have a config-file (-f) option.\n");
+ break;
+ }
+ config_file = strdup(optarg);
+ break;
+
+ case 'V':
+ show_version = TRUE;
+ break;
+
+ case 'l':
+ show_license = TRUE;
+ break;
+
+ case 't':
+ if (from_config_file && socket_timeout != -1) {
+ logit(LOG_WARNING, "WARNING: Command-line socket timeout overrides the config file option.");
+ break;
+ }
+ socket_timeout=parse_timeout_string(optarg);
+ if (socket_timeout <= 0)
+ return ERROR;
+ break;
+
+ case 'p':
+ if (from_config_file && server_port != 0) {
+ logit(LOG_WARNING, "WARNING: Command-line server port overrides the config file option.");
+ break;
+ }
+ server_port = atoi(optarg);
+ if (server_port <= 0)
+ return ERROR;
+ break;
+
+ case 'P':
+ if (from_config_file && payload_size > 0) {
+ logit(LOG_WARNING, "WARNING: Command-line payload-size (-P) overrides the config file option.");
+ break;
+ }
+ payload_size = atoi(optarg);
+ if (payload_size < 0)
+ return ERROR;
+ break;
+
+ case 'H':
+ if (from_config_file && server_name != NULL) {
+ logit(LOG_WARNING, "WARNING: Command-line server name overrides the config file option.");
+ break;
+ }
+ server_name = strdup(optarg);
+ break;
+
+ case 'E':
+ if (from_config_file && stderr_to_stdout != 0) {
+ logit(LOG_WARNING, "WARNING: Command-line stderr redirection overrides the config file option.");
+ break;
+ }
+ stderr_to_stdout = 1;
+ break;
+
+ case 'c':
+ if (from_config_file) {
+ printf("Error: The config file should not have a command (-c) option.\n");
+ return ERROR;
+ }
+ command_name = strdup(optarg);
+ break;
+
+ case 'a':
+ if (from_config_file) {
+ printf("Error: The config file should not have args (-a) arguments.\n");
+ return ERROR;
+ }
+ argindex = optind;
+ break;
+
+ case 'n':
+ use_ssl = FALSE;
+ break;
+
+ case 'u':
+ if (from_config_file && timeout_return_code != -1) {
+ logit(LOG_WARNING, "WARNING: Command-line unknown-timeout (-u) overrides the config file option.");
+ break;
+ }
+ timeout_return_code = STATE_UNKNOWN;
+ break;
+
+ case '2':
+ if (from_config_file && packet_ver != NRPE_PACKET_VERSION_3) {
+ logit(LOG_WARNING, "WARNING: Command-line v2-packets-only (-2) overrides the config file option.");
+ break;
+ }
+ packet_ver = NRPE_PACKET_VERSION_2;
+ force_v2_packet = 1;
+ break;
+
+ case '4':
+ if (from_config_file && address_family != AF_UNSPEC) {
+ logit(LOG_WARNING, "WARNING: Command-line ipv4 (-4) or ipv6 (-6) overrides the config file option.");
+ break;
+ }
+ address_family = AF_INET;
+ break;
+
+ case '6':
+ if (from_config_file && address_family != AF_UNSPEC) {
+ logit(LOG_WARNING, "WARNING: Command-line ipv4 (-4) or ipv6 (-6) overrides the config file option.");
+ break;
+ }
+ address_family = AF_INET6;
+ break;
+
+ case 'd':
+ if (from_config_file && sslprm.allowDH != -1) {
+ logit(LOG_WARNING, "WARNING: Command-line use-adh (-d) overrides the config file option.");
+ break;
+ }
+ if (!optarg || optarg[0] < '0' || optarg[0] > '2')
+ return ERROR;
+ sslprm.allowDH = atoi(optarg);
+ break;
+
+ case 'A':
+ if (from_config_file && sslprm.cacert_file != NULL) {
+ logit(LOG_WARNING, "WARNING: Command-line ca-cert-file (-A) overrides the config file option.");
+ break;
+ }
+ sslprm.cacert_file = strdup(optarg);
+ break;
+
+ case 'C':
+ if (from_config_file && sslprm.cert_file != NULL) {
+ logit(LOG_WARNING, "WARNING: Command-line client-cert (-C) overrides the config file option.");
+ break;
+ }
+ sslprm.cert_file = strdup(optarg);
+ has_cert = 1;
+ break;
+
+ case 'K':
+ if (from_config_file && sslprm.privatekey_file != NULL) {
+ logit(LOG_WARNING, "WARNING: Command-line key-file (-K) overrides the config file option.");
+ break;
+ }
+ sslprm.privatekey_file = strdup(optarg);
+ has_priv_key = 1;
+ break;
+
+ case 'S':
+ if (from_config_file && sslprm.ssl_proto_ver != SSL_Ver_Invalid) {
+ logit(LOG_WARNING, "WARNING: Command-line ssl-version (-S) overrides the config file option.");
+ break;
+ }
+
+ if (!strcmp(optarg, "TLSv1.2"))
+ sslprm.ssl_proto_ver = TLSv1_2;
+ else if (!strcmp(optarg, "TLSv1.2+"))
+ sslprm.ssl_proto_ver = TLSv1_2_plus;
+ else if (!strcmp(optarg, "TLSv1.1"))
+ sslprm.ssl_proto_ver = TLSv1_1;
+ else if (!strcmp(optarg, "TLSv1.1+"))
+ sslprm.ssl_proto_ver = TLSv1_1_plus;
+ else if (!strcmp(optarg, "TLSv1"))
+ sslprm.ssl_proto_ver = TLSv1;
+ else if (!strcmp(optarg, "TLSv1+"))
+ sslprm.ssl_proto_ver = TLSv1_plus;
+ else if (!strcmp(optarg, "SSLv3"))
+ sslprm.ssl_proto_ver = SSLv3;
+ else if (!strcmp(optarg, "SSLv3+"))
+ sslprm.ssl_proto_ver = SSLv3_plus;
+#if OPENSSL_VERSION_NUMBER < 0x10100000
+ else if (!strcmp(optarg, "SSLv2"))
+ sslprm.ssl_proto_ver = SSLv2;
+ else if (!strcmp(optarg, "SSLv2+"))
+ sslprm.ssl_proto_ver = SSLv2_plus;
+#endif /* OPENSSL_VERSION_NUMBER < 0x10100000 */
+ else
+ return ERROR;
+ break;
+
+ case 'L':
+ if (from_config_file && sslprm.cipher_list[0] != '\0') {
+ logit(LOG_WARNING, "WARNING: Command-line cipher-list (-L) overrides the config file option.");
+ break;
+ }
+ strncpy(sslprm.cipher_list, optarg, sizeof(sslprm.cipher_list) - 1);
+ sslprm.cipher_list[sizeof(sslprm.cipher_list) - 1] = '\0';
+ break;
+
+ case 's':
+ if (from_config_file && have_log_opts == TRUE) {
+ logit(LOG_WARNING, "WARNING: Command-line ssl-logging (-s) overrides the config file option.");
+ break;
+ }
+ sslprm.log_opts = strtoul(optarg, NULL, 0);
+ have_log_opts = TRUE;
+ break;
+
+ case 'g':
+ if (from_config_file && log_file != NULL) {
+ logit(LOG_WARNING, "WARNING: Command-line log-file (-g) overrides the config file option.");
+ break;
+ }
+ log_file = strdup(optarg);
+ open_log_file();
+ break;
+
+ default:
+ return ERROR;
+ }
+ }
+
+ /* determine (base) command query */
+ if (!from_config_file) {
+ snprintf(query, sizeof(query), "%s",
+ (command_name == NULL) ? DEFAULT_NRPE_COMMAND : command_name);
+ query[sizeof(query) - 1] = '\x0';
+ }
+
+ /* get the command args */
+ if (!from_config_file && argindex > 0) {
+
+ for (c = argindex - 1; c < argc; c++) {
+
+ i = sizeof(query) - strlen(query) - 2;
+ if (i <= 0)
+ break;
+
+ strcat(query, "!");
+ strncat(query, argv[c], i);
+ query[sizeof(query) - 1] = '\x0';
+ }
+ }
+ if (!from_config_file && config_file != NULL) {
+ if ((rc = read_config_file(config_file)) != OK)
+ return rc;
+ }
+
+ if ((has_cert && !has_priv_key) || (!has_cert && has_priv_key)) {
+ printf("Error: the client certificate and the private key must both be given or neither\n");
+ return ERROR;
+ }
+
+ if (payload_size > 0 && packet_ver != NRPE_PACKET_VERSION_2) {
+ printf("Error: if a fixed payload size is specified, '-2' must also be specified\n");
+ return ERROR;
+ }
+
+ /* make sure required args were supplied */
+ if (server_name == NULL && show_help == FALSE && show_version == FALSE
+ && show_license == FALSE)
+ return ERROR;
+
+ return OK;
+}
+
+int read_config_file(char *fname)
+{
+ int rc, argc = 0;
+ FILE *f;
+ char *buf, *bufp, **argv;
+ char *delims = " \t\r\n";
+ struct stat st;
+ size_t sz;
+
+ if (stat(fname, &st)) {
+ logit(LOG_ERR, "Error: Could not stat config file %s", fname);
+ return ERROR;
+ }
+ if ((f = fopen(fname, "r")) == NULL) {
+ logit(LOG_ERR, "Error: Could not open config file %s", fname);
+ return ERROR;
+ }
+ if ((buf = (char*)calloc(1, st.st_size + 2)) == NULL) {
+ fclose(f);
+ logit(LOG_ERR, "Error: read_config_file fail to allocate memory");
+ return ERROR;
+ }
+ if ((sz = fread(buf, 1, st.st_size, f)) != st.st_size) {
+ fclose(f);
+ free(buf);
+ logit(LOG_ERR, "Error: Failed to completely read config file %s", fname);
+ return ERROR;
+ }
+ if ((argv = calloc(50, sizeof(char*))) == NULL) {
+ fclose(f);
+ free(buf);
+ logit(LOG_ERR, "Error: read_config_file fail to allocate memory");
+ return ERROR;
+ }
+
+ argv[argc++] = "check_nrpe";
+
+ bufp = buf;
+ while (argc < 50) {
+ while (*bufp && strchr(delims, *bufp))
+ ++bufp;
+ if (*bufp == '\0')
+ break;
+ argv[argc] = my_strsep(&bufp, delims);
+ if (!argv[argc++])
+ break;
+ if (!bufp)
+ break;
+ }
+
+ fclose(f);
+
+ if (argc == 50) {
+ free(buf);
+ free(argv);
+ logit(LOG_ERR, "Error: too many parameters in config file %s", fname);
+ return ERROR;
+ }
+
+ rc = process_arguments(argc, argv, 1);
+ free(buf);
+ free(argv);
+ return rc;
+}
+
+const char *state_text (int result)
+{
+ switch (result) {
+ case STATE_OK:
+ return "OK";
+ case STATE_WARNING:
+ return "WARNING";
+ case STATE_CRITICAL:
+ return "CRITICAL";
+ default:
+ return "UNKNOWN";
+ }
+}
+
+int translate_state (char *state_text) {
+ if (!strcasecmp(state_text,"OK") || !strcmp(state_text,"0"))
+ return STATE_OK;
+ if (!strcasecmp(state_text,"WARNING") || !strcmp(state_text,"1"))
+ return STATE_WARNING;
+ if (!strcasecmp(state_text,"CRITICAL") || !strcmp(state_text,"2"))
+ return STATE_CRITICAL;
+ if (!strcasecmp(state_text,"UNKNOWN") || !strcmp(state_text,"3"))
+ return STATE_UNKNOWN;
+ return ERROR;
+}
+
+void set_timeout_state (char *state) {
+ if ((timeout_return_code = translate_state(state)) == ERROR)
+ printf("Timeout state must be a valid state name (OK, WARNING, CRITICAL, UNKNOWN) or integer (0-3).\n");
+}
+
+int parse_timeout_string (char *timeout_str)
+{
+ char *separated_str;
+ char *timeout_val = NULL;
+ char *timeout_sta = NULL;
+
+ if (strstr(timeout_str, ":") == NULL)
+ timeout_val = timeout_str;
+ else if (strncmp(timeout_str, ":", 1) == 0) {
+ separated_str = strtok(timeout_str, ":");
+ if (separated_str != NULL)
+ timeout_sta = separated_str;
+ } else {
+ separated_str = strtok(timeout_str, ":");
+ timeout_val = separated_str;
+ separated_str = strtok(NULL, ":");
+ if (separated_str != NULL) {
+ timeout_sta = separated_str;
+ }
+ }
+
+ if ( timeout_sta != NULL )
+ set_timeout_state(timeout_sta);
+
+ if ((timeout_val == NULL) || (timeout_val[0] == '\0'))
+ return socket_timeout;
+ else if (atoi(timeout_val) > 0)
+ return atoi(timeout_val);
+ else {
+ printf("Timeout value must be a positive integer\n");
+ exit (STATE_UNKNOWN);
+ }
+}
+
+void usage(int result)
+{
+ if (result != OK) {
+ printf("\n");
+ printf("Incorrect command line arguments supplied\n");
+ printf("\n");
+ }
+ printf("NRPE Plugin for Nagios\n");
+ printf("Version: %s\n", PROGRAM_VERSION);
+ printf("\n");
+
+ if (result != OK || show_help == TRUE) {
+ printf("Copyright (c) 2009-2017 Nagios Enterprises\n");
+ printf(" 1999-2008 Ethan Galstad (nagios@nagios.org)\n");
+ printf("\n");
+ printf("Last Modified: %s\n", MODIFICATION_DATE);
+ printf("\n");
+ printf("License: GPL v2 with exemptions (-l for more info)\n");
+ printf("\n");
+#ifdef HAVE_SSL
+ printf("SSL/TLS Available: OpenSSL 0.9.6 or higher required\n");
+ printf("\n");
+#endif
+ printf("Usage: check_nrpe -H <host> [-2] [-4] [-6] [-n] [-u] [-V] [-l] [-d <dhopt>]\n");
+ printf(" [-P <size>] [-S <ssl version>] [-L <cipherlist>] [-C <clientcert>]\n");
+ printf(" [-K <key>] [-A <ca-certificate>] [-s <logopts>] [-b <bindaddr>]\n");
+ printf(" [-f <cfg-file>] [-p <port>] [-t <interval>:<state>] [-g <log-file>]\n");
+ printf(" [-c <command>] [-E] [-a <arglist...>]\n");
+ printf("\n");
+ printf("Options:\n");
+ printf(" -H, --host=HOST The address of the host running the NRPE daemon\n");
+ printf(" -2, --v2-packets-only Only use version 2 packets, not version 3\n");
+ printf(" -4, --ipv4 Bind to ipv4 only\n");
+ printf(" -6, --ipv6 Bind to ipv6 only\n");
+ printf(" -n, --no-ssl Do no use SSL\n");
+ printf(" -u, --unknown-timeout Make connection problems return UNKNOWN instead of CRITICAL\n");
+ printf(" -V, --version Print version info and quit\n");
+ printf(" -l, --license Show license\n");
+ printf(" -E, --stderr-to-stdout Redirect stderr to stdout\n");
+ printf(" -d, --use-dh=DHOPT Anonymous Diffie Hellman use:\n");
+ printf(" 0 Don't use Anonymous Diffie Hellman\n");
+ printf(" (This will be the default in a future release.)\n");
+ printf(" 1 Allow Anonymous Diffie Hellman (default)\n");
+ printf(" 2 Force Anonymous Diffie Hellman\n");
+ printf(" -P, --payload-size=SIZE Specify non-default payload size for NSClient++\n");
+ printf(" -S, --ssl-version=VERSION The SSL/TLS version to use. Can be any one of:\n");
+#if OPENSSL_VERSION_NUMBER < 0x10100000
+ printf(" SSLv2 SSL v2 only\n");
+ printf(" SSLv2+ SSL v2 or above\n");
+#endif
+ printf(" SSLv3 SSL v3 only\n");
+ printf(" SSLv3+ SSL v3 or above \n");
+ printf(" TLSv1 TLS v1 only\n");
+ printf(" TLSv1+ TLS v1 or above (DEFAULT)\n");
+ printf(" TLSv1.1 TLS v1.1 only\n");
+ printf(" TLSv1.1+ TLS v1.1 or above\n");
+ printf(" TLSv1.2 TLS v1.2 only\n");
+ printf(" TLSv1.2+ TLS v1.2 or above\n");
+ printf(" -L, --cipher-list=LIST The list of SSL ciphers to use (currently defaults\n");
+#if OPENSSL_VERSION_NUMBER >= 0x10100000
+ printf(" to \"ALL:!MD5:@STRENGTH:@SECLEVEL=0\". THIS WILL change in a future release.)\n");
+#else
+ printf(" to \"ALL:!MD5:@STRENGTH\". THIS WILL change in a future release.)\n");
+#endif
+ printf(" -C, --client-cert=FILE The client certificate to use for PKI\n");
+ printf(" -K, --key-file=FILE The private key to use with the client certificate\n");
+ printf(" -A, --ca-cert-file=FILE The CA certificate to use for PKI\n");
+ printf(" -s, --ssl-logging=OPTIONS SSL Logging Options\n");
+ printf(" -b, --bind=IPADDR Local address to bind to\n");
+ printf(" -f, --config-file=FILE Configuration file to use\n");
+ printf(" -g, --log-file=FILE Log file to write to\n");
+ printf(" -p, --port=PORT The port on which the daemon is running (default=%d)\n", DEFAULT_SERVER_PORT);
+ printf(" -c, --command=COMMAND The name of the command that the remote daemon should run\n");
+ printf(" -a, --args=LIST Optional arguments that should be passed to the command,\n");
+ printf(" separated by a space. If provided, this must be the last\n");
+ printf(" option supplied on the command line.\n");
+ printf("\n");
+ printf(" NEW TIMEOUT SYNTAX\n");
+ printf(" -t, --timeout=INTERVAL:STATE\n");
+ printf(" INTERVAL Number of seconds before connection times out (default=%d)\n", DEFAULT_SOCKET_TIMEOUT);
+ printf(" STATE Check state to exit with in the event of a timeout (default=CRITICAL)\n");
+ printf(" Timeout STATE must be a valid state name (case-insensitive) or integer:\n");
+ printf(" (OK, WARNING, CRITICAL, UNKNOWN) or integer (0-3)\n");
+ printf("\n");
+ printf("Note:\n");
+ printf("This plugin requires that you have the NRPE daemon running on the remote host.\n");
+ printf("You must also have configured the daemon to associate a specific plugin command\n");
+ printf("with the [command] option you are specifying here. Upon receipt of the\n");
+ printf("[command] argument, the NRPE daemon will run the appropriate plugin command and\n");
+ printf("send the plugin output and return code back to *this* plugin. This allows you\n");
+ printf("to execute plugins on remote hosts and 'fake' the results to make Nagios think\n");
+ printf("the plugin is being run locally.\n");
+ printf("\n");
+ }
+
+ if (show_license == TRUE)
+ display_license();
+
+ exit(STATE_UNKNOWN);
+}
+
+void setup_ssl()
+{
+#ifdef HAVE_SSL
+ int vrfy, x;
+
+ if (sslprm.log_opts & SSL_LogStartup) {
+ char *val;
+
+ logit(LOG_INFO, "SSL Certificate File: %s", sslprm.cert_file ? sslprm.cert_file : "None");
+ logit(LOG_INFO, "SSL Private Key File: %s", sslprm.privatekey_file ? sslprm.privatekey_file : "None");
+ logit(LOG_INFO, "SSL CA Certificate File: %s", sslprm.cacert_file ? sslprm.cacert_file : "None");
+ logit(LOG_INFO, "SSL Cipher List: %s", sslprm.cipher_list);
+ logit(LOG_INFO, "SSL Allow ADH: %d", sslprm.allowDH);
+ logit(LOG_INFO, "SSL Log Options: 0x%02x", sslprm.log_opts);
+
+ switch (sslprm.ssl_proto_ver) {
+ case SSLv2:
+ val = "SSLv2";
+ break;
+ case SSLv2_plus:
+ val = "SSLv2 And Above";
+ break;
+ case SSLv3:
+ val = "SSLv3";
+ break;
+ case SSLv3_plus:
+ val = "SSLv3_plus And Above";
+ break;
+ case TLSv1:
+ val = "TLSv1";
+ break;
+ case TLSv1_plus:
+ val = "TLSv1_plus And Above";
+ break;
+ case TLSv1_1:
+ val = "TLSv1_1";
+ break;
+ case TLSv1_1_plus:
+ val = "TLSv1_1_plus And Above";
+ break;
+ case TLSv1_2:
+ val = "TLSv1_2";
+ break;
+ case TLSv1_2_plus:
+ val = "TLSv1_2_plus And Above";
+ break;
+ default:
+ val = "INVALID VALUE!";
+ break;
+ }
+ logit(LOG_INFO, "SSL Version: %s", val);
+ }
+
+ /* initialize SSL */
+ if (use_ssl == TRUE) {
+ SSL_load_error_strings();
+ SSL_library_init();
+ ENGINE_load_builtin_engines();
+ RAND_set_rand_engine(NULL);
+ ENGINE_register_all_complete();
+
+#if OPENSSL_VERSION_NUMBER >= 0x10100000
+
+ meth = TLS_method();
+
+#else /* OPENSSL_VERSION_NUMBER >= 0x10100000 */
+
+ meth = SSLv23_client_method();
+
+# ifndef OPENSSL_NO_SSL2
+ if (sslprm.ssl_proto_ver == SSLv2)
+ meth = SSLv2_client_method();
+# endif
+# ifndef OPENSSL_NO_SSL3
+ if (sslprm.ssl_proto_ver == SSLv3)
+ meth = SSLv3_client_method();
+# endif
+ if (sslprm.ssl_proto_ver == TLSv1)
+ meth = TLSv1_client_method();
+# ifdef SSL_TXT_TLSV1_1
+ if (sslprm.ssl_proto_ver == TLSv1_1)
+ meth = TLSv1_1_client_method();
+# ifdef SSL_TXT_TLSV1_2
+ if (sslprm.ssl_proto_ver == TLSv1_2)
+ meth = TLSv1_2_client_method();
+# endif /* ifdef SSL_TXT_TLSV1_2 */
+# endif /* ifdef SSL_TXT_TLSV1_1 */
+
+#endif /* OPENSSL_VERSION_NUMBER >= 0x10100000 */
+
+ if ((ctx = SSL_CTX_new(meth)) == NULL) {
+ printf("CHECK_NRPE: Error - could not create SSL context.\n");
+ exit(STATE_CRITICAL);
+ }
+
+#if OPENSSL_VERSION_NUMBER >= 0x10100000
+
+ SSL_CTX_set_max_proto_version(ctx, 0);
+
+ switch(sslprm.ssl_proto_ver) {
+
+ case TLSv1_2:
+ SSL_CTX_set_max_proto_version(ctx, TLS1_2_VERSION);
+ case TLSv1_2_plus:
+ SSL_CTX_set_min_proto_version(ctx, TLS1_2_VERSION);
+ break;
+
+ case TLSv1_1:
+ SSL_CTX_set_max_proto_version(ctx, TLS1_1_VERSION);
+ case TLSv1_1_plus:
+ SSL_CTX_set_min_proto_version(ctx, TLS1_1_VERSION);
+ break;
+
+ case TLSv1:
+ SSL_CTX_set_max_proto_version(ctx, TLS1_VERSION);
+ case TLSv1_plus:
+ SSL_CTX_set_min_proto_version(ctx, TLS1_VERSION);
+ break;
+
+ case SSLv3:
+ SSL_CTX_set_max_proto_version(ctx, SSL3_VERSION);
+ case SSLv3_plus:
+ SSL_CTX_set_min_proto_version(ctx, SSL3_VERSION);
+ break;
+ }
+
+#else /* OPENSSL_VERSION_NUMBER >= 0x10100000 */
+
+ switch(sslprm.ssl_proto_ver) {
+ case SSLv2:
+ case SSLv2_plus:
+ break;
+ case TLSv1_2:
+ case TLSv1_2_plus:
+#ifdef SSL_OP_NO_TLSv1_1
+ ssl_opts |= SSL_OP_NO_TLSv1_1;
+#endif
+ case TLSv1_1:
+ case TLSv1_1_plus:
+ ssl_opts |= SSL_OP_NO_TLSv1;
+ case TLSv1:
+ case TLSv1_plus:
+ ssl_opts |= SSL_OP_NO_SSLv3;
+ case SSLv3:
+ case SSLv3_plus:
+ ssl_opts |= SSL_OP_NO_SSLv2;
+ break;
+ }
+
+#endif /* OPENSSL_VERSION_NUMBER >= 0x10100000 */
+
+ SSL_CTX_set_options(ctx, ssl_opts);
+
+ if (sslprm.cert_file != NULL && sslprm.privatekey_file != NULL) {
+ if (!SSL_CTX_use_certificate_file(ctx, sslprm.cert_file, SSL_FILETYPE_PEM)) {
+ printf("Error: could not use certificate file '%s'.\n", sslprm.cert_file);
+ while ((x = ERR_get_error_line_data(NULL, NULL, NULL, NULL)) != 0) {
+ printf("Error: could not use certificate file '%s': %s\n", sslprm.cert_file, ERR_reason_error_string(x));
+ }
+ SSL_CTX_free(ctx);
+ exit(STATE_CRITICAL);
+ }
+ if (!SSL_CTX_use_PrivateKey_file(ctx, sslprm.privatekey_file, SSL_FILETYPE_PEM)) {
+ SSL_CTX_free(ctx);
+ printf("Error: could not use private key file '%s'.\n", sslprm.privatekey_file);
+ while ((x = ERR_get_error_line_data(NULL, NULL, NULL, NULL)) != 0) {
+ printf("Error: could not use private key file '%s': %s\n", sslprm.privatekey_file, ERR_reason_error_string(x));
+ }
+ SSL_CTX_free(ctx);
+ exit(STATE_CRITICAL);
+ }
+ }
+
+ if (sslprm.cacert_file != NULL) {
+ vrfy = SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT;
+ SSL_CTX_set_verify(ctx, vrfy, verify_callback);
+ if (!SSL_CTX_load_verify_locations(ctx, sslprm.cacert_file, NULL)) {
+ printf("Error: could not use CA certificate '%s'.\n", sslprm.cacert_file);
+ while ((x = ERR_get_error_line_data(NULL, NULL, NULL, NULL)) != 0) {
+ printf("Error: could not use CA certificate '%s': %s\n", sslprm.privatekey_file, ERR_reason_error_string(x));
+ }
+ SSL_CTX_free(ctx);
+ exit(STATE_CRITICAL);
+ }
+ }
+
+ if (!sslprm.allowDH) {
+ if (strlen(sslprm.cipher_list) < sizeof(sslprm.cipher_list) - 6) {
+ strcat(sslprm.cipher_list, ":!ADH");
+ if (sslprm.log_opts & SSL_LogStartup)
+ logit(LOG_INFO, "New SSL Cipher List: %s", sslprm.cipher_list);
+ }
+ } else {
+ /* use anonymous DH ciphers */
+ if (sslprm.allowDH == 2) {
+#if OPENSSL_VERSION_NUMBER >= 0x10100000
+ strncpy(sslprm.cipher_list, "ADH@SECLEVEL=0", MAX_FILENAME_LENGTH - 1);
+#else
+ strncpy(sslprm.cipher_list, "ADH", MAX_FILENAME_LENGTH - 1);
+#endif
+ }
+ }
+
+ if (SSL_CTX_set_cipher_list(ctx, sslprm.cipher_list) == 0) {
+ printf("Error: Could not set SSL/TLS cipher list: %s\n", sslprm.cipher_list);
+ while ((x = ERR_get_error_line_data(NULL, NULL, NULL, NULL)) != 0) {
+ printf("Could not set SSL/TLS cipher list '%s': %s\n", sslprm.cipher_list, ERR_reason_error_string(x));
+ }
+ SSL_CTX_free(ctx);
+ exit(STATE_CRITICAL);
+ }
+ }
+#endif
+}
+
+void set_sig_handlers()
+{
+#ifdef HAVE_SIGACTION
+ struct sigaction sig_action;
+#endif
+
+#ifdef HAVE_SIGACTION
+ sig_action.sa_sigaction = NULL;
+ sig_action.sa_handler = alarm_handler;
+ sigfillset(&sig_action.sa_mask);
+ sig_action.sa_flags = SA_NODEFER | SA_RESTART;
+ sigaction(SIGALRM, &sig_action, NULL);
+#else
+ signal(SIGALRM, alarm_handler);
+#endif /* HAVE_SIGACTION */
+
+ /* set socket timeout */
+ alarm(socket_timeout);
+}
+
+int connect_to_remote()
+{
+ struct sockaddr addr;
+ struct in_addr *inaddr;
+ socklen_t addrlen;
+ int result, rc, ssl_err, ern, x, nerrs = 0;
+
+ /* try to connect to the host at the given port number */
+ if ((sd = my_connect(server_name, &hostaddr, server_port, address_family, bind_address, stderr_to_stdout)) < 0)
+ exit(timeout_return_code);
+
+ result = STATE_OK;
+ addrlen = sizeof(addr);
+ rc = getpeername(sd, (struct sockaddr *)&addr, &addrlen);
+ if (addr.sa_family == AF_INET) {
+ struct sockaddr_in *addrin = (struct sockaddr_in *)&addr;
+ inaddr = &addrin->sin_addr;
+ } else {
+ struct sockaddr_in6 *addrin = (struct sockaddr_in6 *)&addr;
+ inaddr = (struct in_addr *)&addrin->sin6_addr;
+ }
+ if (inet_ntop(addr.sa_family, inaddr, rem_host, sizeof(rem_host)) == NULL)
+ strncpy(rem_host, "Unknown", sizeof(rem_host));
+ rem_host[MAX_HOST_ADDRESS_LENGTH - 1] = '\0';
+ if ((sslprm.log_opts & SSL_LogIpAddr) != 0)
+ logit(LOG_DEBUG, "Connected to %s", rem_host);
+
+#ifdef HAVE_SSL
+ if (use_ssl == FALSE)
+ return result;
+
+ /* do SSL handshake */
+ if ((ssl = SSL_new(ctx)) == NULL) {
+ printf("CHECK_NRPE: Error - Could not create SSL connection structure.\n");
+ return STATE_CRITICAL;
+ }
+
+ SSL_set_fd(ssl, sd);
+ if ((rc = SSL_connect(ssl)) != 1) {
+ ern = errno;
+ ssl_err = SSL_get_error(ssl, rc);
+
+ if (sslprm.log_opts & (SSL_LogCertDetails | SSL_LogIfClientCert)) {
+ rc = 0;
+ while ((x = ERR_get_error_line_data(NULL, NULL, NULL, NULL)) != 0) {
+ logit(LOG_ERR, "Error: (ERR_get_error_line_data = %d), Could not complete SSL handshake with %s: %s", x, rem_host, ERR_reason_error_string(x));
+ ++nerrs;
+ }
+ if (nerrs == 0) {
+ logit(LOG_ERR, "Error: (nerrs = 0) Could not complete SSL handshake with %s: rc=%d SSL-error=%d", rem_host, rc, ssl_err);
+ }
+ } else {
+ while ((x = ERR_get_error_line_data(NULL, NULL, NULL, NULL)) != 0) {
+ logit(LOG_ERR, "Error: (!log_opts) Could not complete SSL handshake with %s: %s", rem_host, ERR_reason_error_string(x));
+ ++nerrs;
+ }
+ if (nerrs == 0) {
+ logit(LOG_ERR, "Error: (nerrs = 0)(!log_opts) Could not complete SSL handshake with %s: rc=%d SSL-error=%d", rem_host, rc, ssl_err);
+ }
+ }
+
+ if (ssl_err == 5) {
+ /* Often, errno will be zero, so print a generic message here */
+ if (ern == 0)
+ printf("CHECK_NRPE: Error - Could not connect to %s. Check system logs on %s\n", rem_host, rem_host);
+ else
+ printf("CHECK_NRPE: Error - Could not connect to %s: %s\n", rem_host, strerror(ern));
+ } else {
+ printf("CHECK_NRPE: (ssl_err != 5) Error - Could not complete SSL handshake with %s: %d\n", rem_host, ssl_err);
+ }
+
+# ifdef DEBUG
+ printf("SSL_connect=%d\n", rc);
+ /*
+ rc = SSL_get_error(ssl, rc);
+ printf("SSL_get_error=%d\n", rc);
+ printf("ERR_get_error=%lu\n", ERR_get_error());
+ printf("%s\n",ERR_error_string(rc, NULL));
+ */
+ ERR_print_errors_fp(stdout);
+# endif
+ result = STATE_CRITICAL;
+
+ } else {
+
+ if (sslprm.log_opts & SSL_LogVersion)
+ logit(LOG_NOTICE, "Remote %s - SSL Version: %s", rem_host, SSL_get_version(ssl));
+
+ if (sslprm.log_opts & SSL_LogCipher) {
+# if (defined(__sun) && defined(SOLARIS_10)) || defined(_AIX) || defined(__hpux)
+ SSL_CIPHER *c = SSL_get_current_cipher(ssl);
+# else
+ const SSL_CIPHER *c = SSL_get_current_cipher(ssl);
+# endif
+ logit(LOG_NOTICE, "Remote %s - %s, Cipher is %s", rem_host,
+ SSL_CIPHER_get_version(c), SSL_CIPHER_get_name(c));
+ }
+
+ if ((sslprm.log_opts & SSL_LogIfClientCert) || (sslprm.log_opts & SSL_LogCertDetails)) {
+ char peer_cn[256], buffer[2048];
+ X509 *peer = SSL_get_peer_certificate(ssl);
+
+ if (peer) {
+ if (sslprm.log_opts & SSL_LogIfClientCert)
+ logit(LOG_NOTICE, "SSL %s has %s certificate", rem_host, SSL_get_verify_result(ssl) == X509_V_OK ? "a valid" : "an invalid");
+
+ if (sslprm.log_opts & SSL_LogCertDetails) {
+ X509_NAME_oneline(X509_get_subject_name(peer), buffer, sizeof(buffer));
+ logit(LOG_NOTICE, "SSL %s Cert Name: %s", rem_host, buffer);
+ X509_NAME_oneline(X509_get_issuer_name(peer), buffer, sizeof(buffer));
+ logit(LOG_NOTICE, "SSL %s Cert Issuer: %s", rem_host, buffer);
+ }
+
+ } else
+ logit(LOG_NOTICE, "SSL Did not get certificate from %s", rem_host);
+ }
+ }
+
+ /* bail if we had errors */
+ if (result != STATE_OK) {
+ SSL_CTX_free(ctx);
+ close(sd);
+ exit(result);
+ }
+#endif
+
+ return result;
+}
+
+int send_request()
+{
+ v2_packet *v2_send_packet = NULL;
+ v3_packet *v3_send_packet = NULL;
+ u_int32_t calculated_crc32;
+ int rc, bytes_to_send, pkt_size;
+ char *send_pkt;
+
+ if (packet_ver == NRPE_PACKET_VERSION_2) {
+ pkt_size = sizeof(v2_packet);
+ if (payload_size > 0)
+ pkt_size = sizeof(v2_packet) - MAX_PACKETBUFFER_LENGTH + payload_size;
+ v2_send_packet = (v2_packet*)calloc(1, pkt_size);
+ send_pkt = (char *)v2_send_packet;
+
+ /* fill the packet with semi-random data */
+ randomize_buffer((char *)v2_send_packet, pkt_size);
+
+ /* initialize response packet data */
+ v2_send_packet->packet_version = htons(packet_ver);
+ v2_send_packet->packet_type = htons(QUERY_PACKET);
+ if (payload_size > 0) {
+ strncpy(&v2_send_packet->buffer[0], query, payload_size);
+ v2_send_packet->buffer[payload_size - 1] = '\x0';
+ } else {
+ strncpy(&v2_send_packet->buffer[0], query, MAX_PACKETBUFFER_LENGTH);
+ v2_send_packet->buffer[MAX_PACKETBUFFER_LENGTH - 1] = '\x0';
+ }
+
+ /* calculate the crc 32 value of the packet */
+ v2_send_packet->crc32_value = 0;
+ calculated_crc32 = calculate_crc32(send_pkt, pkt_size);
+ v2_send_packet->crc32_value = htonl(calculated_crc32);
+
+ } else {
+
+ pkt_size = (sizeof(v3_packet) - 1) + strlen(query) + 1;
+ if (pkt_size < sizeof(v2_packet))
+ pkt_size = sizeof(v2_packet);
+
+ v3_send_packet = calloc(1, pkt_size);
+ send_pkt = (char *)v3_send_packet;
+ /* initialize response packet data */
+ v3_send_packet->packet_version = htons(packet_ver);
+ v3_send_packet->packet_type = htons(QUERY_PACKET);
+ v3_send_packet->alignment = 0;
+ v3_send_packet->buffer_length = htonl(pkt_size - sizeof(v3_packet) + 1);
+ strcpy(&v3_send_packet->buffer[0], query);
+
+ /* calculate the crc 32 value of the packet */
+ v3_send_packet->crc32_value = 0;
+ calculated_crc32 = calculate_crc32((char *)v3_send_packet, pkt_size);
+ v3_send_packet->crc32_value = htonl(calculated_crc32);
+ }
+
+ /* send the request to the remote */
+ bytes_to_send = pkt_size;
+
+ if (use_ssl == FALSE)
+ rc = sendall(sd, (char *)send_pkt, &bytes_to_send);
+#ifdef HAVE_SSL
+ else {
+ rc = SSL_write(ssl, send_pkt, bytes_to_send);
+ if (rc < 0)
+ rc = -1;
+ }
+#endif
+
+ if (v3_send_packet)
+ free(v3_send_packet);
+ if (v2_send_packet)
+ free(v2_send_packet);
+
+ if (rc == -1) {
+ printf("CHECK_NRPE: Error sending query to host.\n");
+ close(sd);
+ return STATE_UNKNOWN;
+ }
+
+ return STATE_OK;
+}
+
+int read_response()
+{
+ v2_packet *v2_receive_packet = NULL;
+ v3_packet *v3_receive_packet = NULL;
+ u_int32_t packet_crc32;
+ u_int32_t calculated_crc32;
+ int32_t pkt_size;
+ int rc, result;
+
+ alarm(0);
+ set_sig_handlers();
+
+#ifdef HAVE_SSL
+ rc = read_packet(sd, ssl, &v2_receive_packet, &v3_receive_packet);
+#else
+ rc = read_packet(sd, NULL, &v2_receive_packet, &v3_receive_packet);
+#endif
+
+ alarm(0);
+
+ /* close the connection */
+#ifdef HAVE_SSL
+ if (use_ssl == TRUE) {
+ SSL_shutdown(ssl);
+ SSL_free(ssl);
+ SSL_CTX_free(ctx);
+ }
+#endif
+ graceful_close(sd, 1000);
+
+ /* recv() error */
+ if (rc < 0) {
+ if (packet_ver == NRPE_PACKET_VERSION_3) {
+ if (v3_receive_packet)
+ free(v3_receive_packet);
+ return -1;
+ }
+ if (v2_receive_packet)
+ free(v2_receive_packet);
+ return STATE_UNKNOWN;
+
+ } else if (rc == 0) {
+
+ /* server disconnected */
+ printf("CHECK_NRPE: Received 0 bytes from daemon. Check the remote server logs for error messages.\n");
+ if (packet_ver == NRPE_PACKET_VERSION_3) {
+ if (v3_receive_packet) {
+ free(v3_receive_packet);
+ }
+ } else if (v2_receive_packet) {
+ free(v2_receive_packet);
+ }
+ return STATE_UNKNOWN;
+ }
+
+ /* check the crc 32 value */
+ if (packet_ver == NRPE_PACKET_VERSION_3) {
+ pkt_size = (sizeof(v3_packet) - 1) + ntohl(v3_receive_packet->buffer_length);
+ packet_crc32 = ntohl(v3_receive_packet->crc32_value);
+ v3_receive_packet->crc32_value = 0L;
+ v3_receive_packet->alignment = 0;
+ calculated_crc32 = calculate_crc32((char *)v3_receive_packet, pkt_size);
+ } else {
+ pkt_size = sizeof(v2_packet);
+ if (payload_size > 0) {
+ pkt_size = sizeof(v2_packet) - MAX_PACKETBUFFER_LENGTH + payload_size;
+ }
+ packet_crc32 = ntohl(v2_receive_packet->crc32_value);
+ v2_receive_packet->crc32_value = 0L;
+ calculated_crc32 = calculate_crc32((char *)v2_receive_packet, pkt_size);
+ }
+
+ if (packet_crc32 != calculated_crc32) {
+ printf("CHECK_NRPE: Response packet had invalid CRC32.\n");
+ close(sd);
+ if (packet_ver == NRPE_PACKET_VERSION_3) {
+ if (v3_receive_packet) {
+ free(v3_receive_packet);
+ }
+ } else if (v2_receive_packet) {
+ free(v2_receive_packet);
+ }
+ return STATE_UNKNOWN;
+ }
+
+ /* get the return code from the remote plugin */
+ /* and print the output returned by the daemon */
+ if (packet_ver == NRPE_PACKET_VERSION_3) {
+ result = ntohs(v3_receive_packet->result_code);
+ if (v3_receive_packet->buffer_length == 0) {
+ printf("CHECK_NRPE: No output returned from daemon.\n");
+ } else {
+ printf("%s\n", v3_receive_packet->buffer);
+ }
+ } else {
+ result = ntohs(v2_receive_packet->result_code);
+ if (payload_size > 0) {
+ v2_receive_packet->buffer[payload_size - 1] = '\x0';
+ } else {
+ v2_receive_packet->buffer[MAX_PACKETBUFFER_LENGTH - 1] = '\x0';
+ }
+ if (!strcmp(v2_receive_packet->buffer, "")) {
+ printf("CHECK_NRPE: No output returned from daemon.\n");
+ } else if (strstr(v2_receive_packet->buffer, "Invalid packet version.3") != NULL) {
+ /* NSClient++ doesn't recognize it */
+ return -1;
+ } else {
+ printf("%s\n", v2_receive_packet->buffer);
+ }
+ }
+
+ if (packet_ver == NRPE_PACKET_VERSION_3) {
+ if (v3_receive_packet) {
+ free(v3_receive_packet);
+ }
+ } else if (v2_receive_packet) {
+ free(v2_receive_packet);
+ }
+
+ return result;
+}
+
+int read_packet(int sock, void *ssl_ptr, v2_packet ** v2_pkt, v3_packet ** v3_pkt)
+{
+ v2_packet packet;
+ int32_t pkt_size, common_size, tot_bytes, bytes_to_recv, buffer_size, bytes_read = 0;
+ int rc;
+ char *buff_ptr;
+
+ /* Read only the part that's common between versions 2 & 3 */
+ common_size = tot_bytes = bytes_to_recv = (char *)packet.buffer - (char *)&packet;
+
+ if (use_ssl == FALSE) {
+ rc = recvall(sock, (char *)&packet, &tot_bytes, socket_timeout);
+
+ if (rc <= 0 || rc != bytes_to_recv) {
+ if (rc < bytes_to_recv) {
+ if (packet_ver != NRPE_PACKET_VERSION_3)
+ printf("CHECK_NRPE: Receive header underflow - only %d bytes received (%ld expected).\n", rc, sizeof(bytes_to_recv));
+ }
+ return -1;
+ }
+
+ packet_ver = ntohs(packet.packet_version);
+ if (packet_ver != NRPE_PACKET_VERSION_2 && packet_ver != NRPE_PACKET_VERSION_3) {
+ printf("CHECK_NRPE: Invalid packet version received from server.\n");
+ return -1;
+ }
+
+ if (ntohs(packet.packet_type) != RESPONSE_PACKET) {
+ printf("CHECK_NRPE: Invalid packet type received from server.\n");
+ return -1;
+ }
+
+ if (packet_ver == NRPE_PACKET_VERSION_2) {
+ pkt_size = sizeof(v2_packet);
+ if (payload_size > 0) {
+ pkt_size = common_size + payload_size;
+ buffer_size = payload_size;
+ } else {
+ buffer_size = pkt_size - common_size;
+ }
+ if ((*v2_pkt = calloc(1, pkt_size)) == NULL) {
+ logit(LOG_ERR, "Error: Could not allocate memory for packet");
+ return -1;
+ }
+ memcpy(*v2_pkt, &packet, common_size);
+ buff_ptr = (*v2_pkt)->buffer;
+ memset(buff_ptr, 0, buffer_size);
+ } else {
+ pkt_size = sizeof(v3_packet) - 1;
+
+ /* Read the alignment filler */
+ bytes_to_recv = sizeof(int16_t);
+ rc = recvall(sock, (char *)&buffer_size, &bytes_to_recv, socket_timeout);
+ if (rc <= 0 || bytes_to_recv != sizeof(int16_t))
+ return -1;
+ tot_bytes += rc;
+
+ /* Read the buffer size */
+ bytes_to_recv = sizeof(buffer_size);
+ rc = recvall(sock, (char *)&buffer_size, &bytes_to_recv, socket_timeout);
+ if (rc <= 0 || bytes_to_recv != sizeof(buffer_size))
+ return -1;
+ tot_bytes += rc;
+
+ buffer_size = ntohl(buffer_size);
+ pkt_size += buffer_size;
+ if ((*v3_pkt = calloc(1, pkt_size)) == NULL) {
+ logit(LOG_ERR, "Error: Could not allocate memory for packet");
+ return -1;
+ }
+
+ memcpy(*v3_pkt, &packet, common_size);
+ (*v3_pkt)->buffer_length = htonl(buffer_size);
+ buff_ptr = (*v3_pkt)->buffer;
+ }
+
+ bytes_to_recv = buffer_size;
+ rc = recvall(sock, buff_ptr, &bytes_to_recv, socket_timeout);
+
+ if (rc <= 0 || rc != buffer_size) {
+ if (packet_ver == NRPE_PACKET_VERSION_3) {
+ free(*v3_pkt);
+ *v3_pkt = NULL;
+ } else {
+ free(*v2_pkt);
+ *v2_pkt = NULL;
+ }
+ if (rc < buffer_size)
+ printf("CHECK_NRPE: Receive underflow - only %d bytes received (%ld expected).\n", rc, sizeof(buffer_size));
+ return -1;
+ } else
+ tot_bytes += rc;
+ }
+#ifdef HAVE_SSL
+ else {
+ SSL *ssl = (SSL *) ssl_ptr;
+
+ while (((rc = SSL_read(ssl, &packet, bytes_to_recv)) <= 0)
+ && (SSL_get_error(ssl, rc) == SSL_ERROR_WANT_READ)) {
+ }
+
+ if (rc <= 0 || rc != bytes_to_recv) {
+ if (rc < bytes_to_recv) {
+ if (packet_ver != NRPE_PACKET_VERSION_3)
+ printf("CHECK_NRPE: Receive header underflow - only %d bytes received (%ld expected).\n", rc, sizeof(bytes_to_recv));
+ }
+ return -1;
+ }
+
+ packet_ver = ntohs(packet.packet_version);
+ if (packet_ver != NRPE_PACKET_VERSION_2 && packet_ver != NRPE_PACKET_VERSION_3) {
+ printf("CHECK_NRPE: Invalid packet version received from server.\n");
+ return -1;
+ }
+
+ if (ntohs(packet.packet_type) != RESPONSE_PACKET) {
+ printf("CHECK_NRPE: Invalid packet type received from server.\n");
+ return -1;
+ }
+
+ if (packet_ver == NRPE_PACKET_VERSION_2) {
+ pkt_size = sizeof(v2_packet);
+ if (payload_size > 0) {
+ pkt_size = common_size + payload_size;
+ buffer_size = payload_size;
+ } else
+ buffer_size = pkt_size - common_size;
+ if ((*v2_pkt = calloc(1, pkt_size)) == NULL) {
+ logit(LOG_ERR, "Error: Could not allocate memory for packet");
+ return -1;
+ }
+ memcpy(*v2_pkt, &packet, common_size);
+ buff_ptr = (*v2_pkt)->buffer;
+ memset(buff_ptr, 0, buffer_size);
+ } else {
+ pkt_size = sizeof(v3_packet) - 1;
+
+ /* Read the alignment filler */
+ bytes_to_recv = sizeof(int16_t);
+ while (((rc = SSL_read(ssl, &buffer_size, bytes_to_recv)) <= 0)
+ && (SSL_get_error(ssl, rc) == SSL_ERROR_WANT_READ)) {
+ }
+
+ if (rc <= 0 || bytes_to_recv != sizeof(int16_t))
+ return -1;
+ tot_bytes += rc;
+
+ /* Read the buffer size */
+ bytes_to_recv = sizeof(buffer_size);
+ while (((rc = SSL_read(ssl, &buffer_size, bytes_to_recv)) <= 0)
+ && (SSL_get_error(ssl, rc) == SSL_ERROR_WANT_READ)) {
+ }
+
+ if (rc <= 0 || bytes_to_recv != sizeof(buffer_size))
+ return -1;
+ tot_bytes += rc;
+
+ buffer_size = ntohl(buffer_size);
+ pkt_size += buffer_size;
+ if ((*v3_pkt = calloc(1, pkt_size)) == NULL) {
+ logit(LOG_ERR, "Error: Could not allocate memory for packet");
+ return -1;
+ }
+
+ memcpy(*v3_pkt, &packet, common_size);
+ (*v3_pkt)->buffer_length = htonl(buffer_size);
+ buff_ptr = (*v3_pkt)->buffer;
+ }
+
+ bytes_to_recv = buffer_size;
+ for (;;) {
+ while (((rc = SSL_read(ssl, &buff_ptr[bytes_read], bytes_to_recv)) <= 0)
+ && (SSL_get_error(ssl, rc) == SSL_ERROR_WANT_READ)) {
+ }
+
+ if (rc <= 0)
+ break;
+ bytes_read += rc;
+ bytes_to_recv -= rc;
+ }
+
+ buff_ptr[bytes_read] = 0;
+
+ if (rc < 0 || bytes_read != buffer_size) {
+ if (packet_ver == NRPE_PACKET_VERSION_3) {
+ free(*v3_pkt);
+ *v3_pkt = NULL;
+ } else {
+ free(*v2_pkt);
+ *v2_pkt = NULL;
+ }
+ if (bytes_read != buffer_size) {
+ if (packet_ver == NRPE_PACKET_VERSION_3) {
+ printf("CHECK_NRPE: Receive buffer size - %ld bytes received (%ld expected).\n", (long)bytes_read, sizeof(buffer_size));
+ } else {
+ printf("CHECK_NRPE: Receive underflow - only %ld bytes received (%ld expected).\n", (long)bytes_read, sizeof(buffer_size));
+ }
+ }
+ return -1;
+ } else
+ tot_bytes += rc;
+ }
+#endif
+
+ return tot_bytes;
+}
+
+#ifdef HAVE_SSL
+int verify_callback(int preverify_ok, X509_STORE_CTX * ctx)
+{
+ char name[256], issuer[256];
+ X509 *err_cert;
+ int err;
+ SSL *ssl;
+
+ if (preverify_ok || ((sslprm.log_opts & SSL_LogCertDetails) == 0))
+ return preverify_ok;
+
+ err_cert = X509_STORE_CTX_get_current_cert(ctx);
+ err = X509_STORE_CTX_get_error(ctx);
+
+ /* Get the pointer to the SSL of the current connection */
+ ssl = X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx());
+
+ X509_NAME_oneline(X509_get_subject_name(err_cert), name, 256);
+ X509_NAME_oneline(X509_get_issuer_name(err_cert), issuer, 256);
+
+ if (!preverify_ok && sslprm.client_certs >= Ask_For_Cert
+ && (sslprm.log_opts & SSL_LogCertDetails)) {
+
+ logit(LOG_ERR, "SSL Client has an invalid certificate: %s (issuer=%s) err=%d:%s", name, issuer, err, X509_verify_cert_error_string(err));
+ }
+
+ return preverify_ok;
+}
+#endif
+
+void alarm_handler(int sig)
+{
+ const char msg1[] = "CHECK_NRPE STATE ";
+ const char msg2[] = ": Socket timeout after ";
+ const char msg3[] = " seconds.\n";
+ const char *text = state_text(timeout_return_code);
+ size_t lth1 = 0, lth2 = 0;
+
+ for (lth1 = 0; lth1 < 10; ++lth1)
+ if (text[lth1] == 0)
+ break;
+ for (lth2 = 0; lth2 < 10; ++lth2)
+ if (timeout_txt[lth2] == 0)
+ break;
+
+
+ if ((write(STDOUT_FILENO, msg1, sizeof(msg1) - 1) == -1)
+ || (write(STDOUT_FILENO, text, lth1) == -1)
+ || (write(STDOUT_FILENO, msg2, sizeof(msg2) - 1) == -1)
+ || (write(STDOUT_FILENO, timeout_txt, lth2) == -1)
+ || (write(STDOUT_FILENO, msg3, sizeof(msg3) - 1) == -1)) {
+
+ logit(LOG_ERR, "ERROR: alarm_handler() write(): %s", strerror(errno));
+ }
+
+ exit(timeout_return_code);
+}
+
+/* submitted by Mark Plaksin 08/31/2006 */
+int graceful_close(int sd, int timeout)
+{
+ fd_set in;
+ struct timeval tv;
+ char buf[1000];
+
+ /* send FIN packet */
+ shutdown(sd, SHUT_WR);
+
+ for (;;) {
+ FD_ZERO(&in);
+ FD_SET(sd, &in);
+ tv.tv_sec = timeout / 1000;
+ tv.tv_usec = (timeout % 1000) * 1000;
+
+ /* timeout or error */
+ if (1 != select(sd + 1, &in, NULL, NULL, &tv))
+ break;
+
+ /* no more data (FIN or RST) */
+ if (0 >= recv(sd, buf, sizeof(buf), 0))
+ break;
+ }
+
+#ifdef HAVE_CLOSESOCKET
+ closesocket(sd);
+#else
+ close(sd);
+#endif
+
+ return OK;
+}
diff --git a/src/nrpe.c b/src/nrpe.c
new file mode 100644
index 0000000..8e92764
--- /dev/null
+++ b/src/nrpe.c
@@ -0,0 +1,2907 @@
+/****************************************************************************
+ *
+ * nrpe.c - Nagios Remote Plugin Executor
+ *
+ * License: GPLv2
+ * Copyright (c) 2009-2017 Nagios Enterprises
+ * 1999-2008 Ethan Galstad (nagios@nagios.org)
+ *
+ * Command line: nrpe -c <config_file> [--inetd | --daemon]
+ *
+ * Description:
+ *
+ * This program is designed to run as a background process and
+ * handle incoming requests (from the host running Nagios) for
+ * plugin execution. It is useful for running "local" plugins
+ * such as check_users, check_load, check_disk, etc. without
+ * having to use rsh or ssh.
+ *
+ * License Notice:
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ ****************************************************************************/
+
+#include "config.h"
+#include "common.h"
+#include "nrpe.h"
+#include "utils.h"
+#include "acl.h"
+
+#ifdef HAVE_SSL
+# ifdef USE_SSL_DH
+# include "../include/dh.h"
+# endif
+#endif
+#ifndef HAVE_ASPRINTF
+extern int asprintf(char **ptr, const char *format, ...);
+#endif
+
+#ifdef HAVE_LIBWRAP
+int allow_severity = LOG_INFO;
+int deny_severity = LOG_WARNING;
+# ifndef HAVE_RFC931_TIMEOUT
+int rfc931_timeout=15;
+# endif
+#endif
+
+#ifdef HAVE_SSL
+# if (defined(__sun) && defined(SOLARIS_10)) || defined(_AIX) || defined(__hpux)
+SSL_METHOD *meth;
+# else
+const SSL_METHOD *meth;
+# endif
+SSL_CTX *ctx;
+int use_ssl = TRUE;
+#else
+int use_ssl = FALSE;
+#endif
+
+#define DEFAULT_COMMAND_TIMEOUT 60 /* default timeout for execution of plugins */
+#define MAXFD 64
+#define NASTY_METACHARS "|`&><'\\[]{};\r\n"
+#define MAX_LISTEN_SOCKS 16
+#define DEFAULT_LISTEN_QUEUE_SIZE 5
+#define DEFAULT_SSL_SHUTDOWN_TIMEOUT 15
+
+#define how_many(x,y) (((x)+((y)-1))/(y))
+
+extern int errno;
+struct addrinfo *listen_addrs = NULL;
+int listen_socks[MAX_LISTEN_SOCKS];
+char remote_host[MAX_HOST_ADDRESS_LENGTH];
+char *macro_argv[MAX_COMMAND_ARGUMENTS];
+char config_file[MAX_INPUT_BUFFER] = "nrpe.cfg";
+char server_address[NI_MAXHOST] = "";
+char *command_name = NULL;
+int log_facility = LOG_DAEMON;
+int server_port = DEFAULT_SERVER_PORT;
+int num_listen_socks = 0;
+int address_family = AF_UNSPEC;
+int socket_timeout = DEFAULT_SOCKET_TIMEOUT;
+int command_timeout = DEFAULT_COMMAND_TIMEOUT;
+int connection_timeout = DEFAULT_CONNECTION_TIMEOUT;
+int ssl_shutdown_timeout = DEFAULT_SSL_SHUTDOWN_TIMEOUT;
+char *command_prefix = NULL;
+int packet_ver = 0;
+command *command_list = NULL;
+char *nrpe_user = NULL;
+char *nrpe_group = NULL;
+char *allowed_hosts = NULL;
+char *keep_env_vars = NULL;
+char *pid_file = NULL;
+int wrote_pid_file = FALSE;
+int allow_arguments = FALSE;
+int allow_bash_cmd_subst = FALSE;
+int allow_weak_random_seed = FALSE;
+int sigrestart = FALSE;
+int sigshutdown = FALSE;
+int show_help = FALSE;
+int show_license = FALSE;
+int show_version = FALSE;
+int use_inetd = TRUE;
+int commands_running = 0;
+int max_commands = 0;
+int debug = FALSE;
+int use_src = FALSE; /* Define parameter for SRC option */
+int no_forking = FALSE;
+int listen_queue_size = DEFAULT_LISTEN_QUEUE_SIZE;
+char *nasty_metachars = NULL;
+extern char *log_file;
+
+/* SSL/TLS parameters */
+typedef enum _SSL_VER {
+ SSLv2 = 1, SSLv2_plus, SSLv3, SSLv3_plus, TLSv1,
+ TLSv1_plus, TLSv1_1, TLSv1_1_plus, TLSv1_2, TLSv1_2_plus
+} SslVer;
+
+typedef enum _CLNT_CERTS {
+ ClntCerts_Unknown = 0, Ask_For_Cert = 1, Require_Cert = 2
+} ClntCerts;
+
+typedef enum _SSL_LOGGING {
+ SSL_NoLogging = 0, SSL_LogStartup = 1, SSL_LogIpAddr = 2,
+ SSL_LogVersion = 4, SSL_LogCipher = 8, SSL_LogIfClientCert = 16,
+ SSL_LogCertDetails = 32
+} SslLogging;
+
+struct _SSL_PARMS {
+ char *cert_file;
+ char *cacert_file;
+ char *privatekey_file;
+ char cipher_list[MAX_FILENAME_LENGTH];
+ SslVer ssl_proto_ver;
+ int allowDH;
+ ClntCerts client_certs;
+ SslLogging log_opts;
+} sslprm = {
+#if OPENSSL_VERSION_NUMBER >= 0x10100000
+NULL, NULL, NULL, "ALL:!MD5:@STRENGTH:@SECLEVEL=0", TLSv1_plus, TRUE, 0, SSL_NoLogging};
+#else
+NULL, NULL, NULL, "ALL:!MD5:@STRENGTH", TLSv1_plus, TRUE, 0, SSL_NoLogging};
+#endif
+
+
+#ifdef HAVE_SSL
+static int verify_callback(int ok, X509_STORE_CTX * ctx);
+static void my_disconnect_sighandler(int sig);
+static void complete_SSL_shutdown(SSL *);
+#endif
+
+int main(int argc, char **argv)
+{
+ int result = OK;
+ int x;
+ uint32_t y;
+ char buffer[MAX_INPUT_BUFFER];
+
+ init();
+
+ /* process command-line args */
+ result = process_arguments(argc, argv);
+ if (result != OK || show_help == TRUE || show_license == TRUE || show_version == TRUE)
+ usage(result);
+
+ /* make sure the config file uses an absolute path */
+ if (config_file[0] != '/') {
+
+ /* save the name of the config file */
+ strncpy(buffer, config_file, sizeof(buffer));
+ buffer[sizeof(buffer) - 1] = '\x0';
+
+ /* get absolute path of current working directory */
+ strcpy(config_file, "");
+ if (getcwd(config_file, sizeof(config_file)) == NULL) {
+ printf("ERROR: getcwd(): %s, bailing out...\n", strerror(errno));
+ exit(STATE_CRITICAL);
+ }
+
+ /* append a forward slash */
+ strncat(config_file, "/", sizeof(config_file) - 2);
+ config_file[sizeof(config_file) - 1] = '\x0';
+
+ /* append the config file to the path */
+ strncat(config_file, buffer, sizeof(config_file) - strlen(config_file) - 1);
+ config_file[sizeof(config_file) - 1] = '\x0';
+ }
+
+ /* read the config file */
+ result = read_config_file(config_file);
+ /* exit if there are errors... */
+ if (result == ERROR) {
+ logit(LOG_ERR, "Config file '%s' contained errors, aborting...", config_file);
+ return STATE_CRITICAL;
+ }
+
+ if (!nasty_metachars)
+ nasty_metachars = strdup(NASTY_METACHARS);
+
+ /* initialize macros */
+ for (x = 0; x < MAX_COMMAND_ARGUMENTS; x++)
+ macro_argv[x] = NULL;
+
+ init_ssl();
+
+ /* if we're running under inetd... */
+ if (use_inetd == TRUE)
+ run_inetd();
+
+ else if (use_src == TRUE || no_forking == TRUE)
+ run_src();
+
+ else
+ run_daemon();
+
+#ifdef HAVE_SSL
+ if (use_ssl == TRUE)
+ SSL_CTX_free(ctx);
+#endif
+
+ /* We are now running in daemon mode, or the connection handed over by inetd has
+ been completed, so the parent process exits */
+ return STATE_OK;
+}
+
+int init(void)
+{
+ char *env_string = NULL;
+ int result = OK;
+
+ /* set some environment variables */
+ asprintf(&env_string, "NRPE_MULTILINESUPPORT=1");
+ putenv(env_string);
+ asprintf(&env_string, "NRPE_PROGRAMVERSION=%s", PROGRAM_VERSION);
+ putenv(env_string);
+
+ /* open a connection to the syslog facility */
+ /* facility name may be overridden later */
+ get_log_facility(NRPE_LOG_FACILITY);
+ openlog("nrpe", LOG_PID, log_facility);
+
+ /* generate the CRC 32 table */
+ generate_crc32_table();
+
+ return result;
+}
+
+void init_ssl(void)
+{
+#ifdef HAVE_SSL
+ DH *dh;
+ char seedfile[FILENAME_MAX];
+ char errstr[120] = { "" };
+ int i, c, x, vrfy;
+ unsigned long ssl_opts = SSL_OP_ALL | SSL_OP_SINGLE_DH_USE;
+
+ if (use_ssl == FALSE) {
+ if (debug == TRUE)
+ logit(LOG_INFO, "INFO: SSL/TLS NOT initialized. Network encryption DISABLED.");
+ return;
+ }
+
+#ifndef USE_SSL_DH
+ ssl_opts = SSL_OP_ALL;
+ sslprm.allowDH = 0;
+#endif
+
+ if (sslprm.log_opts & SSL_LogStartup)
+ log_ssl_startup();
+
+ /* initialize SSL */
+ SSL_load_error_strings();
+ SSL_library_init();
+ ENGINE_load_builtin_engines();
+ RAND_set_rand_engine(NULL);
+ ENGINE_register_all_complete();
+
+ meth = SSLv23_server_method();
+
+ /* use week random seed if necessary */
+ if (allow_weak_random_seed && (RAND_status() == 0)) {
+ if (RAND_file_name(seedfile, sizeof(seedfile) - 1))
+ if (RAND_load_file(seedfile, -1))
+ RAND_write_file(seedfile);
+
+ if (RAND_status() == 0) {
+ logit(LOG_ERR,
+ "Warning: SSL/TLS uses a weak random seed which is highly discouraged");
+ srand(time(NULL));
+ for (i = 0; i < 500 && RAND_status() == 0; i++) {
+ for (c = 0; c < sizeof(seedfile); c += sizeof(int)) {
+ *((int *)(seedfile + c)) = rand();
+ }
+ RAND_seed(seedfile, sizeof(seedfile));
+ }
+ }
+ }
+
+#if OPENSSL_VERSION_NUMBER >= 0x10100000
+
+ meth = TLS_method();
+
+#else /* OPENSSL_VERSION_NUMBER >= 0x10100000 */
+
+# ifndef OPENSSL_NO_SSL2
+ if (sslprm.ssl_proto_ver == SSLv2)
+ meth = SSLv2_server_method();
+# endif
+# ifndef OPENSSL_NO_SSL3
+ if (sslprm.ssl_proto_ver == SSLv3)
+ meth = SSLv3_server_method();
+# endif
+ if (sslprm.ssl_proto_ver == TLSv1)
+ meth = TLSv1_server_method();
+# ifdef SSL_TXT_TLSV1_1
+ if (sslprm.ssl_proto_ver == TLSv1_1)
+ meth = TLSv1_1_server_method();
+# ifdef SSL_TXT_TLSV1_2
+ if (sslprm.ssl_proto_ver == TLSv1_2)
+ meth = TLSv1_2_server_method();
+# endif /* ifdef SSL_TXT_TLSV1_2 */
+# endif /* SSL_TXT_TLSV1_1 */
+
+#endif /* OPENSSL_VERSION_NUMBER >= 0x10100000 */
+
+ ctx = SSL_CTX_new(meth);
+ if (ctx == NULL) {
+ while ((x = ERR_get_error()) != 0) {
+ ERR_error_string(x, errstr);
+ logit(LOG_ERR, "Error: could not create SSL context : %s", errstr);
+ }
+ SSL_CTX_free(ctx);
+ exit(STATE_CRITICAL);
+ }
+
+#if OPENSSL_VERSION_NUMBER >= 0x10100000
+
+ SSL_CTX_set_max_proto_version(ctx, 0);
+
+ switch(sslprm.ssl_proto_ver) {
+
+ case TLSv1_2:
+ SSL_CTX_set_max_proto_version(ctx, TLS1_2_VERSION);
+ case TLSv1_2_plus:
+ SSL_CTX_set_min_proto_version(ctx, TLS1_2_VERSION);
+ break;
+
+ case TLSv1_1:
+ SSL_CTX_set_max_proto_version(ctx, TLS1_1_VERSION);
+ case TLSv1_1_plus:
+ SSL_CTX_set_min_proto_version(ctx, TLS1_1_VERSION);
+ break;
+
+ case TLSv1:
+ SSL_CTX_set_max_proto_version(ctx, TLS1_VERSION);
+ case TLSv1_plus:
+ SSL_CTX_set_min_proto_version(ctx, TLS1_VERSION);
+ break;
+
+ case SSLv3:
+ SSL_CTX_set_max_proto_version(ctx, SSL3_VERSION);
+ case SSLv3_plus:
+ SSL_CTX_set_min_proto_version(ctx, SSL3_VERSION);
+ break;
+ }
+
+#else /* OPENSSL_VERSION_NUMBER >= 0x10100000 */
+
+ switch(sslprm.ssl_proto_ver) {
+ case SSLv2:
+ case SSLv2_plus:
+ break;
+ case TLSv1_2:
+ case TLSv1_2_plus:
+#ifdef SSL_OP_NO_TLSv1_1
+ ssl_opts |= SSL_OP_NO_TLSv1_1;
+#endif
+ case TLSv1_1:
+ case TLSv1_1_plus:
+ ssl_opts |= SSL_OP_NO_TLSv1;
+ case TLSv1:
+ case TLSv1_plus:
+ ssl_opts |= SSL_OP_NO_SSLv3;
+ case SSLv3:
+ case SSLv3_plus:
+ ssl_opts |= SSL_OP_NO_SSLv2;
+ break;
+ }
+
+#endif /* OPENSSL_VERSION_NUMBER >= 0x10100000 */
+
+ SSL_CTX_set_options(ctx, ssl_opts);
+
+ if (sslprm.cert_file != NULL) {
+ if (!SSL_CTX_use_certificate_file(ctx, sslprm.cert_file, SSL_FILETYPE_PEM)) {
+ SSL_CTX_free(ctx);
+ while ((x = ERR_get_error()) != 0) {
+ ERR_error_string(x, errstr);
+ logit(LOG_ERR, "Error: could not use certificate file %s : %s",
+ sslprm.cert_file, errstr);
+ }
+ exit(STATE_CRITICAL);
+ }
+ if (!SSL_CTX_use_PrivateKey_file(ctx, sslprm.privatekey_file, SSL_FILETYPE_PEM)) {
+ while ((x = ERR_get_error()) != 0) {
+ ERR_error_string(x, errstr);
+ logit(LOG_ERR, "Error: could not use private key file '%s' : %s",
+ sslprm.privatekey_file, errstr);
+ }
+ SSL_CTX_free(ctx);
+ exit(STATE_CRITICAL);
+ }
+ }
+
+ if (sslprm.client_certs != 0) {
+ vrfy = SSL_VERIFY_PEER | SSL_VERIFY_CLIENT_ONCE;
+ if ((sslprm.client_certs & Require_Cert) != 0)
+ vrfy |= SSL_VERIFY_FAIL_IF_NO_PEER_CERT;
+ SSL_CTX_set_verify(ctx, vrfy, verify_callback);
+ if (!SSL_CTX_load_verify_locations(ctx, sslprm.cacert_file, NULL)) {
+ while ((x = ERR_get_error_line_data(NULL, NULL, NULL, NULL)) != 0) {
+ logit(LOG_ERR, "Error: could not use CA certificate file '%s': %s\n",
+ sslprm.cacert_file, ERR_reason_error_string(x));
+ }
+ SSL_CTX_free(ctx);
+ logit(LOG_ERR, "Error: could not use CA certificate '%s'", sslprm.cacert_file);
+ exit(STATE_CRITICAL);
+ }
+ }
+
+ if (!sslprm.allowDH) {
+ if (strlen(sslprm.cipher_list) < sizeof(sslprm.cipher_list) - 6)
+ strcat(sslprm.cipher_list, ":!ADH");
+ } else {
+ /* use anonymous DH ciphers */
+ if (sslprm.allowDH == 2) {
+#if OPENSSL_VERSION_NUMBER >= 0x10100000
+ strncpy(sslprm.cipher_list, "ADH@SECLEVEL=0", MAX_FILENAME_LENGTH - 1);
+#else
+ strncpy(sslprm.cipher_list, "ADH", MAX_FILENAME_LENGTH - 1);
+#endif
+ }
+
+#ifdef USE_SSL_DH
+ dh = get_dh2048();
+ SSL_CTX_set_tmp_dh(ctx, dh);
+ DH_free(dh);
+#endif
+ }
+
+ if (SSL_CTX_set_cipher_list(ctx, sslprm.cipher_list) == 0) {
+ SSL_CTX_free(ctx);
+ logit(LOG_ERR, "Error: Could not set SSL/TLS cipher list");
+ exit(STATE_CRITICAL);
+ }
+
+ if (debug == TRUE)
+ logit(LOG_INFO, "INFO: SSL/TLS initialized. All network traffic will be encrypted.");
+#endif
+}
+
+void log_ssl_startup(void)
+{
+#ifdef HAVE_SSL
+ char *vers;
+
+ logit(LOG_INFO, "SSL Certificate File: %s", sslprm.cert_file ? sslprm.cert_file : "None");
+ logit(LOG_INFO, "SSL Private Key File: %s",
+ sslprm.privatekey_file ? sslprm.privatekey_file : "None");
+ logit(LOG_INFO, "SSL CA Certificate File: %s",
+ sslprm.cacert_file ? sslprm.cacert_file : "None");
+ logit(LOG_INFO, "SSL Cipher List: %s", sslprm.cipher_list);
+ logit(LOG_INFO, "SSL Allow ADH: %d", sslprm.allowDH == 0);
+ logit(LOG_INFO, "SSL Client Certs: %s",
+ sslprm.client_certs == 0 ? "Don't Ask" : (sslprm.client_certs ==
+ 1 ? "Accept" : "Require"));
+ logit(LOG_INFO, "SSL Log Options: 0x%02x", sslprm.log_opts);
+ switch (sslprm.ssl_proto_ver) {
+ case SSLv2:
+ vers = "SSLv2";
+ break;
+ case SSLv2_plus:
+ vers = "SSLv2 And Above";
+ break;
+ case SSLv3:
+ vers = "SSLv3";
+ break;
+ case SSLv3_plus:
+ vers = "SSLv3 And Above";
+ break;
+ case TLSv1:
+ vers = "TLSv1";
+ break;
+ case TLSv1_plus:
+ vers = "TLSv1 And Above";
+ break;
+ case TLSv1_1:
+ vers = "TLSv1_1";
+ break;
+ case TLSv1_1_plus:
+ vers = "TLSv1_1 And Above";
+ break;
+ case TLSv1_2:
+ vers = "TLSv1_2";
+ break;
+ case TLSv1_2_plus:
+ vers = "TLSv1_2 And Above";
+ break;
+ default:
+ vers = "INVALID VALUE!";
+ break;
+ }
+ logit(LOG_INFO, "SSL Version: %s", vers);
+#endif
+}
+
+void usage(int result)
+{
+ if (result != OK) {
+ printf("\n");
+ printf("Incorrect command line arguments supplied\n");
+ printf("\n");
+ }
+ printf("NRPE - Nagios Remote Plugin Executor\n");
+ printf("Version: %s\n", PROGRAM_VERSION);
+ printf("\n");
+ if (result != OK || show_help == TRUE) {
+ printf("Copyright (c) 2009-2017 Nagios Enterprises\n");
+ printf(" 1999-2008 Ethan Galstad (nagios@nagios.org)\n");
+ printf("\n");
+ printf("Last Modified: %s\n", MODIFICATION_DATE);
+ printf("\n");
+ printf("License: GPL v2 with exemptions (-l for more info)\n");
+ printf("\n");
+#ifdef HAVE_SSL
+ printf("SSL/TLS Available, OpenSSL 0.9.6 or higher required\n");
+ printf("\n");
+#endif
+#ifdef HAVE_LIBWRAP
+ printf("TCP Wrappers Available\n");
+ printf("\n");
+#endif
+#ifdef ENABLE_COMMAND_ARGUMENTS
+ printf("***************************************************************\n");
+ printf("** POSSIBLE SECURITY RISK - COMMAND ARGUMENTS ARE SUPPORTED! **\n");
+ printf("** Read the NRPE SECURITY file for more information **\n");
+ printf("***************************************************************\n");
+ printf("\n");
+#endif
+#ifndef HAVE_LIBWRAP
+ printf("***************************************************************\n");
+ printf("** POSSIBLE SECURITY RISK - TCP WRAPPERS ARE NOT AVAILABLE! **\n");
+ printf("** Read the NRPE SECURITY file for more information **\n");
+ printf("***************************************************************\n");
+ printf("\n");
+#endif
+ printf("Usage: nrpe [-V] [-n] -c <config_file> [-4|-6] <mode>\n");
+ printf("\n");
+ printf("Options:\n");
+ printf(" -V, --version Print version info and quit\n");
+ printf(" -n, --no-ssl Do not use SSL\n");
+ printf(" -c, --config=FILE Name of config file to use\n");
+ printf(" -4, --ipv4 Use ipv4 only\n");
+ printf(" -6, --ipv6 Use ipv6 only\n");
+ printf(" <mode> (One of the following operating modes)\n");
+ printf(" -i, --inetd Run as a service under inetd or xinetd\n");
+ printf(" -d, --daemon Run as a standalone daemon\n");
+ printf(" -s, --src Run as a subsystem under AIX\n");
+ printf(" -f, --no-forking Don't fork() (for systemd, launchd, etc.)\n");
+ printf("\n");
+ printf("Notes:\n");
+ printf("This program is designed to process requests from the check_nrpe\n");
+ printf("plugin on the host(s) running Nagios. It can run as a service\n");
+ printf("under inetd or xinetd (read the docs for info on this), or as a\n");
+ printf("standalone daemon. Once a request is received from an authorized\n");
+ printf("host, NRPE will execute the command/plugin (as defined in the\n");
+ printf("config file) and return the plugin output and return code to the\n");
+ printf("check_nrpe plugin.\n");
+ printf("\n");
+ }
+
+ if (show_license == TRUE)
+ display_license();
+
+ exit(STATE_UNKNOWN);
+}
+
+void run_inetd(void)
+{
+ check_privileges(); /* make sure we're not root */
+ close(2); /* redirect STDERR to /dev/null */
+ open("/dev/null", O_WRONLY);
+ handle_connection(0); /* handle the connection */
+}
+
+void run_src(void)
+{
+ /* if we're running under SRC we don't fork but does drop-privileges */
+
+ set_stdio_sigs();
+
+ do {
+ /* reset flags */
+ sigrestart = FALSE;
+ sigshutdown = FALSE;
+
+ wait_for_connections(); /* wait for connections */
+ cleanup();
+ } while (sigrestart == TRUE && sigshutdown == FALSE);
+}
+
+/* daemonize and start listening for requests... */
+void run_daemon(void)
+{
+ pid_t pid;
+
+ pid = fork();
+
+ if (pid != 0) {
+ if (pid == -1) {
+ logit(LOG_ERR, "fork() failed with error %d, bailing out...", errno);
+ exit(STATE_CRITICAL);
+ }
+
+ return;
+ }
+
+ setsid(); /* we're a daemon - set up a new process group */
+ set_stdio_sigs();
+
+ do {
+ /* reset flags */
+ sigrestart = FALSE;
+ sigshutdown = FALSE;
+
+ wait_for_connections(); /* wait for connections */
+ cleanup();
+ } while (sigrestart == TRUE && sigshutdown == FALSE);
+}
+
+void set_stdio_sigs(void)
+{
+#ifdef HAVE_SIGACTION
+ struct sigaction sig_action;
+#endif
+
+ if (chdir("/") == -1) {
+ printf("ERROR: chdir(): %s, bailing out...\n", strerror(errno));
+ exit(STATE_CRITICAL);
+ }
+
+ close(0); /* close standard file descriptors */
+ close(1);
+ close(2);
+ open("/dev/null", O_RDONLY); /* redirect standard descriptors to /dev/null */
+ open("/dev/null", O_WRONLY);
+ open("/dev/null", O_WRONLY);
+
+ /* handle signals */
+#ifdef HAVE_SIGACTION
+ sig_action.sa_sigaction = NULL;
+ sig_action.sa_handler = sighandler;
+ sigfillset(&sig_action.sa_mask);
+ sig_action.sa_flags = SA_NODEFER | SA_RESTART;
+ sigaction(SIGQUIT, &sig_action, NULL);
+ sigaction(SIGTERM, &sig_action, NULL);
+ sigaction(SIGHUP, &sig_action, NULL);
+#else /* HAVE_SIGACTION */
+ signal(SIGQUIT, sighandler);
+ signal(SIGTERM, sighandler);
+ signal(SIGHUP, sighandler);
+#endif /* HAVE_SIGACTION */
+
+ logit(LOG_NOTICE, "Starting up daemon"); /* log info */
+ if (write_pid_file() == ERROR) /* write pid file */
+ exit(STATE_CRITICAL);
+
+ clean_environ(keep_env_vars, nrpe_user);
+
+ /* drop and then check privileges */
+ drop_privileges(nrpe_user, nrpe_group, 0);
+ check_privileges();
+}
+
+void cleanup(void)
+{
+ int result;
+
+ free_memory(); /* free all memory we allocated */
+
+ if (sigrestart == TRUE && sigshutdown == FALSE) {
+ close_log_file();
+ result = read_config_file(config_file); /* read the config file */
+
+ if (result == ERROR) { /* exit if there are errors... */
+ logit(LOG_ERR, "Config file '%s' contained errors, bailing out...", config_file);
+ exit(STATE_CRITICAL);
+ }
+ return;
+ }
+
+ remove_pid_file(); /* remove pid file */
+ logit(LOG_NOTICE, "Daemon shutdown\n");
+
+ close_log_file(); /* close the log file */
+}
+
+#ifdef HAVE_SSL
+int verify_callback(int preverify_ok, X509_STORE_CTX * ctx)
+{
+ char name[256], issuer[256];
+ X509 *err_cert;
+ int err;
+ SSL *ssl;
+
+ if (preverify_ok || ((sslprm.log_opts & SSL_LogCertDetails) == 0))
+ return preverify_ok;
+
+ err_cert = X509_STORE_CTX_get_current_cert(ctx);
+ err = X509_STORE_CTX_get_error(ctx);
+
+ /* Get the pointer to the SSL of the current connection */
+ ssl = X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx());
+
+ X509_NAME_oneline(X509_get_subject_name(err_cert), name, 256);
+ X509_NAME_oneline(X509_get_issuer_name(err_cert), issuer, 256);
+
+ if (!preverify_ok && (sslprm.log_opts & SSL_LogCertDetails)) {
+ logit(LOG_ERR, "SSL Client has an invalid certificate: %s (issuer=%s) err=%d:%s",
+ name, issuer, err, X509_verify_cert_error_string(err));
+ }
+
+ return preverify_ok;
+}
+#endif
+
+/* read in the configuration file */
+int read_config_file(char *filename)
+{
+ struct stat st;
+ FILE *fp;
+ char config_file[MAX_FILENAME_LENGTH];
+ char input_buffer[MAX_INPUT_BUFFER];
+ char *input_line;
+ char *temp_buffer;
+ char *varname;
+ char *varvalue;
+ int line = 0;
+ int len = 0;
+ int x = 0;
+
+ fp = fopen(filename, "r"); /* open the config file for reading */
+
+ /* exit if we couldn't open the config file */
+ if (fp == NULL) {
+ logit(LOG_ERR, "Unable to open config file '%s' for reading\n", filename);
+ return ERROR;
+ }
+
+ while (fgets(input_buffer, MAX_INPUT_BUFFER - 1, fp)) {
+ line++;
+ input_line = input_buffer;
+
+ /* skip leading whitespace */
+ while (isspace(*input_line))
+ ++input_line;
+
+ /* trim trailing whitespace */
+ len = strlen(input_line);
+ for (x = len - 1; x >= 0; x--) {
+ if (isspace(input_line[x]))
+ input_line[x] = '\x0';
+ else
+ break;
+ }
+
+ /* skip comments and blank lines */
+ if (input_line[0] == '#' || input_line[0] == '\x0' || input_line[0] == '\n')
+ continue;
+
+ /* get the variable name */
+ varname = strtok(input_line, "=");
+ if (varname == NULL) {
+ logit(LOG_ERR, "No variable name specified in config file '%s' - Line %d\n",
+ filename, line);
+ return ERROR;
+ }
+
+ /* get the variable value */
+ varvalue = strtok(NULL, "\n");
+ if (varvalue == NULL) {
+ logit(LOG_ERR, "No variable value specified in config file '%s' - Line %d\n",
+ filename, line);
+ return ERROR;
+
+ } else if (!strcmp(varname, "include_dir")) {
+ /* allow users to specify directories to recurse into for config files */
+
+ strncpy(config_file, varvalue, sizeof(config_file) - 1);
+ config_file[sizeof(config_file) - 1] = '\x0';
+
+ /* strip trailing / if necessary */
+ if (config_file[strlen(config_file) - 1] == '/')
+ config_file[strlen(config_file) - 1] = '\x0';
+
+ /* process the config directory... */
+ if (read_config_dir(config_file) == ERROR)
+ logit(LOG_ERR, "Continuing with errors...");
+
+ } else if (!strcmp(varname, "include") || !strcmp(varname, "include_file")) {
+ /* allow users to specify individual config files to include */
+
+ /* process the config file... */
+ if (read_config_file(varvalue) == ERROR)
+ logit(LOG_ERR, "Continuing with errors...");
+
+ } else if (!strcmp(varname, "max_commands")) {
+
+ max_commands = atoi(varvalue);
+ if (max_commands < 0) {
+ logit(LOG_WARNING, "max_commands set too low, setting to 0\n");
+ max_commands = 0;
+ }
+
+ } else if (!strcmp(varname, "server_port")) {
+ server_port = atoi(varvalue);
+ if (server_port < 1024) {
+ logit(LOG_ERR,
+ "Invalid port number specified in config file '%s' - Line %d\n",
+ filename, line);
+ return ERROR;
+ }
+
+ } else if (!strcmp(varname, "command_prefix"))
+ command_prefix = strdup(varvalue);
+
+ else if (!strcmp(varname, "server_address")) {
+ strncpy(server_address, varvalue, sizeof(server_address) - 1);
+ server_address[sizeof(server_address) - 1] = '\0';
+
+ } else if (!strcmp(varname, "allowed_hosts")) {
+ allowed_hosts = strdup(varvalue);
+ parse_allowed_hosts(allowed_hosts);
+ if (debug == TRUE)
+ show_acl_lists();
+
+ } else if (strstr(input_line, "command[")) {
+ temp_buffer = strtok(varname, "[");
+ temp_buffer = strtok(NULL, "]");
+ if (temp_buffer == NULL) {
+ logit(LOG_ERR, "Invalid command specified in config file '%s' - Line %d\n",
+ filename, line);
+ return ERROR;
+ }
+ add_command(temp_buffer, varvalue);
+
+ } else if (strstr(input_buffer, "debug")) {
+ debug = atoi(varvalue);
+ if (debug > 0)
+ debug = TRUE;
+ else
+ debug = FALSE;
+
+ } else if (!strcmp(varname, "nrpe_user"))
+ nrpe_user = strdup(varvalue);
+
+ else if (!strcmp(varname, "nrpe_group"))
+ nrpe_group = strdup(varvalue);
+
+ else if (!strcmp(varname, "dont_blame_nrpe"))
+ allow_arguments = (atoi(varvalue) == 1) ? TRUE : FALSE;
+
+ else if (!strcmp(varname, "allow_bash_command_substitution"))
+ allow_bash_cmd_subst = (atoi(varvalue) == 1) ? TRUE : FALSE;
+
+ else if (!strcmp(varname, "command_timeout")) {
+ command_timeout = atoi(varvalue);
+ if (command_timeout < 1) {
+ logit(LOG_ERR,
+ "Invalid command_timeout specified in config file '%s' - Line %d\n",
+ filename, line);
+ return ERROR;
+ }
+ } else if (!strcmp(varname, "connection_timeout")) {
+ connection_timeout = atoi(varvalue);
+ if (connection_timeout < 1) {
+ logit(LOG_ERR,
+ "Invalid connection_timeout specified in config file '%s' - Line %d\n",
+ filename, line);
+ return ERROR;
+ }
+
+ } else if (!strcmp(varname, "ssl_shutdown_timeout")) {
+ ssl_shutdown_timeout = atoi(varvalue);
+ if (ssl_shutdown_timeout < 1) {
+ logit(LOG_ERR,
+ "Invalid ssl_shutdown_timeout specified in config file '%s' - Line %d\n",
+ filename, line);
+ return ERROR;
+ }
+
+ } else if (!strcmp(varname, "allow_weak_random_seed"))
+ allow_weak_random_seed = (atoi(varvalue) == 1) ? TRUE : FALSE;
+
+ else if (!strcmp(varname, "pid_file"))
+ pid_file = strdup(varvalue);
+
+ else if (!strcmp(varname, "listen_queue_size")) {
+ listen_queue_size = atoi(varvalue);
+ if (listen_queue_size == 0) {
+ logit(LOG_ERR,
+ "Invalid listen queue size specified in config file '%s' - Line %d\n",
+ filename, line);
+ return ERROR;
+ }
+
+ } else if (!strcmp(varname, "ssl_version")) {
+ if (!strcmp(varvalue, "TLSv1.2"))
+ sslprm.ssl_proto_ver = TLSv1_2;
+ else if (!strcmp(varvalue, "TLSv1.2+"))
+ sslprm.ssl_proto_ver = TLSv1_2_plus;
+ else if (!strcmp(varvalue, "TLSv1.1"))
+ sslprm.ssl_proto_ver = TLSv1_1;
+ else if (!strcmp(varvalue, "TLSv1.1+"))
+ sslprm.ssl_proto_ver = TLSv1_1_plus;
+ else if (!strcmp(varvalue, "TLSv1"))
+ sslprm.ssl_proto_ver = TLSv1;
+ else if (!strcmp(varvalue, "TLSv1+"))
+ sslprm.ssl_proto_ver = TLSv1_plus;
+ else if (!strcmp(varvalue, "SSLv3"))
+ sslprm.ssl_proto_ver = SSLv3;
+ else if (!strcmp(varvalue, "SSLv3+"))
+ sslprm.ssl_proto_ver = SSLv3_plus;
+#if OPENSSL_VERSION_NUMBER < 0x10100000
+ else if (!strcmp(varvalue, "SSLv2"))
+ sslprm.ssl_proto_ver = SSLv2;
+ else if (!strcmp(varvalue, "SSLv2+"))
+ sslprm.ssl_proto_ver = SSLv2_plus;
+#endif /* OPENSSL_VERSION_NUMBER < 0x10100000 */
+ else {
+ logit(LOG_ERR, "Invalid ssl version specified in config file '%s' - Line %d",
+ filename, line);
+ return ERROR;
+ }
+
+ } else if (!strcmp(varname, "ssl_use_adh")) {
+ sslprm.allowDH = atoi(varvalue);
+ if (sslprm.allowDH < 0 || sslprm.allowDH > 2) {
+ logit(LOG_ERR,
+ "Invalid use adh value specified in config file '%s' - Line %d",
+ filename, line);
+ return ERROR;
+ }
+
+ } else if (!strcmp(varname, "ssl_logging"))
+ sslprm.log_opts = strtoul(varvalue, NULL, 0);
+
+ else if (!strcmp(varname, "ssl_cipher_list")) {
+ strncpy(sslprm.cipher_list, varvalue, sizeof(sslprm.cipher_list) - 1);
+ sslprm.cipher_list[sizeof(sslprm.cipher_list) - 1] = '\0';
+
+ } else if (!strcmp(varname, "ssl_cert_file"))
+ sslprm.cert_file = strdup(varvalue);
+
+ else if (!strcmp(varname, "ssl_cacert_file"))
+ sslprm.cacert_file = strdup(varvalue);
+
+ else if (!strcmp(varname, "ssl_privatekey_file"))
+ sslprm.privatekey_file = strdup(varvalue);
+
+ else if (!strcmp(varname, "ssl_client_certs")) {
+ sslprm.client_certs = atoi(varvalue);
+ if ((int)sslprm.client_certs < 0 || sslprm.client_certs > Require_Cert) {
+ logit(LOG_ERR,
+ "Invalid client certs value specified in config file '%s' - Line %d",
+ filename, line);
+ return ERROR;
+ }
+ /* if requiring or logging client certs, make sure "Ask" is turned on */
+ if (sslprm.client_certs & Require_Cert)
+ sslprm.client_certs |= Ask_For_Cert;
+
+ } else if (!strcmp(varname, "log_facility")) {
+ if ((get_log_facility(varvalue)) == OK) {
+ /* re-open log using new facility */
+ closelog();
+ openlog("nrpe", LOG_PID, log_facility);
+ } else
+ logit(LOG_WARNING,
+ "Invalid log_facility specified in config file '%s' - Line %d\n",
+ filename, line);
+
+ } else if (!strcmp(varname, "keep_env_vars"))
+ keep_env_vars = strdup(varvalue);
+
+ else if (!strcmp(varname, "nasty_metachars"))
+ nasty_metachars = strdup(varvalue);
+
+ else if (!strcmp(varname, "log_file")) {
+ log_file = strdup(varvalue);
+ open_log_file();
+
+ } else {
+ logit(LOG_WARNING, "Unknown option specified in config file '%s' - Line %d\n",
+ filename, line);
+ continue;
+ }
+ }
+
+ fclose(fp); /* close the config file */
+ return OK;
+}
+
+/* process all config files in a specific config directory (with directory recursion) */
+int read_config_dir(char *dirname)
+{
+ struct dirent *dirfile;
+#ifdef HAVE_SCANDIR
+ struct dirent **dirfiles;
+ int x, i, n;
+#else
+ DIR *dirp;
+ int x;
+#endif
+ struct stat buf;
+ char config_file[MAX_FILENAME_LENGTH];
+ int result = OK;
+
+#ifdef HAVE_SCANDIR
+ /* read and sort the directory contents */
+ n = scandir(dirname, &dirfiles, 0, alphasort);
+ if (n < 0) {
+ logit(LOG_ERR, "Could not open config directory '%s' for reading.\n", dirname);
+ return ERROR;
+ }
+
+ for (i = 0; i < n; i++) {
+ dirfile = dirfiles[i];
+#else
+ /* open the directory for reading */
+ dirp = opendir(dirname);
+ if (dirp == NULL) {
+ logit(LOG_ERR, "Could not open config directory '%s' for reading.\n", dirname);
+ return ERROR;
+ }
+
+ while ((dirfile = readdir(dirp)) != NULL) {
+#endif
+
+ /* process all files in the directory... */
+
+ /* create the full path to the config file or subdirectory */
+ snprintf(config_file, sizeof(config_file) - 1, "%s/%s", dirname, dirfile->d_name);
+ config_file[sizeof(config_file) - 1] = '\x0';
+ stat(config_file, &buf);
+
+ /* process this if it's a config file... */
+ x = strlen(dirfile->d_name);
+ if (x > 4 && !strcmp(dirfile->d_name + (x - 4), ".cfg")) {
+
+ /* only process normal files */
+ if (!S_ISREG(buf.st_mode))
+ continue;
+
+ /* process the config file */
+ result = read_config_file(config_file);
+
+ /* break out if we encountered an error */
+ if (result == ERROR)
+ break;
+ }
+
+ /* recurse into subdirectories... */
+ if (S_ISDIR(buf.st_mode)) {
+
+ /* ignore current, parent and hidden directory entries */
+ if (dirfile->d_name[0] == '.')
+ continue;
+
+ /* process the config directory */
+ result = read_config_dir(config_file);
+
+ /* break out if we encountered an error */
+ if (result == ERROR)
+ break;
+
+ }
+ }
+
+#ifdef HAVE_SCANDIR
+ for (i = 0; i < n; i++)
+ free(dirfiles[i]);
+ free(dirfiles);
+#else
+ closedir(dirp);
+#endif
+
+ return result;
+}
+
+/* determines facility to use with syslog */
+int get_log_facility(char *varvalue)
+{
+ if (!strcmp(varvalue, "kern"))
+ log_facility = LOG_KERN;
+ else if (!strcmp(varvalue, "user"))
+ log_facility = LOG_USER;
+ else if (!strcmp(varvalue, "mail"))
+ log_facility = LOG_MAIL;
+ else if (!strcmp(varvalue, "daemon"))
+ log_facility = LOG_DAEMON;
+ else if (!strcmp(varvalue, "auth"))
+ log_facility = LOG_AUTH;
+ else if (!strcmp(varvalue, "syslog"))
+ log_facility = LOG_SYSLOG;
+ else if (!strcmp(varvalue, "lrp"))
+ log_facility = LOG_LPR;
+ else if (!strcmp(varvalue, "news"))
+ log_facility = LOG_NEWS;
+ else if (!strcmp(varvalue, "uucp"))
+ log_facility = LOG_UUCP;
+ else if (!strcmp(varvalue, "cron"))
+ log_facility = LOG_CRON;
+ else if (!strcmp(varvalue, "authpriv"))
+ log_facility = LOG_AUTHPRIV;
+ else if (!strcmp(varvalue, "ftp"))
+ log_facility = LOG_FTP;
+ else if (!strcmp(varvalue, "local0"))
+ log_facility = LOG_LOCAL0;
+ else if (!strcmp(varvalue, "local1"))
+ log_facility = LOG_LOCAL1;
+ else if (!strcmp(varvalue, "local2"))
+ log_facility = LOG_LOCAL2;
+ else if (!strcmp(varvalue, "local3"))
+ log_facility = LOG_LOCAL3;
+ else if (!strcmp(varvalue, "local4"))
+ log_facility = LOG_LOCAL4;
+ else if (!strcmp(varvalue, "local5"))
+ log_facility = LOG_LOCAL5;
+ else if (!strcmp(varvalue, "local6"))
+ log_facility = LOG_LOCAL6;
+ else if (!strcmp(varvalue, "local7"))
+ log_facility = LOG_LOCAL7;
+ else {
+ log_facility = LOG_DAEMON;
+ return ERROR;
+ }
+
+ return OK;
+}
+
+/* adds a new command definition from the config file to the list in memory */
+int add_command(char *command_name, char *command_line)
+{
+ command *new_command;
+
+ if (command_name == NULL || command_line == NULL)
+ return ERROR;
+
+ /* allocate memory for the new command */
+ new_command = (command *) malloc(sizeof(command));
+ if (new_command == NULL)
+ return ERROR;
+
+ new_command->command_name = strdup(command_name);
+ if (new_command->command_name == NULL) {
+ free(new_command);
+ return ERROR;
+ }
+ new_command->command_line = strdup(command_line);
+ if (new_command->command_line == NULL) {
+ free(new_command->command_name);
+ free(new_command);
+ return ERROR;
+ }
+
+ /* add new command to head of list in memory */
+ new_command->next = command_list;
+ command_list = new_command;
+
+ if (debug == TRUE)
+ logit(LOG_DEBUG, "Added command[%s]=%s\n", command_name, command_line);
+
+ return OK;
+}
+
+/* given a command name, find the structure in memory */
+command *find_command(char *command_name)
+{
+ command *temp_command;
+
+ for (temp_command = command_list; temp_command != NULL; temp_command = temp_command->next)
+ if (!strcmp(command_name, temp_command->command_name))
+ return temp_command;
+
+ return NULL;
+}
+
+/* Start listen on a particular port */
+void create_listener(struct addrinfo *ai)
+{
+ int ret;
+ char ntop[NI_MAXHOST], strport[NI_MAXSERV];
+ int listen_sock;
+ int flag = 1;
+
+ if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
+ return;
+
+ if (num_listen_socks >= MAX_LISTEN_SOCKS) {
+ logit(LOG_ERR, "Too many listen sockets. Enlarge MAX_LISTEN_SOCKS");
+ exit(1);
+ }
+
+ if ((ret = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop, sizeof(ntop),
+ strport, sizeof(strport), NI_NUMERICHOST | NI_NUMERICSERV)) != 0) {
+ logit(LOG_ERR, "getnameinfo failed: %.100s", gai_strerror(ret));
+ return;
+ }
+
+ /* Create socket for listening. */
+ listen_sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
+ if (listen_sock < 0) {
+ /* kernel may not support ipv6 */
+ logit(LOG_ERR, "socket: %.100s", strerror(errno));
+ return;
+ }
+
+ /* socket should be non-blocking */
+ fcntl(listen_sock, F_SETFL, O_NONBLOCK);
+
+ /* set the reuse address flag so we don't get errors when restarting */
+ if (setsockopt(listen_sock, SOL_SOCKET, SO_REUSEADDR, &flag, sizeof(flag)) < 0) {
+ logit(LOG_ERR, "setsockopt SO_REUSEADDR: %s", strerror(errno));
+ return;
+ }
+#ifdef IPV6_V6ONLY
+ /* Only communicate in IPv6 over AF_INET6 sockets. */
+ if (ai->ai_family == AF_INET6) {
+ if (setsockopt(listen_sock, IPPROTO_IPV6, IPV6_V6ONLY, &flag, sizeof(flag)) == -1) {
+ fprintf(stderr, "setsockopt IPV6_V6ONLY: %s", strerror(errno));
+ }
+ }
+#endif
+
+ /* Bind the socket to the desired port. */
+ if (bind(listen_sock, ai->ai_addr, ai->ai_addrlen) < 0) {
+ logit(LOG_ERR, "Bind to port %s on %s failed: %.200s.",
+ strport, ntop, strerror(errno));
+ close(listen_sock);
+ return;
+ }
+ listen_socks[num_listen_socks] = listen_sock;
+ num_listen_socks++;
+
+ /* Start listening on the port. */
+ if (listen(listen_sock, listen_queue_size) < 0) {
+ logit(LOG_ERR, "listen on [%s]:%s: %.100s", ntop, strport, strerror(errno));
+ exit(1);
+ }
+
+ logit(LOG_INFO, "Server listening on %s port %s.", ntop, strport);
+}
+
+/* Close all listening sockets */
+static void close_listen_socks(void)
+{
+ int i;
+
+ for (i = 0; i <= num_listen_socks; i++) {
+ close(listen_socks[i]);
+ num_listen_socks--;
+ }
+}
+
+/* wait for incoming connection requests */
+void wait_for_connections(void)
+{
+#ifdef HAVE_STRUCT_SOCKADDR_STORAGE
+ struct sockaddr_storage from;
+#else
+ struct sockaddr from;
+#endif
+ socklen_t fromlen;
+ fd_set *fdset = NULL;
+ int maxfd = 0, new_sd = 0, i, rc, retval;
+
+ setup_wait_conn();
+
+ /* listen for connection requests - fork() if we get one */
+ while (1) {
+ /* bail out if necessary */
+ if (sigrestart == TRUE || sigshutdown == TRUE)
+ break;
+
+ for (i = 0; i < num_listen_socks; i++) {
+ if (listen_socks[i] > maxfd)
+ maxfd = listen_socks[i];
+ }
+
+ if (fdset != NULL)
+ free(fdset);
+ fdset = (fd_set *) calloc(how_many(maxfd + 1, NFDBITS), sizeof(fd_mask));
+
+ for (i = 0; i < num_listen_socks; i++)
+ FD_SET(listen_socks[i], fdset);
+
+ /* Wait in select until there is a connection. */
+ retval = select(maxfd + 1, fdset, NULL, NULL, NULL);
+
+ /* bail out if necessary */
+ if (sigrestart == TRUE || sigshutdown == TRUE)
+ break;
+
+ /* error */
+ if (retval < 0)
+ continue;
+
+ for (i = 0; i < num_listen_socks; i++) {
+ if (!FD_ISSET(listen_socks[i], fdset))
+ continue;
+ fromlen = (socklen_t)sizeof(from);
+
+ /* accept a new connection request */
+ new_sd = accept(listen_socks[i], (struct sockaddr *)&from, &fromlen);
+
+ /* some kind of error occurred... */
+ if (new_sd < 0) {
+ /* bail out if necessary */
+ if (sigrestart == TRUE || sigshutdown == TRUE)
+ break;
+ if (errno == EWOULDBLOCK || errno == EINTR) /* retry */
+ continue;
+ /* socket is nonblocking and we don't have a connection yet */
+ if (errno == EAGAIN)
+ continue;
+ if (errno == ENOBUFS) /* fix for HP-UX 11.0 - just retry */
+ continue;
+
+ break; /* else handle the error later */
+ }
+
+
+ rc = wait_conn_fork(new_sd);
+ if (rc == TRUE)
+ continue; /* Continue if this is the parent returning */
+
+ /* grandchild running here */
+ conn_check_peer(new_sd);
+
+ /* handle the client connection */
+ handle_connection(new_sd);
+
+ /* log info */
+ if (debug == TRUE)
+ logit(LOG_DEBUG, "Connection from %s closed.", remote_host);
+
+ /* close socket prior to exiting */
+ close(new_sd);
+
+ exit(STATE_OK);
+
+ }
+ }
+
+ /* close the sockets we're listening on */
+ close_listen_socks();
+ freeaddrinfo(listen_addrs);
+ listen_addrs = NULL;
+
+ return;
+}
+
+void setup_wait_conn(void)
+{
+ struct addrinfo *ai;
+ char addrstr[100];
+ void *ptr;
+
+ add_listen_addr(&listen_addrs, address_family,
+ (strcmp(server_address, "") == 0) ? NULL : server_address, server_port);
+
+ for (ai = listen_addrs; ai; ai = ai->ai_next) {
+ if (debug == TRUE) {
+ inet_ntop (ai->ai_family, ai->ai_addr->sa_data, addrstr, 100);
+ ptr = &((struct sockaddr_in *) ai->ai_addr)->sin_addr;
+ inet_ntop (ai->ai_family, ptr, addrstr, 100);
+ logit(LOG_INFO, "SETUP_WAIT_CONN FOR: IPv4 address: %s (%s)\n", addrstr, ai->ai_canonname);
+ }
+ create_listener(ai);
+ }
+
+ if (!num_listen_socks) {
+ logit(LOG_ERR, "Cannot bind to any address.");
+ exit(1);
+ }
+
+ /* log warning about command arguments */
+#ifdef ENABLE_COMMAND_ARGUMENTS
+ if (allow_arguments == TRUE)
+ logit(LOG_NOTICE,
+ "Warning: Daemon is configured to accept command arguments from clients!");
+# ifdef ENABLE_BASH_COMMAND_SUBSTITUTION
+ if (TRUE == allow_bash_cmd_subst) {
+ if (TRUE == allow_arguments)
+ logit(LOG_NOTICE,
+ "Warning: Daemon is configured to accept command arguments with bash command substitutions!");
+ else
+ logit(LOG_NOTICE,
+ "Warning: Daemon is configured to accept command arguments with bash command substitutions, but is not configured to accept command arguments from clients. Enable command arguments if you wish to allow command arguments with bash command substitutions.");
+ }
+# endif
+#endif
+
+ logit(LOG_INFO, "Listening for connections on port %d", server_port);
+
+ if (allowed_hosts)
+ logit(LOG_INFO, "Allowing connections from: %s\n", allowed_hosts);
+}
+
+int wait_conn_fork(int sock)
+{
+#ifdef HAVE_SIGACTION
+ struct sigaction sig_action;
+#endif
+ pid_t pid;
+
+ /* child process should handle the connection */
+ pid = fork();
+
+ if (pid > 0) {
+ close(sock); /* parent doesn't need the new connection */
+ waitpid(pid, NULL, 0); /* parent waits for first child to exit */
+ return TRUE; /* tell caller this is the parent process */
+ }
+
+ if (pid < 0) {
+ logit(LOG_ERR, "fork() failed with error %d, bailing out...", errno);
+ exit(STATE_CRITICAL);
+ }
+
+ /* fork again so we don't create zombies */
+ pid = fork();
+
+ if (pid < 0) {
+ logit(LOG_ERR, "Second fork() failed with error %d, bailing out...", errno);
+ exit(STATE_CRITICAL);
+ }
+
+ if (pid > 0) {
+ /* first child returns immediately, grandchild is inherited by
+ INIT process -> no zombies... */
+ exit(STATE_OK);
+ }
+
+ /* hey, there was an error... */
+ if (sock < 0) {
+ /* log error */
+ logit(LOG_ERR, "Network server accept failure (%d: %s)",
+ errno, strerror(errno));
+ exit(STATE_OK);
+ }
+
+ /* all good - handle signals */
+#ifdef HAVE_SIGACTION
+ sig_action.sa_sigaction = NULL;
+ sig_action.sa_handler = child_sighandler;
+ sigfillset(&sig_action.sa_mask);
+ sig_action.sa_flags = SA_NODEFER | SA_RESTART;
+ sigaction(SIGQUIT, &sig_action, NULL);
+ sigaction(SIGTERM, &sig_action, NULL);
+ sigaction(SIGHUP, &sig_action, NULL);
+#else /* HAVE_SIGACTION */
+ signal(SIGQUIT, child_sighandler);
+ signal(SIGTERM, child_sighandler);
+ signal(SIGHUP, child_sighandler);
+#endif /* HAVE_SIGACTION */
+
+ close_listen_socks(); /* grandchild does not need to listen */
+
+ return FALSE; /* tell caller this isn't the parent process */
+}
+
+void conn_check_peer(int sock)
+{
+#ifdef HAVE_LIBWRAP
+ struct request_info req;
+#endif
+#ifdef HAVE_STRUCT_SOCKADDR_STORAGE
+ struct sockaddr_storage addr;
+#else
+ struct sockaddr addr;
+#endif
+ struct sockaddr_in *nptr;
+ struct sockaddr_in6 *nptr6;
+
+ char ipstr[INET6_ADDRSTRLEN];
+ socklen_t addrlen;
+ int rc;
+
+ /* find out who just connected... */
+ addrlen = sizeof(addr);
+ rc = getpeername(sock, (struct sockaddr *)&addr, &addrlen);
+
+ if (rc < 0) {
+ /* log error */
+ logit(LOG_ERR, "Error: Network server getpeername() failure (%d: %s)",
+ errno, strerror(errno));
+
+ /* close socket prior to exiting */
+ close(sock);
+ return;
+ }
+
+#ifdef HAVE_STRUCT_SOCKADDR_STORAGE
+ switch (addr.ss_family) {
+#else
+ switch (addr.sa_family) {
+#endif
+
+ case AF_INET:
+ nptr = (struct sockaddr_in *)&addr;
+ strncpy(remote_host, inet_ntoa(nptr->sin_addr), sizeof(remote_host) - 1);
+ remote_host[MAX_HOST_ADDRESS_LENGTH - 1] = '\0';
+ break;
+
+ case AF_INET6:
+ nptr6 = (struct sockaddr_in6 *)&addr;
+ if (inet_ntop(AF_INET6, (const void *)&(nptr6->sin6_addr),
+ ipstr, sizeof(ipstr)) == NULL) {
+ strncpy(ipstr, "Unknown", sizeof(ipstr));
+ }
+ strncpy(remote_host, ipstr, sizeof(remote_host) - 1);
+ remote_host[MAX_HOST_ADDRESS_LENGTH - 1] = '\0';
+ break;
+ }
+
+ if (debug == TRUE)
+ logit(LOG_INFO, "CONN_CHECK_PEER: checking if host is allowed: %s port %d\n",
+ remote_host, nptr->sin_port);
+
+ /* is this host allowed? */
+ if (allowed_hosts) {
+#ifdef HAVE_STRUCT_SOCKADDR_STORAGE
+ switch (addr.ss_family) {
+#else
+ switch (addr.sa_family) {
+#endif
+
+ case AF_INET:
+ /* log info */
+ if (debug == TRUE || (sslprm.log_opts & SSL_LogIpAddr))
+ logit(LOG_DEBUG, "Connection from %s port %d", remote_host, nptr->sin_port);
+
+ if (!is_an_allowed_host(AF_INET, (void *)&(nptr->sin_addr))) {
+ /* log error */
+ logit(LOG_ERR, "Host %s is not allowed to talk to us!", remote_host);
+
+ /* log info */
+ if (debug == TRUE)
+ logit(LOG_DEBUG, "Connection from %s closed.", remote_host);
+
+ /* close socket prior to exiting */
+ close(sock);
+ exit(STATE_OK);
+
+ } else {
+
+ /* log info */
+ if (debug == TRUE) {
+ logit(LOG_DEBUG, "Host address is in allowed_hosts");
+ }
+
+ }
+ break;
+
+ case AF_INET6:
+ /* log info */
+ strcpy(remote_host, ipstr);
+ if (debug == TRUE || (sslprm.log_opts & SSL_LogIpAddr)) {
+ logit(LOG_DEBUG, "Connection from %s port %d", ipstr, nptr6->sin6_port);
+ }
+
+ if (!is_an_allowed_host(AF_INET6, (void *)&(nptr6->sin6_addr))) {
+ /* log error */
+ logit(LOG_ERR, "Host %s is not allowed to talk to us!", ipstr);
+
+ /* log info */
+ if (debug == TRUE)
+ logit(LOG_DEBUG, "Connection from %s closed.", ipstr);
+
+ /* close socket prior to exiting */
+ close(sock);
+ exit(STATE_OK);
+
+ } else {
+ /* log info */
+ if (debug == TRUE)
+ logit(LOG_DEBUG, "Host address is in allowed_hosts");
+ }
+ break;
+ }
+ }
+
+#ifdef HAVE_LIBWRAP
+ /* Check whether or not connections are allowed from this host */
+ request_init(&req, RQ_DAEMON, "nrpe", RQ_FILE, sock, 0);
+ fromhost(&req);
+
+ if (!hosts_access(&req)) {
+ logit(LOG_DEBUG, "Connection refused by TCP wrapper");
+ refuse(&req); /* refuse the connection */
+ /* should not be reached */
+ logit(LOG_ERR, "libwrap refuse() returns!");
+ close(sock);
+ exit(STATE_CRITICAL);
+ }
+#endif
+}
+
+/* handles a client connection */
+void handle_connection(int sock)
+{
+ u_int32_t calculated_crc32;
+ command *temp_command;
+ v2_packet receive_packet, send_packet;
+ v3_packet *v3_receive_packet = NULL, *v3_send_packet = NULL;
+ int bytes_to_send;
+ char buffer[MAX_INPUT_BUFFER], *send_buff = NULL, *send_pkt;
+ char raw_command[MAX_INPUT_BUFFER];
+ char processed_command[MAX_INPUT_BUFFER];
+ int result = STATE_OK;
+ int early_timeout = FALSE;
+ int rc;
+ int x;
+ int32_t pkt_size;
+#ifdef DEBUG
+ FILE *errfp;
+#endif
+#ifdef HAVE_SSL
+ SSL *ssl = NULL;
+#endif
+
+ /* do SSL handshake */
+#ifdef HAVE_SSL
+ if (use_ssl == TRUE) {
+ if ((ssl = SSL_new(ctx)) == NULL) {
+ logit(LOG_ERR, "Error: Could not create SSL connection structure.");
+# ifdef DEBUG
+ errfp = fopen("/tmp/err.log", "a");
+ ERR_print_errors_fp(errfp);
+ fclose(errfp);
+# endif
+ return;
+ }
+
+ if (handle_conn_ssl(sock, ssl) != OK)
+ return;
+ }
+#endif
+
+#ifdef HAVE_SSL
+ rc = read_packet(sock, ssl, &receive_packet, &v3_receive_packet);
+#else
+ rc = read_packet(sock, NULL, &receive_packet, &v3_receive_packet);
+#endif
+
+ /* disable connection alarm - a new alarm will be setup during my_system */
+ alarm(0);
+
+ /* recv() error or client disconnect */
+ if (rc <= 0) {
+ /* log error */
+ logit(LOG_ERR, "Could not read request from client %s, bailing out...", remote_host);
+ if (v3_receive_packet)
+ free(v3_receive_packet);
+#ifdef HAVE_SSL
+ if (ssl) {
+ complete_SSL_shutdown(ssl);
+ SSL_free(ssl);
+ logit(LOG_INFO, "INFO: SSL Socket Shutdown.\n");
+ }
+#endif
+ return;
+ }
+
+ /* make sure the request is valid */
+ if (validate_request(&receive_packet, v3_receive_packet) == ERROR) {
+ /* log an error */
+ logit(LOG_ERR, "Client request from %s was invalid, bailing out...", remote_host);
+
+ /* free memory */
+ free(command_name);
+ command_name = NULL;
+ for (x = 0; x < MAX_COMMAND_ARGUMENTS; x++) {
+ free(macro_argv[x]);
+ macro_argv[x] = NULL;
+ }
+ if (v3_receive_packet)
+ free(v3_receive_packet);
+
+#ifdef HAVE_SSL
+ if (ssl) {
+ complete_SSL_shutdown(ssl);
+ SSL_free(ssl);
+ }
+#endif
+
+ return;
+ }
+
+ /* log info */
+ if (debug == TRUE)
+ logit(LOG_DEBUG, "Host %s is asking for command '%s' to be run...",
+ remote_host, command_name);
+
+ /* if this is the version check command, just spew it out */
+ if (!strcmp(command_name, NRPE_HELLO_COMMAND)) {
+ snprintf(buffer, sizeof(buffer), "NRPE v%s", PROGRAM_VERSION);
+ buffer[sizeof(buffer) - 1] = '\x0';
+ if (debug == TRUE) /* log info */
+ logit(LOG_DEBUG, "Response to %s: %s", remote_host, buffer);
+ if (v3_receive_packet)
+ send_buff = strdup(buffer);
+ else {
+ send_buff = calloc(1, sizeof(buffer));
+ strcpy(send_buff, buffer);
+ }
+ result = STATE_OK;
+
+ } else {
+
+ /* find the command we're supposed to run */
+ temp_command = find_command(command_name);
+ if (temp_command == NULL) {
+ snprintf(buffer, sizeof(buffer), "NRPE: Command '%s' not defined", command_name);
+ buffer[sizeof(buffer) - 1] = '\x0';
+ if (debug == TRUE) /* log error */
+ logit(LOG_DEBUG, "%s", buffer);
+ if (v3_receive_packet)
+ send_buff = strdup(buffer);
+ else {
+ send_buff = calloc(1, sizeof(buffer));
+ strcpy(send_buff, buffer);
+ }
+ result = STATE_UNKNOWN;
+
+ } else {
+
+ /* process command line */
+ if (command_prefix == NULL)
+ strncpy(raw_command, temp_command->command_line, sizeof(raw_command) - 1);
+ else
+ snprintf(raw_command, sizeof(raw_command) - 1, "%s %s", command_prefix,
+ temp_command->command_line);
+ raw_command[sizeof(raw_command) - 1] = '\x0';
+ process_macros(raw_command, processed_command, sizeof(processed_command));
+
+ if (debug == TRUE) /* log info */
+ logit(LOG_DEBUG, "Running command: %s", processed_command);
+
+ /* run the command */
+ strcpy(buffer, "");
+ result = my_system(processed_command, command_timeout, &early_timeout, &send_buff);
+
+ if (debug == TRUE) /* log debug info */
+ logit(LOG_DEBUG, "Command completed with return code %d and output: %s",
+ result, send_buff);
+
+ /* see if the command timed out */
+ if (early_timeout == TRUE) {
+ sprintf(send_buff, "NRPE: Command timed out after %d seconds\n",
+ command_timeout);
+ result = STATE_UNKNOWN;
+ } else if (!strcmp(send_buff, "")) {
+ sprintf(send_buff, "NRPE: Unable to read output\n");
+ result = STATE_UNKNOWN;
+ }
+
+ /* check return code bounds */
+ if ((result < 0) || (result > 3)) {
+ /* log error */
+ logit(LOG_ERR, "Bad return code for [%s]: %d", send_buff, result);
+ result = STATE_UNKNOWN;
+ }
+ }
+ }
+
+ /* free memory */
+ free(command_name);
+ command_name = NULL;
+ for (x = 0; x < MAX_COMMAND_ARGUMENTS; x++) {
+ free(macro_argv[x]);
+ macro_argv[x] = NULL;
+ }
+ if (v3_receive_packet)
+ free(v3_receive_packet);
+ pkt_size = strlen(send_buff);
+ /* strip newline character from end of output buffer */
+ if (send_buff[strlen(send_buff) - 1] == '\n')
+ send_buff[strlen(send_buff) - 1] = '\x0';
+
+ if (packet_ver == NRPE_PACKET_VERSION_2) {
+ pkt_size = sizeof(v2_packet);
+ send_pkt = (char *)&send_packet;
+
+ /* clear the response packet buffer */
+ memset(&send_packet, 0, sizeof(send_packet));
+ /* fill the packet with semi-random data */
+ randomize_buffer((char *)&send_packet, sizeof(send_packet));
+
+ /* initialize response packet data */
+ send_packet.packet_version = htons(packet_ver);
+ send_packet.packet_type = htons(RESPONSE_PACKET);
+ send_packet.result_code = htons(result);
+ strncpy(&send_packet.buffer[0], send_buff, MAX_PACKETBUFFER_LENGTH);
+ send_packet.buffer[MAX_PACKETBUFFER_LENGTH - 1] = '\x0';
+
+ /* calculate the crc 32 value of the packet */
+ send_packet.crc32_value = 0;
+ calculated_crc32 = calculate_crc32((char *)&send_packet, sizeof(send_packet));
+ send_packet.crc32_value = htonl(calculated_crc32);
+
+ } else {
+
+ pkt_size = (sizeof(v3_packet) - 1) + strlen(send_buff);
+ v3_send_packet = calloc(1, pkt_size);
+ send_pkt = (char *)v3_send_packet;
+ /* initialize response packet data */
+ v3_send_packet->packet_version = htons(packet_ver);
+ v3_send_packet->packet_type = htons(RESPONSE_PACKET);
+ v3_send_packet->result_code = htons(result);
+ v3_send_packet->alignment = 0;
+ v3_send_packet->buffer_length = htonl(strlen(send_buff));
+ strcpy(&v3_send_packet->buffer[0], send_buff);
+
+ /* calculate the crc 32 value of the packet */
+ v3_send_packet->crc32_value = 0;
+ calculated_crc32 = calculate_crc32((char *)v3_send_packet, pkt_size);
+ v3_send_packet->crc32_value = htonl(calculated_crc32);
+ }
+
+ /* send the response back to the client */
+ bytes_to_send = pkt_size;
+ if (use_ssl == FALSE)
+ sendall(sock, send_pkt, &bytes_to_send);
+#ifdef HAVE_SSL
+ else
+ SSL_write(ssl, send_pkt, bytes_to_send);
+#endif
+
+#ifdef HAVE_SSL
+ if (ssl) {
+ complete_SSL_shutdown(ssl);
+ SSL_free(ssl);
+ }
+#endif
+
+ if (v3_send_packet)
+ free(v3_send_packet);
+
+ /* log info */
+ if (debug == TRUE)
+ logit(LOG_DEBUG, "Return Code: %d, Output: %s", result, send_buff);
+
+ free(send_buff);
+
+ return;
+}
+
+void init_handle_conn(void)
+{
+#ifdef HAVE_SIGACTION
+ struct sigaction sig_action;
+#endif
+
+ /* log info */
+ if (debug == TRUE)
+ logit(LOG_DEBUG, "Handling the connection...");
+
+ /* set connection handler */
+#ifdef HAVE_SIGACTION
+ sig_action.sa_sigaction = NULL;
+ sig_action.sa_handler = my_connection_sighandler;
+ sigfillset(&sig_action.sa_mask);
+ sig_action.sa_flags = SA_NODEFER | SA_RESTART;
+ sigaction(SIGALRM, &sig_action, NULL);
+#else
+ signal(SIGALRM, my_connection_sighandler);
+#endif /* HAVE_SIGACTION */
+ alarm(connection_timeout);
+}
+
+int handle_conn_ssl(int sock, void *ssl_ptr)
+{
+#ifdef HAVE_SSL
+# if (defined(__sun) && defined(SOLARIS_10)) || defined(_AIX) || defined(__hpux)
+ SSL_CIPHER *c;
+#else
+ const SSL_CIPHER *c;
+#endif
+ const char *errmsg = NULL;
+ char buffer[MAX_INPUT_BUFFER];
+ SSL *ssl = (SSL*)ssl_ptr;
+ X509 *peer;
+ int rc, x;
+
+ SSL_set_fd(ssl, sock);
+
+ /* keep attempting the request if needed */
+ while (((rc = SSL_accept(ssl)) != 1)
+ && (SSL_get_error(ssl, rc) == SSL_ERROR_WANT_READ));
+
+ if (rc != 1) {
+ /* oops, got an unrecoverable error -- get out */
+ if (sslprm.log_opts & (SSL_LogCertDetails | SSL_LogIfClientCert)) {
+ int nerrs = 0;
+ rc = 0;
+ while ((x = ERR_get_error_line_data(NULL, NULL, NULL, NULL)) != 0) {
+ errmsg = ERR_reason_error_string(x);
+ logit(LOG_ERR, "Error: (ERR_get_error_line_data = %d), Could not complete SSL handshake with %s: %s", x, remote_host, errmsg);
+
+ if (errmsg && !strcmp(errmsg, "no shared cipher") && (sslprm.cert_file == NULL || sslprm.cacert_file == NULL))
+ logit(LOG_ERR, "Error: This could be because you have not specified certificate or ca-certificate files");
+
+ ++nerrs;
+ }
+
+ if (nerrs == 0) {
+ logit(LOG_ERR, "Error: (nerrs = 0) Could not complete SSL handshake with %s: %d", remote_host, SSL_get_error(ssl, rc));
+ }
+ } else {
+ logit(LOG_ERR, "Error: (!log_opts) Could not complete SSL handshake with %s: %d", remote_host, SSL_get_error(ssl, rc));
+ }
+# ifdef DEBUG
+ errfp = fopen("/tmp/err.log", "a");
+ ERR_print_errors_fp(errfp);
+ fclose(errfp);
+# endif
+ return ERROR;
+ }
+
+ /* successful handshake */
+ if (sslprm.log_opts & SSL_LogVersion)
+ logit(LOG_NOTICE, "Remote %s - SSL Version: %s", remote_host, SSL_get_version(ssl));
+
+ if (sslprm.log_opts & SSL_LogCipher) {
+ c = SSL_get_current_cipher(ssl);
+ logit(LOG_NOTICE, "Remote %s - %s, Cipher is %s", remote_host, SSL_CIPHER_get_version(c), SSL_CIPHER_get_name(c));
+ }
+
+ if ((sslprm.log_opts & SSL_LogIfClientCert)
+ || (sslprm.log_opts & SSL_LogCertDetails)) {
+
+
+ peer = SSL_get_peer_certificate(ssl);
+
+ if (peer) {
+ if (sslprm.log_opts & SSL_LogIfClientCert)
+ logit(LOG_NOTICE, "SSL Client %s has %s certificate",
+ remote_host, SSL_get_verify_result(ssl) == X509_V_OK ? "a valid" : "an invalid");
+
+ if (sslprm.log_opts & SSL_LogCertDetails) {
+
+ X509_NAME_oneline(X509_get_subject_name(peer), buffer, sizeof(buffer));
+ logit(LOG_NOTICE, "SSL Client %s Cert Name: %s",
+ remote_host, buffer);
+
+ X509_NAME_oneline(X509_get_issuer_name(peer), buffer, sizeof(buffer));
+ logit(LOG_NOTICE, "SSL Client %s Cert Issuer: %s",
+ remote_host, buffer);
+ }
+
+ } else if (sslprm.client_certs == 0)
+ logit(LOG_NOTICE, "SSL Not asking for client certification");
+
+ else
+ logit(LOG_NOTICE, "SSL Client %s did not present a certificate",
+ remote_host);
+ }
+#endif
+
+ return OK;
+}
+
+int read_packet(int sock, void *ssl_ptr, v2_packet * v2_pkt, v3_packet ** v3_pkt)
+{
+ int32_t common_size, tot_bytes, bytes_to_recv, buffer_size;
+ int rc;
+ char *buff_ptr;
+
+ /* Read only the part that's common between versions 2 & 3 */
+ common_size = tot_bytes = bytes_to_recv = (char *)&v2_pkt->buffer - (char *)v2_pkt;
+
+ if (use_ssl == FALSE) {
+ rc = recvall(sock, (char *)v2_pkt, &tot_bytes, socket_timeout);
+
+ if (rc <= 0 || rc != bytes_to_recv)
+ return -1;
+
+ packet_ver = ntohs(v2_pkt->packet_version);
+ if (packet_ver != NRPE_PACKET_VERSION_2 && packet_ver != NRPE_PACKET_VERSION_3) {
+ logit(LOG_ERR, "Error: (use_ssl == false): Request packet version was invalid!");
+ return -1;
+ }
+
+ if (packet_ver == NRPE_PACKET_VERSION_2) {
+ buffer_size = sizeof(v2_packet) - common_size;
+ buff_ptr = (char *)v2_pkt + common_size;
+
+ } else {
+ int32_t pkt_size = sizeof(v3_packet) - 1;
+
+ /* Read the alignment filler */
+ bytes_to_recv = sizeof(int16_t);
+ rc = recvall(sock, (char *)&buffer_size, &bytes_to_recv, socket_timeout);
+ if (rc <= 0 || bytes_to_recv != sizeof(int16_t))
+ return -1;
+ tot_bytes += rc;
+
+ /* Read the buffer size */
+ bytes_to_recv = sizeof(buffer_size);
+ rc = recvall(sock, (char *)&buffer_size, &bytes_to_recv, socket_timeout);
+ if (rc <= 0 || bytes_to_recv != sizeof(buffer_size))
+ return -1;
+ tot_bytes += rc;
+
+ buffer_size = ntohl(buffer_size);
+ pkt_size += buffer_size;
+ if ((*v3_pkt = calloc(1, pkt_size)) == NULL) {
+ logit(LOG_ERR, "Error: (use_ssl == false): Could not allocate memory for packet");
+ return -1;
+ }
+
+ memcpy(*v3_pkt, v2_pkt, common_size);
+ (*v3_pkt)->buffer_length = htonl(buffer_size);
+ buff_ptr = (*v3_pkt)->buffer;
+ }
+
+ bytes_to_recv = buffer_size;
+ rc = recvall(sock, buff_ptr, &bytes_to_recv, socket_timeout);
+
+ if (rc <= 0 || rc != buffer_size) {
+ if (packet_ver == NRPE_PACKET_VERSION_3) {
+ free(*v3_pkt);
+ *v3_pkt = NULL;
+ }
+ return -1;
+ } else
+ tot_bytes += rc;
+ }
+#ifdef HAVE_SSL
+ else {
+ SSL *ssl = (SSL *) ssl_ptr;
+
+ while (((rc = SSL_read(ssl, v2_pkt, bytes_to_recv)) <= 0)
+ && (SSL_get_error(ssl, rc) == SSL_ERROR_WANT_READ)) {
+ }
+
+ if (rc <= 0 || rc != bytes_to_recv)
+ return -1;
+
+ packet_ver = ntohs(v2_pkt->packet_version);
+ if (packet_ver != NRPE_PACKET_VERSION_2 && packet_ver != NRPE_PACKET_VERSION_3) {
+ logit(LOG_ERR, "Error: (use_ssl == true): Request packet version was invalid!");
+ return -1;
+ }
+
+ if (packet_ver == NRPE_PACKET_VERSION_2) {
+ buffer_size = sizeof(v2_packet) - common_size;
+ buff_ptr = (char *)v2_pkt + common_size;
+ } else {
+ int32_t pkt_size = sizeof(v3_packet) - 1;
+
+ /* Read the alignment filler */
+ bytes_to_recv = sizeof(int16_t);
+ while (((rc = SSL_read(ssl, &buffer_size, bytes_to_recv)) <= 0)
+ && (SSL_get_error(ssl, rc) == SSL_ERROR_WANT_READ)) {
+ }
+
+ if (rc <= 0 || bytes_to_recv != sizeof(int16_t))
+ return -1;
+ tot_bytes += rc;
+
+ /* Read the buffer size */
+ bytes_to_recv = sizeof(buffer_size);
+ while (((rc = SSL_read(ssl, &buffer_size, bytes_to_recv)) <= 0)
+ && (SSL_get_error(ssl, rc) == SSL_ERROR_WANT_READ)) {
+ }
+
+ if (rc <= 0 || bytes_to_recv != sizeof(buffer_size))
+ return -1;
+ tot_bytes += rc;
+
+ buffer_size = ntohl(buffer_size);
+ pkt_size += buffer_size;
+ if ((*v3_pkt = calloc(1, pkt_size)) == NULL) {
+ logit(LOG_ERR, "Error: (use_ssl == true): Could not allocate memory for packet");
+ return -1;
+ }
+
+ memcpy(*v3_pkt, v2_pkt, common_size);
+ (*v3_pkt)->buffer_length = htonl(buffer_size);
+ buff_ptr = (*v3_pkt)->buffer;
+ }
+
+ bytes_to_recv = buffer_size;
+ while (((rc = SSL_read(ssl, buff_ptr, bytes_to_recv)) <= 0)
+ && (SSL_get_error(ssl, rc) == SSL_ERROR_WANT_READ)) {
+ }
+
+ if (rc <= 0 || rc != buffer_size) {
+ if (packet_ver == NRPE_PACKET_VERSION_3) {
+ free(*v3_pkt);
+ *v3_pkt = NULL;
+ }
+ return -1;
+ } else
+ tot_bytes += rc;
+ }
+#endif
+
+ return tot_bytes;
+}
+
+/* free all allocated memory */
+void free_memory(void)
+{
+ command *this_command;
+ command *next_command;
+
+ /* free memory for the command list */
+ this_command = command_list;
+ while (this_command != NULL) {
+ next_command = this_command->next;
+ if (this_command->command_name)
+ free(this_command->command_name);
+ if (this_command->command_line)
+ free(this_command->command_line);
+ free(this_command);
+ this_command = next_command;
+ }
+
+ command_list = NULL;
+ return;
+}
+
+/* executes a system command via popen(), but protects against timeouts */
+int my_system(char *command, int timeout, int *early_timeout, char **output)
+{
+ FILE *fp;
+ pid_t pid;
+ time_t start_time, end_time;
+ int status;
+ int result;
+ char buffer[MAX_INPUT_BUFFER];
+ int fd[2];
+ int bytes_read = 0, tot_bytes = 0;
+ int output_size;
+#ifdef HAVE_SIGACTION
+ struct sigaction sig_action;
+#endif
+
+ *early_timeout = FALSE; /* initialize return variables */
+
+ if (command == NULL) /* if no command was passed, return with no error */
+ return STATE_OK;
+
+ /* make sure that we are within max_commands boundaries before attempting */
+ if (max_commands != 0) {
+ while (commands_running >= max_commands) {
+ logit(LOG_WARNING, "Commands choked. Sleeping 1s - commands_running: %d, max_commands: %d", commands_running, max_commands);
+ sleep(1);
+ }
+ }
+
+ /* create a pipe */
+ if (pipe(fd) == -1) {
+ logit(LOG_ERR, "ERROR: pipe(): %s, bailing out...", strerror(errno));
+ exit(STATE_CRITICAL);
+ }
+
+ /* make the pipe non-blocking */
+ fcntl(fd[0], F_SETFL, O_NONBLOCK);
+ fcntl(fd[1], F_SETFL, O_NONBLOCK);
+
+ time(&start_time); /* get the command start time */
+
+ pid = fork(); /* fork */
+
+ /* return an error if we couldn't fork */
+ if (pid == -1) {
+ snprintf(buffer, sizeof(buffer) - 1, "NRPE: Call to fork() failed\n");
+ buffer[sizeof(buffer) - 1] = '\x0';
+
+ if (packet_ver == NRPE_PACKET_VERSION_2) {
+ int output_size = sizeof(v2_packet);
+ *output = calloc(1, output_size);
+ strncpy(*output, buffer, output_size - 1);
+ *output[output_size - 1] = '\0';
+ } else
+ *output = strdup(buffer);
+
+ /* close both ends of the pipe */
+ close(fd[0]);
+ close(fd[1]);
+
+ return STATE_UNKNOWN;
+ }
+
+ /* execute the command in the child process */
+ if (pid == 0) {
+
+ /* get root back so the next call works correctly */
+ if (SETEUID(0) == -1 && debug)
+ logit(LOG_WARNING, "WARNING: my_system() seteuid(0): %s", strerror(errno));
+
+ drop_privileges(nrpe_user, nrpe_group, 1); /* drop privileges */
+ close(fd[0]); /* close pipe for reading */
+ setpgid(0, 0); /* become process group leader */
+
+ /* trap commands that timeout */
+#ifdef HAVE_SIGACTION
+ sig_action.sa_sigaction = NULL;
+ sig_action.sa_handler = my_system_sighandler;
+ sigfillset(&sig_action.sa_mask);
+ sig_action.sa_flags = SA_NODEFER | SA_RESTART;
+ sigaction(SIGALRM, &sig_action, NULL);
+#else
+ signal(SIGALRM, my_system_sighandler);
+#endif /* HAVE_SIGACTION */
+ alarm(timeout);
+
+ fp = popen(command, "r"); /* run the command */
+
+ /* report an error if we couldn't run the command */
+ if (fp == NULL) {
+ strncpy(buffer, "NRPE: Call to popen() failed\n", sizeof(buffer) - 1);
+ buffer[sizeof(buffer) - 1] = '\x0';
+
+ /* write the error back to the parent process */
+ if (write(fd[1], buffer, strlen(buffer) + 1) == -1)
+ logit(LOG_ERR, "ERROR: my_system() write(fd, buffer)-1 failed...");
+
+ result = STATE_CRITICAL;
+
+ } else {
+
+ /* read all lines of output - supports Nagios 3.x multiline output */
+ while ((bytes_read = fread(buffer, 1, sizeof(buffer) - 1, fp)) > 0) {
+ /* write the output back to the parent process */
+ if (write(fd[1], buffer, bytes_read) == -1)
+ logit(LOG_ERR, "ERROR: my_system() write(fd, buffer)-2 failed...");
+ }
+
+ if (write(fd[1], "\0", 1) == -1)
+ logit(LOG_ERR, "ERROR: my_system() write(fd, NULL) failed...");
+
+ status = pclose(fp); /* close the command and get termination status */
+
+ /* report an error if we couldn't close the command */
+ if (status == -1)
+ result = STATE_CRITICAL;
+ else if (!WIFEXITED(status))
+ /* report an error if child died due to signal (Klas Lindfors) */
+ result = STATE_CRITICAL;
+ else
+ result = WEXITSTATUS(status);
+ }
+
+ close(fd[1]); /* close pipe for writing */
+ alarm(0); /* reset the alarm */
+ exit(result); /* return plugin exit code to parent process */
+
+ } else {
+ /* parent waits for child to finish executing command */
+
+ commands_running++;
+
+ close(fd[1]); /* close pipe for writing */
+ waitpid(pid, &status, 0); /* wait for child to exit */
+ time(&end_time); /* get the end time for running the command */
+ result = WEXITSTATUS(status); /* get the exit code returned from the program */
+
+ /* because of my idiotic idea of having UNKNOWN states be equivalent to -1, I must hack things a bit... */
+ if (result == 255)
+ result = STATE_UNKNOWN;
+
+ /* check bounds on the return value */
+ if (result < 0 || result > 3)
+ result = STATE_UNKNOWN;
+
+ if (packet_ver == NRPE_PACKET_VERSION_2) {
+ output_size = sizeof(v2_packet);
+ *output = calloc(1, output_size);
+ } else {
+ output_size = 1024 * 64; /* Maximum buffer is 64K */
+ *output = calloc(1, output_size);
+ }
+
+ /* try and read the results from the command output (retry if we encountered a signal) */
+ for (;;) {
+ bytes_read = read(fd[0], buffer, sizeof(buffer) - 1);
+ if (bytes_read == 0)
+ break;
+ if (bytes_read == -1) {
+ if (errno == EINTR)
+ continue;
+ else
+ break;
+ }
+ if (tot_bytes < output_size) /* If buffer is full, discard the rest */
+ strncat(*output, buffer, output_size - tot_bytes - 1);
+ tot_bytes += bytes_read;
+ }
+
+ (*output)[output_size - 1] = '\0';
+
+ /* if there was a critical return code and no output AND the
+ * command time exceeded the timeout thresholds, assume a timeout */
+ if (result == STATE_CRITICAL && bytes_read == -1 && (end_time - start_time) >= timeout) {
+ *early_timeout = TRUE;
+
+ /* send termination signal to child process group */
+ kill((pid_t) (-pid), SIGTERM);
+ kill((pid_t) (-pid), SIGKILL);
+ }
+
+ close(fd[0]); /* close the pipe for reading */
+
+ commands_running--;
+ }
+
+#ifdef DEBUG
+ printf("my_system() end\n");
+#endif
+
+ return result;
+}
+
+/* handle timeouts when executing commands via my_system() */
+void my_system_sighandler(int sig)
+{
+ exit(STATE_CRITICAL); /* force the child process to exit... */
+}
+
+/* handle errors where connection takes too long */
+void my_connection_sighandler(int sig)
+{
+ logit(LOG_ERR, "Connection has taken too long to establish. Exiting...");
+ exit(STATE_CRITICAL);
+}
+
+/* drops privileges */
+int drop_privileges(char *user, char *group, int full_drop)
+{
+ uid_t uid = (uid_t)-1;
+ gid_t gid = (gid_t)-1;
+ struct group *grp;
+ struct passwd *pw;
+
+ if (use_inetd == TRUE)
+ return OK;
+
+ /* set effective group ID */
+ if (group != NULL) {
+
+ /* see if this is a group name */
+ if (strspn(group, "0123456789") < strlen(group)) {
+ grp = (struct group *)getgrnam(group);
+ if (grp != NULL)
+ gid = (gid_t) (grp->gr_gid);
+ else
+ logit(LOG_ERR, "Warning: Could not get group entry for '%s'", group);
+ endgrent();
+
+ } else
+ /* else we were passed the GID */
+ gid = (gid_t) atoi(group);
+
+ /* set effective group ID if other than current EGID */
+ if (gid != getegid()) {
+ if (setgid(gid) == -1)
+ logit(LOG_ERR, "Warning: Could not set effective GID=%d", (int)gid);
+ }
+ }
+
+
+ /* set effective user ID */
+ if (user != NULL) {
+
+ /* see if this is a user name */
+ if (strspn(user, "0123456789") < strlen(user)) {
+ pw = (struct passwd *)getpwnam(user);
+ if (pw != NULL)
+ uid = (uid_t) (pw->pw_uid);
+ else
+ logit(LOG_ERR, "Warning: Could not get passwd entry for '%s'", user);
+ endpwent();
+
+ } else
+ /* else we were passed the UID */
+ uid = (uid_t) atoi(user);
+
+ if (uid != geteuid()) {
+ /* set effective user ID if other than current EUID */
+#ifdef HAVE_INITGROUPS
+ /* initialize supplementary groups */
+ if (initgroups(user, gid) == -1) {
+ if (errno == EPERM)
+ logit(LOG_ERR, "Warning: Unable to change supplementary groups using initgroups()");
+ else {
+ logit(LOG_ERR, "Warning: Possibly root user failed dropping privileges with initgroups()");
+ return ERROR;
+ }
+ }
+#endif
+
+ if (full_drop) {
+ if (setuid(uid) == -1)
+ logit(LOG_ERR, "Warning: Could not set UID=%d", (int)uid);
+ } else if (SETEUID(uid) == -1)
+ logit(LOG_ERR, "Warning: Could not set effective UID=%d", (int)uid);
+ }
+ }
+
+ return OK;
+}
+
+/* write an optional pid file */
+int write_pid_file(void)
+{
+ int fd;
+ int result = 0;
+ pid_t pid = 0;
+ char pbuf[16];
+
+ /* no pid file was specified */
+ if (pid_file == NULL)
+ return OK;
+
+ /* read existing pid file */
+ if ((fd = open(pid_file, O_RDONLY)) >= 0) {
+
+ result = read(fd, pbuf, (sizeof pbuf) - 1);
+ close(fd);
+
+ if (result > 0) {
+ pbuf[result] = '\x0';
+ pid = (pid_t) atoi(pbuf);
+
+ /* if previous process is no longer running running, remove the old pid file */
+ if (pid && (pid == getpid() || kill(pid, 0) < 0))
+ unlink(pid_file);
+
+ else {
+ /* previous process is still running */
+ logit(LOG_ERR, "There's already an NRPE server running (PID %lu). Bailing out...", (unsigned long)pid);
+ return ERROR;
+ }
+ }
+ }
+
+ /* write new pid file */
+ if ((fd = open(pid_file, O_WRONLY | O_CREAT, 0644)) >= 0) {
+ sprintf(pbuf, "%d\n", (int)getpid());
+
+ if (write(fd, pbuf, strlen(pbuf)) == -1)
+ logit(LOG_ERR, "ERROR: write_pid_file() write(fd, pbuf) failed...");
+
+ close(fd);
+ wrote_pid_file = TRUE;
+ } else {
+ logit(LOG_ERR, "Cannot write to pidfile '%s' - check your privileges.", pid_file);
+ return ERROR;
+ }
+
+ return OK;
+}
+
+/* remove pid file */
+int remove_pid_file(void)
+{
+ if (pid_file == NULL)
+ return OK; /* no pid file was specified */
+ if (wrote_pid_file == FALSE)
+ return OK; /* pid file was not written */
+
+ /* get root back so we can delete the pid file */
+ if (SETEUID(0) == -1 && debug)
+ logit(LOG_WARNING, "WARNING: remove_pid_file() seteuid(0): %s", strerror(errno));
+
+ if (unlink(pid_file) == -1) {
+ logit(LOG_ERR, "Cannot remove pidfile '%s' - check your privileges.", pid_file);
+ return ERROR;
+ }
+
+ return OK;
+}
+
+#ifdef HAVE_SSL
+
+void my_disconnect_sighandler(int sig)
+{
+ logit(LOG_ERR, "SSL_shutdown() has taken too long to complete. Exiting now..");
+ exit(STATE_CRITICAL);
+}
+
+void complete_SSL_shutdown(SSL * ssl)
+{
+ /* Thanks to Jari Takkala (jtakkala@gmail.com) for the following information.
+
+ We need to call SSL_shutdown() at least twice, otherwise we'll
+ be left with data in the socket receive buffer, and the
+ subsequent process termination will cause TCP RST's to be sent
+ to the client.
+
+ See http://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/32219/diff
+ for more information.
+ */
+
+ int x;
+
+ /* set disconnection handler */
+ signal(SIGALRM, my_disconnect_sighandler);
+ alarm(ssl_shutdown_timeout);
+
+ for (x = 0; x < 4; x++) {
+ if (SSL_shutdown(ssl))
+ break;
+ }
+
+ alarm(0);
+}
+#endif /*HAVE_SSL */
+
+/* bail if daemon is running as root */
+int check_privileges(void)
+{
+ uid_t uid = geteuid();
+ gid_t gid = getegid();
+
+ if (uid == 0 || gid == 0) {
+ logit(LOG_ERR, "Error: NRPE daemon cannot be run as user/group root!");
+ exit(STATE_CRITICAL);
+ }
+
+ return OK;
+}
+
+/* handle signals (parent process) */
+void sighandler(int sig)
+{
+ static char *sigs[] = {
+ "EXIT", "HUP", "INT", "QUIT", "ILL", "TRAP", "ABRT", "BUS", "FPE",
+ "KILL", "USR1", "SEGV", "USR2", "PIPE", "ALRM", "TERM", "STKFLT",
+ "CHLD", "CONT", "STOP", "TSTP", "TTIN", "TTOU", "URG", "XCPU",
+ "XFSZ", "VTALRM", "PROF", "WINCH", "IO", "PWR", "UNUSED", "ZERR",
+ "DEBUG", (char *)NULL
+ };
+ int i;
+
+ if (sig < 0)
+ sig = -sig;
+
+ for (i = 0; sigs[i] != (char *)NULL; i++) ;
+ sig %= i;
+
+ /* we received a SIGHUP, so restart... */
+ if (sig == SIGHUP) {
+ sigrestart = TRUE;
+ logit(LOG_NOTICE, "Caught SIGHUP - restarting...\n");
+ }
+
+ /* else begin shutting down... */
+ if (sig == SIGTERM) {
+ /* if shutdown is already true, we're in a signal trap loop! */
+ if (sigshutdown == TRUE)
+ exit(STATE_CRITICAL);
+ sigshutdown = TRUE;
+ logit(LOG_NOTICE, "Caught SIG%s - shutting down...\n", sigs[sig]);
+ }
+
+ return;
+}
+
+/* handle signals (child processes) */
+void child_sighandler(int sig)
+{
+ exit(0); /* terminate */
+}
+
+/* tests whether or not a client request is valid */
+int validate_request(v2_packet * v2pkt, v3_packet * v3pkt)
+{
+ u_int32_t packet_crc32;
+ u_int32_t calculated_crc32;
+ char *buff, *ptr;
+ int rc;
+#ifdef ENABLE_COMMAND_ARGUMENTS
+ int x;
+#endif
+
+ /* check the crc 32 value */
+ if (packet_ver == NRPE_PACKET_VERSION_3) {
+ int32_t pkt_size = (sizeof(v3_packet) - 1) + ntohl(v3pkt->buffer_length);
+ packet_crc32 = ntohl(v3pkt->crc32_value);
+ v3pkt->crc32_value = 0L;
+ v3pkt->alignment = 0;
+ calculated_crc32 = calculate_crc32((char *)v3pkt, pkt_size);
+ } else {
+ packet_crc32 = ntohl(v2pkt->crc32_value);
+ v2pkt->crc32_value = 0L;
+ calculated_crc32 = calculate_crc32((char *)v2pkt, sizeof(v2_packet));
+ }
+
+ if (packet_crc32 != calculated_crc32) {
+ logit(LOG_ERR, "Error: Request packet had invalid CRC32.");
+ return ERROR;
+ }
+
+ /* make sure this is the right type of packet */
+ if (ntohs(v2pkt->packet_type) != QUERY_PACKET) {
+ logit(LOG_ERR, "Error: Request packet type was invalid!");
+ return ERROR;
+ }
+
+ /* make sure buffer is terminated */
+ if (packet_ver == NRPE_PACKET_VERSION_3) {
+ int32_t l = ntohs(v3pkt->buffer_length);
+ v3pkt->buffer[l - 1] = '\x0';
+ buff = v3pkt->buffer;
+ } else {
+ v2pkt->buffer[MAX_PACKETBUFFER_LENGTH - 1] = '\x0';
+ buff = v2pkt->buffer;
+ }
+
+ /* client must send some kind of request */
+ if (buff[0] == '\0') {
+ logit(LOG_ERR, "Error: Request contained no query!");
+ return ERROR;
+ }
+
+ /* make sure request doesn't contain nasties */
+ if (packet_ver == NRPE_PACKET_VERSION_3)
+ rc = contains_nasty_metachars(v3pkt->buffer);
+ else
+ rc = contains_nasty_metachars(v2pkt->buffer);
+ if (rc == TRUE) {
+ logit(LOG_ERR, "Error: Request contained illegal metachars!");
+ return ERROR;
+ }
+
+ /* make sure the request doesn't contain arguments */
+ if (strchr(v2pkt->buffer, '!')) {
+#ifdef ENABLE_COMMAND_ARGUMENTS
+ if (allow_arguments == FALSE) {
+ logit(LOG_ERR, "Error: Request contained command arguments, but argument option is not enabled!");
+ return ERROR;
+ }
+#else
+ logit(LOG_ERR, "Error: Request contained command arguments!");
+ return ERROR;
+#endif
+ }
+
+ /* get command name */
+#ifdef ENABLE_COMMAND_ARGUMENTS
+ ptr = strtok(buff, "!");
+#else
+ ptr = buff;
+#endif
+ command_name = strdup(ptr);
+ if (command_name == NULL) {
+ logit(LOG_ERR, "Error: Memory allocation failed");
+ return ERROR;
+ }
+#ifdef ENABLE_COMMAND_ARGUMENTS
+ /* get command arguments */
+ if (allow_arguments == TRUE) {
+
+ for (x = 0; x < MAX_COMMAND_ARGUMENTS; x++) {
+ ptr = strtok(NULL, "!");
+ if (ptr == NULL)
+ break;
+ macro_argv[x] = strdup(ptr);
+ if (macro_argv[x] == NULL) {
+ logit(LOG_ERR, "Error: Memory allocation failed");
+ return ERROR;
+ }
+ if (!strcmp(macro_argv[x], "")) {
+ logit(LOG_ERR, "Error: Request contained an empty command argument");
+ return ERROR;
+ }
+ if (strstr(macro_argv[x], "$(")) {
+# ifndef ENABLE_BASH_COMMAND_SUBSTITUTION
+ logit(LOG_ERR, "Error: Request contained a bash command substitution!");
+ return ERROR;
+# else
+ if (FALSE == allow_bash_cmd_subst) {
+ logit(LOG_ERR, "Error: Request contained a bash command substitution, but they are disallowed!");
+ return ERROR;
+ }
+# endif
+ }
+ }
+ }
+#endif
+ return OK;
+}
+
+/* tests whether a buffer contains illegal metachars */
+int contains_nasty_metachars(char *str)
+{
+ int result;
+
+ if (str == NULL)
+ return FALSE;
+
+ result = strcspn(str, nasty_metachars);
+ if (result != strlen(str))
+ return TRUE;
+
+ return FALSE;
+}
+
+/* replace macros in buffer */
+int process_macros(char *input_buffer, char *output_buffer, int buffer_length)
+{
+ char *temp_buffer;
+ int in_macro;
+ int arg_index = 0;
+ char *selected_macro = NULL;
+
+ strcpy(output_buffer, "");
+
+ in_macro = FALSE;
+
+ for (temp_buffer = my_strsep(&input_buffer, "$"); temp_buffer != NULL;
+ temp_buffer = my_strsep(&input_buffer, "$")) {
+
+ selected_macro = NULL;
+
+ if (in_macro == FALSE) {
+ if (strlen(output_buffer) + strlen(temp_buffer) < buffer_length - 1) {
+ strncat(output_buffer, temp_buffer, buffer_length - strlen(output_buffer) - 1);
+ output_buffer[buffer_length - 1] = '\x0';
+ }
+ in_macro = TRUE;
+
+ } else {
+
+ if (strlen(output_buffer) + strlen(temp_buffer) < buffer_length - 1) {
+
+ /* argument macro */
+ if (strstr(temp_buffer, "ARG") == temp_buffer) {
+ arg_index = atoi(temp_buffer + 3);
+ if (arg_index >= 1 && arg_index <= MAX_COMMAND_ARGUMENTS)
+ selected_macro = macro_argv[arg_index - 1];
+
+ } else if (!strcmp(temp_buffer, "")) {
+ /* an escaped $ is done by specifying two $$ next to each other */
+ strncat(output_buffer, "$", buffer_length - strlen(output_buffer) - 1);
+
+ } else {
+ /* a non-macro, just some user-defined string between two $s */
+ strncat(output_buffer, "$", buffer_length - strlen(output_buffer) - 1);
+ output_buffer[buffer_length - 1] = '\x0';
+ strncat(output_buffer, temp_buffer,
+ buffer_length - strlen(output_buffer) - 1);
+ output_buffer[buffer_length - 1] = '\x0';
+ strncat(output_buffer, "$", buffer_length - strlen(output_buffer) - 1);
+ }
+
+
+ /* insert macro */
+ if (selected_macro != NULL)
+ strncat(output_buffer, (selected_macro == NULL) ? "" : selected_macro,
+ buffer_length - strlen(output_buffer) - 1);
+
+ output_buffer[buffer_length - 1] = '\x0';
+ }
+
+ in_macro = FALSE;
+ }
+ }
+
+ return OK;
+}
+
+/* process command line arguments */
+int process_arguments(int argc, char **argv)
+{
+ char optchars[MAX_INPUT_BUFFER];
+ int c = 1;
+ int have_mode = FALSE;
+#ifdef HAVE_GETOPT_LONG
+ int option_index = 0;
+ static struct option long_options[] = {
+ {"config", required_argument, 0, 'c'},
+ {"inetd", no_argument, 0, 'i'},
+ /* To compatibility between short and long options but not used on AIX */
+ {"src", no_argument, 0, 's'},
+ {"no-forking", no_argument, 0, 'f'},
+ {"4", no_argument, 0, '4'},
+ {"ipv6", no_argument, 0, '6'},
+ {"daemon", no_argument, 0, 'd'},
+ {"no-ssl", no_argument, 0, 'n'},
+ {"help", no_argument, 0, 'h'},
+ {"license", no_argument, 0, 'l'},
+ {"version", no_argument, 0, 'V'},
+ {0, 0, 0, 0}
+ };
+#endif
+
+ /* no options were supplied */
+ if (argc < 2)
+ return ERROR;
+
+ snprintf(optchars, MAX_INPUT_BUFFER, "c:hVldi46nsf");
+
+ while (1) {
+#ifdef HAVE_GETOPT_LONG
+ c = getopt_long(argc, argv, optchars, long_options, &option_index);
+#else
+ c = getopt(argc, argv, optchars);
+#endif
+ if (c == -1 || c == EOF)
+ break;
+
+ /* process all arguments */
+ switch (c) {
+
+ case '?':
+ case 'h':
+ show_help = TRUE;
+ break;
+
+ case 'V':
+ show_version = TRUE;
+ have_mode = TRUE;
+ break;
+
+ case 'l':
+ show_license = TRUE;
+ break;
+
+ case 'c':
+ strncpy(config_file, optarg, sizeof(config_file));
+ config_file[sizeof(config_file) - 1] = '\x0';
+ break;
+
+ case 'd':
+ use_inetd = FALSE;
+ have_mode = TRUE;
+ break;
+
+ case 'i':
+ use_inetd = TRUE;
+ have_mode = TRUE;
+ break;
+
+ case '4':
+ address_family = AF_INET;
+ break;
+
+ case '6':
+ address_family = AF_INET6;
+ break;
+
+ case 'n':
+ use_ssl = FALSE;
+ break;
+
+ case 's': /* Argument s to indicate SRC option */
+ use_src = TRUE;
+ have_mode = TRUE;
+ break;
+
+ case 'f':
+ use_inetd = FALSE;
+ no_forking = TRUE;
+ have_mode = TRUE;
+ break;
+
+ default:
+ return ERROR;
+ }
+ }
+
+ /* bail if we didn't get required args */
+ if (have_mode == FALSE)
+ return ERROR;
+
+ return OK;
+}
diff --git a/src/snprintf.c b/src/snprintf.c
new file mode 100644
index 0000000..3a5d672
--- /dev/null
+++ b/src/snprintf.c
@@ -0,0 +1,1452 @@
+/*
+ * NOTE: If you change this file, please merge it into rsync, samba, etc.
+ */
+
+/*
+ * Copyright Patrick Powell 1995
+ * This code is based on code written by Patrick Powell (papowell@astart.com)
+ * It may be used for any purpose as long as this notice remains intact
+ * on all source code distributions
+ */
+
+/**************************************************************
+ * Original:
+ * Patrick Powell Tue Apr 11 09:48:21 PDT 1995
+ * A bombproof version of doprnt (dopr) included.
+ * Sigh. This sort of thing is always nasty do deal with. Note that
+ * the version here does not include floating point...
+ *
+ * snprintf() is used instead of sprintf() as it does limit checks
+ * for string length. This covers a nasty loophole.
+ *
+ * The other functions are there to prevent NULL pointers from
+ * causing nast effects.
+ *
+ * More Recently:
+ * Brandon Long <blong@fiction.net> 9/15/96 for mutt 0.43
+ * This was ugly. It is still ugly. I opted out of floating point
+ * numbers, but the formatter understands just about everything
+ * from the normal C string format, at least as far as I can tell from
+ * the Solaris 2.5 printf(3S) man page.
+ *
+ * Brandon Long <blong@fiction.net> 10/22/97 for mutt 0.87.1
+ * Ok, added some minimal floating point support, which means this
+ * probably requires libm on most operating systems. Don't yet
+ * support the exponent (e,E) and sigfig (g,G). Also, fmtint()
+ * was pretty badly broken, it just wasn't being exercised in ways
+ * which showed it, so that's been fixed. Also, formated the code
+ * to mutt conventions, and removed dead code left over from the
+ * original. Also, there is now a builtin-test, just compile with:
+ * gcc -DTEST_SNPRINTF -o snprintf snprintf.c -lm
+ * and run snprintf for results.
+ *
+ * Thomas Roessler <roessler@guug.de> 01/27/98 for mutt 0.89i
+ * The PGP code was using unsigned hexadecimal formats.
+ * Unfortunately, unsigned formats simply didn't work.
+ *
+ * Michael Elkins <me@cs.hmc.edu> 03/05/98 for mutt 0.90.8
+ * The original code assumed that both snprintf() and vsnprintf() were
+ * missing. Some systems only have snprintf() but not vsnprintf(), so
+ * the code is now broken down under HAVE_SNPRINTF and HAVE_VSNPRINTF.
+ *
+ * Andrew Tridgell (tridge@samba.org) Oct 1998
+ * fixed handling of %.0f
+ * added test for HAVE_LONG_DOUBLE
+ *
+ * tridge@samba.org, idra@samba.org, April 2001
+ * got rid of fcvt code (twas buggy and made testing harder)
+ * added C99 semantics
+ *
+ * date: 2002/12/19 19:56:31; author: herb; state: Exp; lines: +2 -0
+ * actually print args for %g and %e
+ *
+ * date: 2002/06/03 13:37:52; author: jmcd; state: Exp; lines: +8 -0
+ * Since includes.h isn't included here, VA_COPY has to be defined here. I don't
+ * see any include file that is guaranteed to be here, so I'm defining it
+ * locally. Fixes AIX and Solaris builds.
+ *
+ * date: 2002/06/03 03:07:24; author: tridge; state: Exp; lines: +5 -13
+ * put the ifdef for HAVE_VA_COPY in one place rather than in lots of
+ * functions
+ *
+ * date: 2002/05/17 14:51:22; author: jmcd; state: Exp; lines: +21 -4
+ * Fix usage of va_list passed as an arg. Use __va_copy before using it
+ * when it exists.
+ *
+ * date: 2002/04/16 22:38:04; author: idra; state: Exp; lines: +20 -14
+ * Fix incorrect zpadlen handling in fmtfp.
+ * Thanks to Ollie Oldham <ollie.oldham@metro-optix.com> for spotting it.
+ * few mods to make it easier to compile the tests.
+ * added the "Ollie" test to the floating point ones.
+ *
+ * Martin Pool (mbp@samba.org) April 2003
+ * Remove NO_CONFIG_H so that the test case can be built within a source
+ * tree with less trouble.
+ * Remove unnecessary SAFE_FREE() definition.
+ *
+ * Martin Pool (mbp@samba.org) May 2003
+ * Put in a prototype for dummy_snprintf() to quiet compiler warnings.
+ *
+ * Move #endif to make sure VA_COPY, LDOUBLE, etc are defined even
+ * if the C library has some snprintf functions already.
+ *
+ * Darren Tucker (dtucker@zip.com.au) 2005
+ * Fix bug allowing read overruns of the source string with "%.*s"
+ * Usually harmless unless the read runs outside the process' allocation
+ * (eg if your malloc does guard pages) in which case it will segfault.
+ * From OpenSSH. Also added test for same.
+ *
+ * Simo Sorce (idra@samba.org) Jan 2006
+ *
+ * Add support for position independent parameters
+ * fix fmtstr now it conforms to sprintf wrt min.max
+ *
+ **************************************************************/
+
+#ifndef NO_CONFIG_H
+/* 08/13/2007 EG changed path to config.h to match NRPE distro */
+#include "../include/config.h"
+#else
+#define NULL 0
+#endif
+
+#ifdef TEST_SNPRINTF /* need math library headers for testing */
+
+/* In test mode, we pretend that this system doesn't have any snprintf
+ * functions, regardless of what config.h says. */
+# undef HAVE_SNPRINTF
+# undef HAVE_VSNPRINTF
+# undef HAVE_C99_VSNPRINTF
+# undef HAVE_ASPRINTF
+# undef HAVE_VASPRINTF
+# include <math.h>
+#endif /* TEST_SNPRINTF */
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#ifdef HAVE_CTYPE_H
+#include <ctype.h>
+#endif
+#include <sys/types.h>
+#include <stdarg.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#if defined(HAVE_SNPRINTF) && defined(HAVE_VSNPRINTF) && defined(HAVE_C99_VSNPRINTF)
+/* only include stdio.h if we are not re-defining snprintf or vsnprintf */
+#include <stdio.h>
+ /* make the compiler happy with an empty file */
+ void dummy_snprintf(void);
+ void dummy_snprintf(void) {}
+#endif /* HAVE_SNPRINTF, etc */
+
+#ifdef HAVE_LONG_DOUBLE
+#define LDOUBLE long double
+#else
+#define LDOUBLE double
+#endif
+
+#ifdef HAVE_LONG_LONG
+#define LLONG long long
+#else
+#define LLONG long
+#endif
+
+#ifndef VA_COPY
+#ifdef HAVE_VA_COPY
+#define VA_COPY(dest, src) va_copy(dest, src)
+#else
+#ifdef HAVE___VA_COPY
+#define VA_COPY(dest, src) __va_copy(dest, src)
+#else
+#define VA_COPY(dest, src) (dest) = (src)
+#endif
+#endif
+
+/*
+ * dopr(): poor man's version of doprintf
+ */
+
+/* format read states */
+#define DP_S_DEFAULT 0
+#define DP_S_FLAGS 1
+#define DP_S_MIN 2
+#define DP_S_DOT 3
+#define DP_S_MAX 4
+#define DP_S_MOD 5
+#define DP_S_CONV 6
+#define DP_S_DONE 7
+
+/* format flags - Bits */
+#define DP_F_MINUS (1 << 0)
+#define DP_F_PLUS (1 << 1)
+#define DP_F_SPACE (1 << 2)
+#define DP_F_NUM (1 << 3)
+#define DP_F_ZERO (1 << 4)
+#define DP_F_UP (1 << 5)
+#define DP_F_UNSIGNED (1 << 6)
+
+/* Conversion Flags */
+#define DP_C_CHAR 1
+#define DP_C_SHORT 2
+#define DP_C_LONG 3
+#define DP_C_LDOUBLE 4
+#define DP_C_LLONG 5
+
+/* Chunk types */
+#define CNK_FMT_STR 0
+#define CNK_INT 1
+#define CNK_OCTAL 2
+#define CNK_UINT 3
+#define CNK_HEX 4
+#define CNK_FLOAT 5
+#define CNK_CHAR 6
+#define CNK_STRING 7
+#define CNK_PTR 8
+#define CNK_NUM 9
+#define CNK_PRCNT 10
+
+#define char_to_int(p) ((p)- '0')
+#ifndef MAX
+#define MAX(p,q) (((p) >= (q)) ? (p) : (q))
+#endif
+
+/* yes this really must be a ||. Don't muck with this (tridge) */
+#if !defined(HAVE_VSNPRINTF) || !defined(HAVE_C99_VSNPRINTF)
+
+struct pr_chunk {
+ int type; /* chunk type */
+ int num; /* parameter number */
+ int min;
+ int max;
+ int flags;
+ int cflags;
+ int start;
+ int len;
+ LLONG value;
+ LDOUBLE fvalue;
+ char *strvalue;
+ void *pnum;
+ struct pr_chunk *min_star;
+ struct pr_chunk *max_star;
+ struct pr_chunk *next;
+};
+
+struct pr_chunk_x {
+ struct pr_chunk **chunks;
+ int num;
+};
+
+static size_t dopr(char *buffer, size_t maxlen, const char *format,
+ va_list args_in);
+static void fmtstr(char *buffer, size_t *currlen, size_t maxlen,
+ char *value, int flags, int min, int max);
+static void fmtint(char *buffer, size_t *currlen, size_t maxlen,
+ long value, int base, int min, int max, int flags);
+static void fmtfp(char *buffer, size_t *currlen, size_t maxlen,
+ LDOUBLE fvalue, int min, int max, int flags);
+static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c);
+static struct pr_chunk *new_chunk(void);
+static int add_cnk_list_entry(struct pr_chunk_x **list,
+ int max_num, struct pr_chunk *chunk);
+
+static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args_in)
+{
+ char ch;
+ int state;
+ int pflag;
+ int pnum;
+ int pfirst;
+ size_t currlen;
+ va_list args;
+ const char *base;
+ struct pr_chunk *chunks = NULL;
+ struct pr_chunk *cnk = NULL;
+ struct pr_chunk_x *clist = NULL;
+ int max_pos;
+ size_t ret = (size_t)-1;
+
+ VA_COPY(args, args_in);
+
+ state = DP_S_DEFAULT;
+ pfirst = 1;
+ pflag = 0;
+ pnum = 0;
+
+ max_pos = 0;
+ base = format;
+ ch = *format++;
+
+ /* retrieve the string structure as chunks */
+ while (state != DP_S_DONE) {
+ if (ch == '\0')
+ state = DP_S_DONE;
+
+ switch(state) {
+ case DP_S_DEFAULT:
+
+ if (cnk) {
+ cnk->next = new_chunk();
+ cnk = cnk->next;
+ } else {
+ cnk = new_chunk();
+ }
+ if (!cnk) goto done;
+ if (!chunks) chunks = cnk;
+
+ if (ch == '%') {
+ state = DP_S_FLAGS;
+ ch = *format++;
+ } else {
+ cnk->type = CNK_FMT_STR;
+ cnk->start = format - base -1;
+ while ((ch != '\0') && (ch != '%')) ch = *format++;
+ cnk->len = format - base - cnk->start -1;
+ }
+ break;
+ case DP_S_FLAGS:
+ switch (ch) {
+ case '-':
+ cnk->flags |= DP_F_MINUS;
+ ch = *format++;
+ break;
+ case '+':
+ cnk->flags |= DP_F_PLUS;
+ ch = *format++;
+ break;
+ case ' ':
+ cnk->flags |= DP_F_SPACE;
+ ch = *format++;
+ break;
+ case '#':
+ cnk->flags |= DP_F_NUM;
+ ch = *format++;
+ break;
+ case '0':
+ cnk->flags |= DP_F_ZERO;
+ ch = *format++;
+ break;
+ case 'I':
+ /* internationalization not supported yet */
+ ch = *format++;
+ break;
+ default:
+ state = DP_S_MIN;
+ break;
+ }
+ break;
+ case DP_S_MIN:
+ if (isdigit((unsigned char)ch)) {
+ cnk->min = 10 * cnk->min + char_to_int (ch);
+ ch = *format++;
+ } else if (ch == '$') {
+ if (!pfirst && !pflag) {
+ /* parameters must be all positioned or none */
+ goto done;
+ }
+ if (pfirst) {
+ pfirst = 0;
+ pflag = 1;
+ }
+ if (cnk->min == 0) /* what ?? */
+ goto done;
+ cnk->num = cnk->min;
+ cnk->min = 0;
+ ch = *format++;
+ } else if (ch == '*') {
+ if (pfirst) pfirst = 0;
+ cnk->min_star = new_chunk();
+ if (!cnk->min_star) /* out of memory :-( */
+ goto done;
+ cnk->min_star->type = CNK_INT;
+ if (pflag) {
+ int num;
+ ch = *format++;
+ if (!isdigit((unsigned char)ch)) {
+ /* parameters must be all positioned or none */
+ goto done;
+ }
+ for (num = 0; isdigit((unsigned char)ch); ch = *format++) {
+ num = 10 * num + char_to_int(ch);
+ }
+ cnk->min_star->num = num;
+ if (ch != '$') /* what ?? */
+ goto done;
+ } else {
+ cnk->min_star->num = ++pnum;
+ }
+ max_pos = add_cnk_list_entry(&clist, max_pos, cnk->min_star);
+ if (max_pos == 0) /* out of memory :-( */
+ goto done;
+ ch = *format++;
+ state = DP_S_DOT;
+ } else {
+ if (pfirst) pfirst = 0;
+ state = DP_S_DOT;
+ }
+ break;
+ case DP_S_DOT:
+ if (ch == '.') {
+ state = DP_S_MAX;
+ ch = *format++;
+ } else {
+ state = DP_S_MOD;
+ }
+ break;
+ case DP_S_MAX:
+ if (isdigit((unsigned char)ch)) {
+ if (cnk->max < 0)
+ cnk->max = 0;
+ cnk->max = 10 * cnk->max + char_to_int (ch);
+ ch = *format++;
+ } else if (ch == '$') {
+ if (!pfirst && !pflag) {
+ /* parameters must be all positioned or none */
+ goto done;
+ }
+ if (cnk->max <= 0) /* what ?? */
+ goto done;
+ cnk->num = cnk->max;
+ cnk->max = -1;
+ ch = *format++;
+ } else if (ch == '*') {
+ cnk->max_star = new_chunk();
+ if (!cnk->max_star) /* out of memory :-( */
+ goto done;
+ cnk->max_star->type = CNK_INT;
+ if (pflag) {
+ int num;
+ ch = *format++;
+ if (!isdigit((unsigned char)ch)) {
+ /* parameters must be all positioned or none */
+ goto done;
+ }
+ for (num = 0; isdigit((unsigned char)ch); ch = *format++) {
+ num = 10 * num + char_to_int(ch);
+ }
+ cnk->max_star->num = num;
+ if (ch != '$') /* what ?? */
+ goto done;
+ } else {
+ cnk->max_star->num = ++pnum;
+ }
+ max_pos = add_cnk_list_entry(&clist, max_pos, cnk->max_star);
+ if (max_pos == 0) /* out of memory :-( */
+ goto done;
+
+ ch = *format++;
+ state = DP_S_MOD;
+ } else {
+ state = DP_S_MOD;
+ }
+ break;
+ case DP_S_MOD:
+ switch (ch) {
+ case 'h':
+ cnk->cflags = DP_C_SHORT;
+ ch = *format++;
+ if (ch == 'h') {
+ cnk->cflags = DP_C_CHAR;
+ ch = *format++;
+ }
+ break;
+ case 'l':
+ cnk->cflags = DP_C_LONG;
+ ch = *format++;
+ if (ch == 'l') { /* It's a long long */
+ cnk->cflags = DP_C_LLONG;
+ ch = *format++;
+ }
+ break;
+ case 'L':
+ cnk->cflags = DP_C_LDOUBLE;
+ ch = *format++;
+ break;
+ default:
+ break;
+ }
+ state = DP_S_CONV;
+ break;
+ case DP_S_CONV:
+ if (cnk->num == 0) cnk->num = ++pnum;
+ max_pos = add_cnk_list_entry(&clist, max_pos, cnk);
+ if (max_pos == 0) /* out of memory :-( */
+ goto done;
+
+ switch (ch) {
+ case 'd':
+ case 'i':
+ cnk->type = CNK_INT;
+ break;
+ case 'o':
+ cnk->type = CNK_OCTAL;
+ cnk->flags |= DP_F_UNSIGNED;
+ break;
+ case 'u':
+ cnk->type = CNK_UINT;
+ cnk->flags |= DP_F_UNSIGNED;
+ break;
+ case 'X':
+ cnk->flags |= DP_F_UP;
+ case 'x':
+ cnk->type = CNK_HEX;
+ cnk->flags |= DP_F_UNSIGNED;
+ break;
+ case 'A':
+ /* hex float not supported yet */
+ case 'E':
+ case 'G':
+ case 'F':
+ cnk->flags |= DP_F_UP;
+ case 'a':
+ /* hex float not supported yet */
+ case 'e':
+ case 'f':
+ case 'g':
+ cnk->type = CNK_FLOAT;
+ break;
+ case 'c':
+ cnk->type = CNK_CHAR;
+ break;
+ case 's':
+ cnk->type = CNK_STRING;
+ break;
+ case 'p':
+ cnk->type = CNK_PTR;
+ break;
+ case 'n':
+ cnk->type = CNK_NUM;
+ break;
+ case '%':
+ cnk->type = CNK_PRCNT;
+ break;
+ default:
+ /* Unknown, bail out*/
+ goto done;
+ }
+ ch = *format++;
+ state = DP_S_DEFAULT;
+ break;
+ case DP_S_DONE:
+ break;
+ default:
+ /* hmm? */
+ break; /* some picky compilers need this */
+ }
+ }
+
+ /* retieve the format arguments */
+ for (pnum = 0; pnum < max_pos; pnum++) {
+ int i;
+
+ if (clist[pnum].num == 0) {
+ /* ignoring a parameter should not be permitted
+ * all parameters must be matched at least once
+ * BUT seem some system ignore this rule ...
+ * at least my glibc based system does --SSS
+ */
+#ifdef DEBUG_SNPRINTF
+ printf("parameter at position %d not used\n", pnum+1);
+#endif
+ /* eat the parameter */
+ va_arg (args, int);
+ continue;
+ }
+ for (i = 1; i < clist[pnum].num; i++) {
+ if (clist[pnum].chunks[0]->type != clist[pnum].chunks[i]->type) {
+ /* nooo noo no!
+ * all the references to a parameter
+ * must be of the same type
+ */
+ goto done;
+ }
+ }
+ cnk = clist[pnum].chunks[0];
+ switch (cnk->type) {
+ case CNK_INT:
+ if (cnk->cflags == DP_C_SHORT)
+ cnk->value = va_arg (args, int);
+ else if (cnk->cflags == DP_C_LONG)
+ cnk->value = va_arg (args, long int);
+ else if (cnk->cflags == DP_C_LLONG)
+ cnk->value = va_arg (args, LLONG);
+ else
+ cnk->value = va_arg (args, int);
+
+ for (i = 1; i < clist[pnum].num; i++) {
+ clist[pnum].chunks[i]->value = cnk->value;
+ }
+ break;
+
+ case CNK_OCTAL:
+ case CNK_UINT:
+ case CNK_HEX:
+ if (cnk->cflags == DP_C_SHORT)
+ cnk->value = va_arg (args, unsigned int);
+ else if (cnk->cflags == DP_C_LONG)
+ cnk->value = (long)va_arg (args, unsigned long int);
+ else if (cnk->cflags == DP_C_LLONG)
+ cnk->value = (LLONG)va_arg (args, unsigned LLONG);
+ else
+ cnk->value = (long)va_arg (args, unsigned int);
+
+ for (i = 1; i < clist[pnum].num; i++) {
+ clist[pnum].chunks[i]->value = cnk->value;
+ }
+ break;
+
+ case CNK_FLOAT:
+ if (cnk->cflags == DP_C_LDOUBLE)
+ cnk->fvalue = va_arg (args, LDOUBLE);
+ else
+ cnk->fvalue = va_arg (args, double);
+
+ for (i = 1; i < clist[pnum].num; i++) {
+ clist[pnum].chunks[i]->fvalue = cnk->fvalue;
+ }
+ break;
+
+ case CNK_CHAR:
+ cnk->value = va_arg (args, int);
+
+ for (i = 1; i < clist[pnum].num; i++) {
+ clist[pnum].chunks[i]->value = cnk->value;
+ }
+ break;
+
+ case CNK_STRING:
+ cnk->strvalue = va_arg (args, char *);
+ if (!cnk->strvalue) cnk->strvalue = "(NULL)";
+
+ for (i = 1; i < clist[pnum].num; i++) {
+ clist[pnum].chunks[i]->strvalue = cnk->strvalue;
+ }
+ break;
+
+ case CNK_PTR:
+ cnk->strvalue = va_arg (args, void *);
+ for (i = 1; i < clist[pnum].num; i++) {
+ clist[pnum].chunks[i]->strvalue = cnk->strvalue;
+ }
+ break;
+
+ case CNK_NUM:
+ if (cnk->cflags == DP_C_CHAR)
+ cnk->pnum = va_arg (args, char *);
+ else if (cnk->cflags == DP_C_SHORT)
+ cnk->pnum = va_arg (args, short int *);
+ else if (cnk->cflags == DP_C_LONG)
+ cnk->pnum = va_arg (args, long int *);
+ else if (cnk->cflags == DP_C_LLONG)
+ cnk->pnum = va_arg (args, LLONG *);
+ else
+ cnk->pnum = va_arg (args, int *);
+
+ for (i = 1; i < clist[pnum].num; i++) {
+ clist[pnum].chunks[i]->pnum = cnk->pnum;
+ }
+ break;
+
+ case CNK_PRCNT:
+ break;
+
+ default:
+ /* what ?? */
+ goto done;
+ }
+ }
+ /* print out the actual string from chunks */
+ currlen = 0;
+ cnk = chunks;
+ while (cnk) {
+ int len, min, max;
+
+ if (cnk->min_star) min = cnk->min_star->value;
+ else min = cnk->min;
+ if (cnk->max_star) max = cnk->max_star->value;
+ else max = cnk->max;
+
+ switch (cnk->type) {
+
+ case CNK_FMT_STR:
+ if (maxlen != 0 && maxlen > currlen) {
+ if (maxlen > (currlen + cnk->len)) len = cnk->len;
+ else len = maxlen - currlen;
+
+ memcpy(&(buffer[currlen]), &(base[cnk->start]), len);
+ }
+ currlen += cnk->len;
+
+ break;
+
+ case CNK_INT:
+ case CNK_UINT:
+ fmtint (buffer, &currlen, maxlen, cnk->value, 10, min, max, cnk->flags);
+ break;
+
+ case CNK_OCTAL:
+ fmtint (buffer, &currlen, maxlen, cnk->value, 8, min, max, cnk->flags);
+ break;
+
+ case CNK_HEX:
+ fmtint (buffer, &currlen, maxlen, cnk->value, 16, min, max, cnk->flags);
+ break;
+
+ case CNK_FLOAT:
+ fmtfp (buffer, &currlen, maxlen, cnk->fvalue, min, max, cnk->flags);
+ break;
+
+ case CNK_CHAR:
+ dopr_outch (buffer, &currlen, maxlen, cnk->value);
+ break;
+
+ case CNK_STRING:
+ if (max == -1) {
+ max = strlen(cnk->strvalue);
+ }
+ fmtstr (buffer, &currlen, maxlen, cnk->strvalue, cnk->flags, min, max);
+ break;
+
+ case CNK_PTR:
+ fmtint (buffer, &currlen, maxlen, (long)(cnk->strvalue), 16, min, max, cnk->flags);
+ break;
+
+ case CNK_NUM:
+ if (cnk->cflags == DP_C_CHAR)
+ *((char *)(cnk->pnum)) = (char)currlen;
+ else if (cnk->cflags == DP_C_SHORT)
+ *((short int *)(cnk->pnum)) = (short int)currlen;
+ else if (cnk->cflags == DP_C_LONG)
+ *((long int *)(cnk->pnum)) = (long int)currlen;
+ else if (cnk->cflags == DP_C_LLONG)
+ *((LLONG *)(cnk->pnum)) = (LLONG)currlen;
+ else
+ *((int *)(cnk->pnum)) = (int)currlen;
+ break;
+
+ case CNK_PRCNT:
+ dopr_outch (buffer, &currlen, maxlen, '%');
+ break;
+
+ default:
+ /* what ?? */
+ goto done;
+ }
+ cnk = cnk->next;
+ }
+ if (maxlen != 0) {
+ if (currlen < maxlen - 1)
+ buffer[currlen] = '\0';
+ else if (maxlen > 0)
+ buffer[maxlen - 1] = '\0';
+ }
+ ret = currlen;
+
+done:
+ while (chunks) {
+ cnk = chunks->next;
+ free(chunks);
+ chunks = cnk;
+ }
+ if (clist) {
+ for (pnum = 0; pnum < max_pos; pnum++) {
+ if (clist[pnum].chunks) free(clist[pnum].chunks);
+ }
+ free(clist);
+ }
+ return ret;
+}
+
+static void fmtstr(char *buffer, size_t *currlen, size_t maxlen,
+ char *value, int flags, int min, int max)
+{
+ int padlen, strln; /* amount to pad */
+ int cnt = 0;
+
+#ifdef DEBUG_SNPRINTF
+ printf("fmtstr min=%d max=%d s=[%s]\n", min, max, value);
+#endif
+ if (value == 0) {
+ value = "<NULL>";
+ }
+
+ for (strln = 0; strln < max && value[strln]; ++strln); /* strlen */
+ padlen = min - strln;
+ if (padlen < 0)
+ padlen = 0;
+ if (flags & DP_F_MINUS)
+ padlen = -padlen; /* Left Justify */
+
+ while (padlen > 0) {
+ dopr_outch (buffer, currlen, maxlen, ' ');
+ --padlen;
+ }
+ while (*value && (cnt < max)) {
+ dopr_outch (buffer, currlen, maxlen, *value++);
+ ++cnt;
+ }
+ while (padlen < 0) {
+ dopr_outch (buffer, currlen, maxlen, ' ');
+ ++padlen;
+ }
+}
+
+/* Have to handle DP_F_NUM (ie 0x and 0 alternates) */
+
+static void fmtint(char *buffer, size_t *currlen, size_t maxlen,
+ long value, int base, int min, int max, int flags)
+{
+ int signvalue = 0;
+ unsigned long uvalue;
+ char convert[20];
+ int place = 0;
+ int spadlen = 0; /* amount to space pad */
+ int zpadlen = 0; /* amount to zero pad */
+ int caps = 0;
+
+ if (max < 0)
+ max = 0;
+
+ uvalue = value;
+
+ if(!(flags & DP_F_UNSIGNED)) {
+ if( value < 0 ) {
+ signvalue = '-';
+ uvalue = -value;
+ } else {
+ if (flags & DP_F_PLUS) /* Do a sign (+/i) */
+ signvalue = '+';
+ else if (flags & DP_F_SPACE)
+ signvalue = ' ';
+ }
+ }
+
+ if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */
+
+ do {
+ convert[place++] =
+ (caps? "0123456789ABCDEF":"0123456789abcdef")
+ [uvalue % (unsigned)base ];
+ uvalue = (uvalue / (unsigned)base );
+ } while(uvalue && (place < 20));
+ if (place == 20) place--;
+ convert[place] = 0;
+
+ zpadlen = max - place;
+ spadlen = min - MAX (max, place) - (signvalue ? 1 : 0);
+ if (zpadlen < 0) zpadlen = 0;
+ if (spadlen < 0) spadlen = 0;
+ if (flags & DP_F_ZERO) {
+ zpadlen = MAX(zpadlen, spadlen);
+ spadlen = 0;
+ }
+ if (flags & DP_F_MINUS)
+ spadlen = -spadlen; /* Left Justify */
+
+#ifdef DEBUG_SNPRINTF
+ printf("zpad: %d, spad: %d, min: %d, max: %d, place: %d\n",
+ zpadlen, spadlen, min, max, place);
+#endif
+
+ /* Spaces */
+ while (spadlen > 0) {
+ dopr_outch (buffer, currlen, maxlen, ' ');
+ --spadlen;
+ }
+
+ /* Sign */
+ if (signvalue)
+ dopr_outch (buffer, currlen, maxlen, signvalue);
+
+ /* Zeros */
+ if (zpadlen > 0) {
+ while (zpadlen > 0) {
+ dopr_outch (buffer, currlen, maxlen, '0');
+ --zpadlen;
+ }
+ }
+
+ /* Digits */
+ while (place > 0)
+ dopr_outch (buffer, currlen, maxlen, convert[--place]);
+
+ /* Left Justified spaces */
+ while (spadlen < 0) {
+ dopr_outch (buffer, currlen, maxlen, ' ');
+ ++spadlen;
+ }
+}
+
+static LDOUBLE abs_val(LDOUBLE value)
+{
+ LDOUBLE result = value;
+
+ if (value < 0)
+ result = -value;
+
+ return result;
+}
+
+static LDOUBLE POW10(int exp)
+{
+ LDOUBLE result = 1;
+
+ while (exp) {
+ result *= 10;
+ exp--;
+ }
+
+ return result;
+}
+
+static LLONG ROUND(LDOUBLE value)
+{
+ LLONG intpart;
+
+ intpart = (LLONG)value;
+ value = value - intpart;
+ if (value >= 0.5) intpart++;
+
+ return intpart;
+}
+
+/* a replacement for modf that doesn't need the math library. Should
+ be portable, but slow */
+static double my_modf(double x0, double *iptr)
+{
+ int i;
+ long l;
+ double x = x0;
+ double f = 1.0;
+
+ for (i=0;i<100;i++) {
+ l = (long)x;
+ if (l <= (x+1) && l >= (x-1)) break;
+ x *= 0.1;
+ f *= 10.0;
+ }
+
+ if (i == 100) {
+ /* yikes! the number is beyond what we can handle. What do we do? */
+ (*iptr) = 0;
+ return 0;
+ }
+
+ if (i != 0) {
+ double i2;
+ double ret;
+
+ ret = my_modf(x0-l*f, &i2);
+ (*iptr) = l*f + i2;
+ return ret;
+ }
+
+ (*iptr) = l;
+ return x - (*iptr);
+}
+
+
+static void fmtfp (char *buffer, size_t *currlen, size_t maxlen,
+ LDOUBLE fvalue, int min, int max, int flags)
+{
+ int signvalue = 0;
+ double ufvalue;
+ char iconvert[311];
+ char fconvert[311];
+ int iplace = 0;
+ int fplace = 0;
+ int padlen = 0; /* amount to pad */
+ int zpadlen = 0;
+ int caps = 0;
+ int idx;
+ double intpart;
+ double fracpart;
+ double temp;
+
+ /*
+ * AIX manpage says the default is 0, but Solaris says the default
+ * is 6, and sprintf on AIX defaults to 6
+ */
+ if (max < 0)
+ max = 6;
+
+ ufvalue = abs_val (fvalue);
+
+ if (fvalue < 0) {
+ signvalue = '-';
+ } else {
+ if (flags & DP_F_PLUS) { /* Do a sign (+/i) */
+ signvalue = '+';
+ } else {
+ if (flags & DP_F_SPACE)
+ signvalue = ' ';
+ }
+ }
+
+#if 0
+ if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */
+#endif
+
+#if 0
+ if (max == 0) ufvalue += 0.5; /* if max = 0 we must round */
+#endif
+
+ /*
+ * Sorry, we only support 9 digits past the decimal because of our
+ * conversion method
+ */
+ if (max > 9)
+ max = 9;
+
+ /* We "cheat" by converting the fractional part to integer by
+ * multiplying by a factor of 10
+ */
+
+ temp = ufvalue;
+ my_modf(temp, &intpart);
+
+ fracpart = ROUND((POW10(max)) * (ufvalue - intpart));
+
+ if (fracpart >= POW10(max)) {
+ intpart++;
+ fracpart -= POW10(max);
+ }
+
+
+ /* Convert integer part */
+ do {
+ temp = intpart*0.1;
+ my_modf(temp, &intpart);
+ idx = (int) ((temp -intpart +0.05)* 10.0);
+ /* idx = (int) (((double)(temp*0.1) -intpart +0.05) *10.0); */
+ /* printf ("%llf, %f, %x\n", temp, intpart, idx); */
+ iconvert[iplace++] =
+ (caps? "0123456789ABCDEF":"0123456789abcdef")[idx];
+ } while (intpart && (iplace < 311));
+ if (iplace == 311) iplace--;
+ iconvert[iplace] = 0;
+
+ /* Convert fractional part */
+ if (fracpart)
+ {
+ do {
+ temp = fracpart*0.1;
+ my_modf(temp, &fracpart);
+ idx = (int) ((temp -fracpart +0.05)* 10.0);
+ /* idx = (int) ((((temp/10) -fracpart) +0.05) *10); */
+ /* printf ("%lf, %lf, %ld\n", temp, fracpart, idx ); */
+ fconvert[fplace++] =
+ (caps? "0123456789ABCDEF":"0123456789abcdef")[idx];
+ } while(fracpart && (fplace < 311));
+ if (fplace == 311) fplace--;
+ }
+ fconvert[fplace] = 0;
+
+ /* -1 for decimal point, another -1 if we are printing a sign */
+ padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0);
+ zpadlen = max - fplace;
+ if (zpadlen < 0) zpadlen = 0;
+ if (padlen < 0)
+ padlen = 0;
+ if (flags & DP_F_MINUS)
+ padlen = -padlen; /* Left Justify */
+
+ if ((flags & DP_F_ZERO) && (padlen > 0)) {
+ if (signvalue) {
+ dopr_outch (buffer, currlen, maxlen, signvalue);
+ --padlen;
+ signvalue = 0;
+ }
+ while (padlen > 0) {
+ dopr_outch (buffer, currlen, maxlen, '0');
+ --padlen;
+ }
+ }
+ while (padlen > 0) {
+ dopr_outch (buffer, currlen, maxlen, ' ');
+ --padlen;
+ }
+ if (signvalue)
+ dopr_outch (buffer, currlen, maxlen, signvalue);
+
+ while (iplace > 0)
+ dopr_outch (buffer, currlen, maxlen, iconvert[--iplace]);
+
+#ifdef DEBUG_SNPRINTF
+ printf("fmtfp: fplace=%d zpadlen=%d\n", fplace, zpadlen);
+#endif
+
+ /*
+ * Decimal point. This should probably use locale to find the correct
+ * char to print out.
+ */
+ if (max > 0) {
+ dopr_outch (buffer, currlen, maxlen, '.');
+
+ while (zpadlen > 0) {
+ dopr_outch (buffer, currlen, maxlen, '0');
+ --zpadlen;
+ }
+
+ while (fplace > 0)
+ dopr_outch (buffer, currlen, maxlen, fconvert[--fplace]);
+ }
+
+ while (padlen < 0) {
+ dopr_outch (buffer, currlen, maxlen, ' ');
+ ++padlen;
+ }
+}
+
+static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c)
+{
+ if (*currlen < maxlen) {
+ buffer[(*currlen)] = c;
+ }
+ (*currlen)++;
+}
+
+static struct pr_chunk *new_chunk(void) {
+ struct pr_chunk *new_c = (struct pr_chunk *)malloc(sizeof(struct pr_chunk));
+
+ if ( !new_c )
+ return NULL;
+
+ new_c->type = 0;
+ new_c->num = 0;
+ new_c->min = 0;
+ new_c->min_star = NULL;
+ new_c->max = -1;
+ new_c->max_star = NULL;
+ new_c->flags = 0;
+ new_c->cflags = 0;
+ new_c->start = 0;
+ new_c->len = 0;
+ new_c->value = 0;
+ new_c->fvalue = 0;
+ new_c->strvalue = NULL;
+ new_c->pnum = NULL;
+ new_c->next = NULL;
+
+ return new_c;
+}
+
+static int add_cnk_list_entry(struct pr_chunk_x **list,
+ int max_num, struct pr_chunk *chunk) {
+ struct pr_chunk_x *l;
+ struct pr_chunk **c;
+ int max;
+ int cnum;
+ int i, pos;
+
+ if (chunk->num > max_num) {
+ max = chunk->num;
+
+ if (*list == NULL) {
+ l = (struct pr_chunk_x *)malloc(sizeof(struct pr_chunk_x) * max);
+ pos = 0;
+ } else {
+ l = (struct pr_chunk_x *)realloc(*list, sizeof(struct pr_chunk_x) * max);
+ pos = max_num;
+ }
+ if (l == NULL) {
+ for (i = 0; i < max; i++) {
+ if ((*list)[i].chunks) free((*list)[i].chunks);
+ }
+ return 0;
+ }
+ for (i = pos; i < max; i++) {
+ l[i].chunks = NULL;
+ l[i].num = 0;
+ }
+ } else {
+ l = *list;
+ max = max_num;
+ }
+
+ i = chunk->num - 1;
+ cnum = l[i].num + 1;
+ if (l[i].chunks == NULL) {
+ c = (struct pr_chunk **)malloc(sizeof(struct pr_chunk *) * cnum);
+ } else {
+ c = (struct pr_chunk **)realloc(l[i].chunks, sizeof(struct pr_chunk *) * cnum);
+ }
+ if (c == NULL) {
+ for (i = 0; i < max; i++) {
+ if (l[i].chunks) free(l[i].chunks);
+ }
+ return 0;
+ }
+ c[l[i].num] = chunk;
+ l[i].chunks = c;
+ l[i].num = cnum;
+
+ *list = l;
+ return max;
+}
+
+ int smb_vsnprintf (char *str, size_t count, const char *fmt, va_list args)
+{
+ return dopr(str, count, fmt, args);
+}
+#define vsnprintf smb_vsnprintf
+#endif
+
+/* yes this really must be a ||. Don't muck with this (tridge)
+ *
+ * The logic for these two is that we need our own definition if the
+ * OS *either* has no definition of *sprintf, or if it does have one
+ * that doesn't work properly according to the autoconf test.
+ */
+#if !defined(HAVE_SNPRINTF) || !defined(HAVE_C99_VSNPRINTF)
+int smb_snprintf(char *str,size_t count,const char *fmt,...)
+{
+ size_t ret;
+ va_list ap;
+
+ va_start(ap, fmt);
+ ret = vsnprintf(str, count, fmt, ap);
+ va_end(ap);
+ return ret;
+}
+#define snprintf smb_snprintf
+#endif
+
+#endif
+
+#ifndef HAVE_VASPRINTF
+ int vasprintf(char **ptr, const char *format, va_list ap)
+{
+ int ret;
+ va_list ap2;
+
+ VA_COPY(ap2, ap);
+
+ ret = vsnprintf(NULL, 0, format, ap2);
+ if (ret <= 0) return ret;
+
+ (*ptr) = (char *)malloc(ret+1);
+ if (!*ptr) return -1;
+
+ VA_COPY(ap2, ap);
+
+ ret = vsnprintf(*ptr, ret+1, format, ap2);
+
+ return ret;
+}
+#endif
+
+
+#ifndef HAVE_ASPRINTF
+ int asprintf(char **ptr, const char *format, ...)
+{
+ va_list ap;
+ int ret;
+
+ *ptr = NULL;
+ va_start(ap, format);
+ ret = vasprintf(ptr, format, ap);
+ va_end(ap);
+
+ return ret;
+}
+#endif
+
+#ifdef TEST_SNPRINTF
+
+ int sprintf(char *str,const char *fmt,...);
+
+ int main (void)
+{
+ char buf1[1024];
+ char buf2[1024];
+ char *buf3;
+ char *fp_fmt[] = {
+ "%1.1f",
+ "%-1.5f",
+ "%1.5f",
+ "%123.9f",
+ "%10.5f",
+ "% 10.5f",
+ "%+22.9f",
+ "%+4.9f",
+ "%01.3f",
+ "%4f",
+ "%3.1f",
+ "%3.2f",
+ "%.0f",
+ "%f",
+ "%-8.8f",
+ "%-9.9f",
+ NULL
+ };
+ double fp_nums[] = { 6442452944.1234, -1.5, 134.21, 91340.2, 341.1234, 203.9, 0.96, 0.996,
+ 0.9996, 1.996, 4.136, 5.030201, 0.00205,
+ /* END LIST */ 0};
+ char *int_fmt[] = {
+ "%-1.5d",
+ "%1.5d",
+ "%123.9d",
+ "%5.5d",
+ "%10.5d",
+ "% 10.5d",
+ "%+22.33d",
+ "%01.3d",
+ "%4d",
+ "%d",
+ NULL
+ };
+ long int_nums[] = { -1, 134, 91340, 341, 0203, 0, 1234567890};
+ char *str_fmt[] = {
+ "%10.5s",
+ "%-10.5s",
+ "%5.10s",
+ "%-5.10s",
+ "%10.1s",
+ "%0.10s",
+ "%10.0s",
+ "%1.10s",
+ "%s",
+ "%.1s",
+ "%.10s",
+ "%10s",
+ NULL
+ };
+ char *str_vals[] = {"hello", "a", "", "a longer string", NULL};
+ int x, y;
+ int fail = 0;
+ int num = 0;
+ int l1, l2;
+
+ printf ("Testing snprintf format codes against system sprintf...\n");
+
+ for (x = 0; fp_fmt[x] ; x++) {
+ for (y = 0; fp_nums[y] != 0 ; y++) {
+ buf1[0] = buf2[0] = '\0';
+ l1 = snprintf(NULL, 0, fp_fmt[x], fp_nums[y]);
+ l2 = snprintf(buf1, sizeof(buf1), fp_fmt[x], fp_nums[y]);
+ sprintf (buf2, fp_fmt[x], fp_nums[y]);
+ buf1[1023] = buf1[1023] = '\0';
+ if (strcmp (buf1, buf2) || (l1 != l2)) {
+ printf("snprintf doesn't match Format: %s\n\tsnprintf(%d) = [%s]\n\t sprintf(%d) = [%s]\n",
+ fp_fmt[x], l1, buf1, l2, buf2);
+ fail++;
+ }
+ num++;
+ }
+ }
+
+ for (x = 0; int_fmt[x] ; x++) {
+ for (y = 0; int_nums[y] != 0 ; y++) {
+ buf1[0] = buf2[0] = '\0';
+ l1 = snprintf(NULL, 0, int_fmt[x], int_nums[y]);
+ l2 = snprintf(buf1, sizeof(buf1), int_fmt[x], int_nums[y]);
+ sprintf (buf2, int_fmt[x], int_nums[y]);
+ buf1[1023] = buf1[1023] = '\0';
+ if (strcmp (buf1, buf2) || (l1 != l2)) {
+ printf("snprintf doesn't match Format: %s\n\tsnprintf(%d) = [%s]\n\t sprintf(%d) = [%s]\n",
+ int_fmt[x], l1, buf1, l2, buf2);
+ fail++;
+ }
+ num++;
+ }
+ }
+
+ for (x = 0; str_fmt[x] ; x++) {
+ for (y = 0; str_vals[y] != 0 ; y++) {
+ buf1[0] = buf2[0] = '\0';
+ l1 = snprintf(NULL, 0, str_fmt[x], str_vals[y]);
+ l2 = snprintf(buf1, sizeof(buf1), str_fmt[x], str_vals[y]);
+ sprintf (buf2, str_fmt[x], str_vals[y]);
+ buf1[1023] = buf1[1023] = '\0';
+ if (strcmp (buf1, buf2) || (l1 != l2)) {
+ printf("snprintf doesn't match Format: %s\n\tsnprintf(%d) = [%s]\n\t sprintf(%d) = [%s]\n",
+ str_fmt[x], l1, buf1, l2, buf2);
+ fail++;
+ }
+ num++;
+ }
+ }
+
+#define BUFSZ 2048
+
+ buf1[0] = buf2[0] = '\0';
+ if ((buf3 = malloc(BUFSZ)) == NULL) {
+ fail++;
+ } else {
+ num++;
+ memset(buf3, 'a', BUFSZ);
+ snprintf(buf1, sizeof(buf1), "%.*s", 1, buf3);
+ buf1[1023] = '\0';
+ if (strcmp(buf1, "a") != 0) {
+ printf("length limit buf1 '%s' expected 'a'\n", buf1);
+ fail++;
+ }
+ }
+
+ buf1[0] = buf2[0] = '\0';
+ l1 = snprintf(buf1, sizeof(buf1), "%4$*1$d %2$s %3$*1$.*1$f", 3, "pos test", 12.3456, 9);
+ l2 = sprintf(buf2, "%4$*1$d %2$s %3$*1$.*1$f", 3, "pos test", 12.3456, 9);
+ buf1[1023] = buf1[1023] = '\0';
+ if (strcmp(buf1, buf2) || (l1 != l2)) {
+ printf("snprintf doesn't match Format: %s\n\tsnprintf(%d) = [%s]\n\t sprintf(%d) = [%s]\n",
+ "%4$*1$d %2$s %3$*1$.*1$f", l1, buf1, l2, buf2);
+ fail++;
+ }
+
+ buf1[0] = buf2[0] = '\0';
+ l1 = snprintf(buf1, sizeof(buf1), "%4$*4$d %2$s %3$*4$.*4$f", 3, "pos test", 12.3456, 9);
+ l2 = sprintf(buf2, "%4$*4$d %2$s %3$*4$.*4$f", 3, "pos test", 12.3456, 9);
+ buf1[1023] = buf1[1023] = '\0';
+ if (strcmp(buf1, buf2)) {
+ printf("snprintf doesn't match Format: %s\n\tsnprintf(%d) = [%s]\n\t sprintf(%d) = [%s]\n",
+ "%4$*1$d %2$s %3$*1$.*1$f", l1, buf1, l2, buf2);
+ fail++;
+ }
+#if 0
+ buf1[0] = buf2[0] = '\0';
+ l1 = snprintf(buf1, sizeof(buf1), "%lld", (LLONG)1234567890);
+ l2 = sprintf(buf2, "%lld", (LLONG)1234567890);
+ buf1[1023] = buf1[1023] = '\0';
+ if (strcmp(buf1, buf2)) {
+ printf("snprintf doesn't match Format: %s\n\tsnprintf(%d) = [%s]\n\t sprintf(%d) = [%s]\n",
+ "%lld", l1, buf1, l2, buf2);
+ fail++;
+ }
+
+ buf1[0] = buf2[0] = '\0';
+ l1 = snprintf(buf1, sizeof(buf1), "%Lf", (LDOUBLE)890.1234567890123);
+ l2 = sprintf(buf2, "%Lf", (LDOUBLE)890.1234567890123);
+ buf1[1023] = buf1[1023] = '\0';
+ if (strcmp(buf1, buf2)) {
+ printf("snprintf doesn't match Format: %s\n\tsnprintf(%d) = [%s]\n\t sprintf(%d) = [%s]\n",
+ "%Lf", l1, buf1, l2, buf2);
+ fail++;
+ }
+#endif
+ printf ("%d tests failed out of %d.\n", fail, num);
+
+ printf("seeing how many digits we support\n");
+ {
+ double v0 = 0.12345678901234567890123456789012345678901;
+ for (x=0; x<100; x++) {
+ double p = pow(10, x);
+ double r = v0*p;
+ snprintf(buf1, sizeof(buf1), "%1.1f", r);
+ sprintf(buf2, "%1.1f", r);
+ if (strcmp(buf1, buf2)) {
+ printf("we seem to support %d digits\n", x-1);
+ break;
+ }
+ }
+ }
+
+ return 0;
+}
+#endif /* TEST_SNPRINTF */
diff --git a/src/utils.c b/src/utils.c
new file mode 100644
index 0000000..a5aa519
--- /dev/null
+++ b/src/utils.c
@@ -0,0 +1,590 @@
+/****************************************************************************
+ *
+ * utils.c - NRPE Utility Functions
+ *
+ * License: GPLv2
+ * Copyright (c) 2009-2017 Nagios Enterprises
+ * 1999-2008 Ethan Galstad (nagios@nagios.org)
+ *
+ * Description:
+ *
+ * This file contains common network functions used in nrpe and check_nrpe.
+ *
+ * License Notice:
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ ****************************************************************************/
+
+#include "../include/common.h"
+#include "../include/utils.h"
+#include <stdarg.h>
+#ifdef HAVE_PATHS_H
+#include <paths.h>
+#endif
+
+#ifndef HAVE_ASPRINTF
+extern int asprintf(char **ptr, const char *format, ...);
+#endif
+#ifndef HAVE_VASPRINTF
+extern int vasprintf(char **ptr, const char *format, va_list ap);
+#endif
+
+#ifndef NI_MAXSERV
+# define NI_MAXSERV 32
+#endif
+
+#ifndef NI_MAXHOST
+# define NI_MAXHOST 1025
+#endif
+
+extern char **environ;
+
+static unsigned long crc32_table[256];
+
+char *log_file = NULL;
+FILE *log_fp = NULL;
+
+static int my_create_socket(struct addrinfo *ai, const char *bind_address, int redirect_stderr);
+
+
+/* build the crc table - must be called before calculating the crc value */
+void generate_crc32_table(void)
+{
+ unsigned long crc, poly;
+ int i, j;
+
+ poly = 0xEDB88320L;
+ for (i = 0; i < 256; i++) {
+ crc = i;
+ for (j = 8; j > 0; j--) {
+ if (crc & 1)
+ crc = (crc >> 1) ^ poly;
+ else
+ crc >>= 1;
+ }
+ crc32_table[i] = crc;
+ }
+
+ return;
+}
+
+/* calculates the CRC 32 value for a buffer */
+unsigned long calculate_crc32(char *buffer, int buffer_size)
+{
+ register unsigned long crc = 0xFFFFFFFF;
+ int this_char;
+ int current_index;
+
+ for (current_index = 0; current_index < buffer_size; current_index++) {
+ this_char = (int)buffer[current_index];
+ crc = ((crc >> 8) & 0x00FFFFFF) ^ crc32_table[(crc ^ this_char) & 0xFF];
+ }
+
+ return (crc ^ 0xFFFFFFFF);
+}
+
+/* fill a buffer with semi-random data */
+void randomize_buffer(char *buffer, int buffer_size)
+{
+ FILE *fp;
+ int x;
+ int seed;
+
+ /**** FILL BUFFER WITH RANDOM ALPHA-NUMERIC CHARACTERS ****/
+
+ /***************************************************************
+ Only use alpha-numeric characters because plugins usually
+ only generate numbers and letters in their output. We
+ want the buffer to contain the same set of characters as
+ plugins, so its harder to distinguish where the real output
+ ends and the rest of the buffer (padded randomly) starts.
+ ***************************************************************/
+
+ /* try to get seed value from /dev/urandom, as its a better source of entropy */
+ fp = fopen("/dev/urandom", "r");
+ if (fp != NULL) {
+ seed = fgetc(fp);
+ fclose(fp);
+ }
+ /* else fallback to using the current time as the seed */
+ else
+ seed = (int)time(NULL);
+
+ srand(seed);
+ for (x = 0; x < buffer_size; x++)
+ buffer[x] = (int)'0' + (int)(72.0 * rand() / (RAND_MAX + 1.0));
+
+ return;
+}
+
+/* opens a connection to a remote host */
+#ifdef HAVE_STRUCT_SOCKADDR_STORAGE
+int my_connect(const char *host, struct sockaddr_storage *hostaddr, u_short port,
+ int address_family, const char *bind_address, int redirect_stderr)
+#else
+int my_connect(const char *host, struct sockaddr *hostaddr, u_short port,
+ int address_family, const char *bind_address, int redirect_stderr)
+#endif
+{
+ struct addrinfo hints, *ai, *aitop;
+ char ntop[NI_MAXHOST], strport[NI_MAXSERV];
+ int gaierr;
+ int sock = -1;
+
+ FILE *output = stderr;
+ if (redirect_stderr)
+ output = stdout;
+
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = address_family;
+ hints.ai_socktype = SOCK_STREAM;
+ snprintf(strport, sizeof strport, "%u", port);
+ if ((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0) {
+ fprintf(output, "Could not resolve hostname %.100s: %s\n", host, gai_strerror(gaierr));
+ exit(1);
+ }
+
+ /*
+ * Loop through addresses for this host, and try each one in
+ * sequence until the connection succeeds.
+ */
+ for (ai = aitop; ai; ai = ai->ai_next) {
+ if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
+ continue;
+ if (getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop, sizeof(ntop),
+ strport, sizeof(strport), NI_NUMERICHOST | NI_NUMERICSERV) != 0) {
+ fprintf(output, "my_connect: getnameinfo failed\n");
+ continue;
+ }
+
+ /* Create a socket for connecting. */
+ sock = my_create_socket(ai, bind_address, redirect_stderr);
+ if (sock < 0)
+ continue; /* Any error is already output */
+
+ if (connect(sock, ai->ai_addr, ai->ai_addrlen) >= 0) {
+ /* Successful connection. */
+ memcpy(hostaddr, ai->ai_addr, ai->ai_addrlen);
+ break;
+ } else {
+ fprintf(output, "connect to address %s port %s: %s\n", ntop, strport,
+ strerror(errno));
+ close(sock);
+ sock = -1;
+ }
+ }
+
+ freeaddrinfo(aitop);
+
+ /* Return failure if we didn't get a successful connection. */
+ if (sock == -1) {
+ fprintf(output, "connect to host %s port %s: %s\n", host, strport, strerror(errno));
+ return -1;
+ }
+ return sock;
+}
+
+/* Creates a socket for the connection. */
+int my_create_socket(struct addrinfo *ai, const char *bind_address, int redirect_stderr)
+{
+ int sock, gaierr;
+ struct addrinfo hints, *res;
+
+ FILE *output = stderr;
+ if (redirect_stderr)
+ output = stdout;
+
+ sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
+ if (sock < 0)
+ fprintf(output, "socket: %.100s\n", strerror(errno));
+
+ /* Bind the socket to an alternative local IP address */
+ if (bind_address == NULL)
+ return sock;
+
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = ai->ai_family;
+ hints.ai_socktype = ai->ai_socktype;
+ hints.ai_protocol = ai->ai_protocol;
+ hints.ai_flags = AI_PASSIVE;
+ gaierr = getaddrinfo(bind_address, NULL, &hints, &res);
+ if (gaierr) {
+ fprintf(output, "getaddrinfo: %s: %s\n", bind_address, gai_strerror(gaierr));
+ close(sock);
+ return -1;
+ }
+ if (bind(sock, res->ai_addr, res->ai_addrlen) < 0) {
+ fprintf(output, "bind: %s: %s\n", bind_address, strerror(errno));
+ close(sock);
+ freeaddrinfo(res);
+ return -1;
+ }
+ freeaddrinfo(res);
+ return sock;
+}
+
+void add_listen_addr(struct addrinfo **listen_addrs, int address_family, char *addr, int port)
+{
+ struct addrinfo hints, *ai, *aitop;
+ char strport[NI_MAXSERV];
+ int gaierr;
+
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = address_family;
+ hints.ai_socktype = SOCK_STREAM;
+ hints.ai_flags = (addr == NULL) ? AI_PASSIVE : 0;
+ snprintf(strport, sizeof strport, "%d", port);
+ if ((gaierr = getaddrinfo(addr, strport, &hints, &aitop)) != 0) {
+ logit(LOG_ERR, "bad addr or host: %s (%s)\n", addr ? addr : "<NULL>",
+ gai_strerror(gaierr));
+ exit(1);
+ }
+ for (ai = aitop; ai->ai_next; ai = ai->ai_next) ;
+ ai->ai_next = *listen_addrs;
+ *listen_addrs = aitop;
+}
+
+int clean_environ(const char *keep_env_vars, const char *nrpe_user)
+{
+#if defined(HAVE_PATHS_H) && defined(_PATH_STDPATH)
+ static char *path = _PATH_STDPATH;
+#else
+ static char *path = "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin";
+#endif
+ struct passwd *pw;
+ size_t len, var_sz = 0;
+ char **kept = NULL, *value, *var, *keep = NULL;
+ int i, j, keepcnt = 0;
+
+ if (keep_env_vars && *keep_env_vars)
+ asprintf(&keep, "%s,NRPE_MULTILINESUPPORT,NRPE_PROGRAMVERSION", keep_env_vars);
+ else
+ asprintf(&keep, "NRPE_MULTILINESUPPORT,NRPE_PROGRAMVERSION");
+ if (keep == NULL) {
+ logit(LOG_ERR, "Could not sanitize the environment. Aborting!");
+ return ERROR;
+ }
+
+ ++keepcnt;
+ i = strlen(keep);
+ while (i--) {
+ if (keep[i] == ',')
+ ++keepcnt;
+ }
+
+ if ((kept = calloc(keepcnt + 1, sizeof(char *))) == NULL) {
+ logit(LOG_ERR, "Could not sanitize the environment. Aborting!");
+ return ERROR;
+ }
+ for (i = 0, var = my_strsep(&keep, ","); var != NULL; var = my_strsep(&keep, ","))
+ kept[i++] = strip(var);
+
+ var = NULL;
+ i = 0;
+ while (environ[i]) {
+ value = environ[i];
+ if ((len = strcspn(value, "=")) == 0) {
+ free(keep);
+ free(kept);
+ free(var);
+ logit(LOG_ERR, "Could not sanitize the environment. Aborting!");
+ return ERROR;
+ }
+ if (len >= var_sz) {
+ var_sz = len + 1;
+ var = realloc(var, var_sz);
+ }
+ strncpy(var, environ[i], var_sz);
+ var[len] = 0;
+
+ for (j = 0; kept[j]; ++j) {
+ if (!strncmp(var, kept[j], strlen(kept[j])))
+ break;
+ }
+ if (kept[j]) {
+ ++i;
+ continue;
+ }
+
+ unsetenv(var);
+ }
+
+ free(var);
+ free(keep);
+ free(kept);
+
+
+ char * user = NULL;
+
+ if (nrpe_user != NULL) {
+ user = strdup(nrpe_user);
+ pw = (struct passwd *)getpwnam(nrpe_user);
+ }
+
+ if (nrpe_user == NULL || pw == NULL) {
+ pw = (struct passwd *)getpwuid(getuid());
+ if (pw != NULL) {
+ user = strdup(pw->pw_name);
+ }
+ }
+
+ if (pw == NULL) {
+ free(user);
+ return OK;
+ }
+
+ setenv("PATH", path, 1);
+ setenv("IFS", " \t\n", 1);
+ setenv("LOGNAME", user, 0);
+ setenv("USER", user, 0);
+ setenv("HOME", pw->pw_dir, 0);
+ setenv("SHELL", pw->pw_shell, 0);
+
+ free(user);
+
+ return OK;
+}
+
+char *strip(char *buffer)
+{
+ int x;
+ int index;
+ char *buf = buffer;
+
+ for (x = strlen(buffer); x >= 1; x--) {
+ index = x - 1;
+ if (buffer[index] == ' ' || buffer[index] == '\r' || buffer[index] == '\n'
+ || buffer[index] == '\t')
+ buffer[index] = '\x0';
+ else
+ break;
+ }
+
+ while (*buf == ' ' || *buf == '\r' || *buf == '\n' || *buf == '\t') {
+ ++buf;
+ --x;
+ }
+ if (buf != buffer) {
+ memmove(buffer, buf, x);
+ buffer[x] = '\x0';
+ }
+
+ return buffer;
+}
+
+/* sends all data - thanks to Beej's Guide to Network Programming */
+int sendall(int s, char *buf, int *len)
+{
+ int total = 0;
+ int bytesleft = *len;
+ int n = 0;
+
+ /* send all the data */
+ while (total < *len) {
+ n = send(s, buf + total, bytesleft, 0); /* send some data */
+ if (n == -1) /* break on error */
+ break;
+ /* apply bytes we sent */
+ total += n;
+ bytesleft -= n;
+ }
+
+ *len = total; /* return number of bytes actually sent here */
+ return n == -1 ? -1 : 0; /* return -1 on failure, 0 on success */
+}
+
+/* receives all data - modelled after sendall() */
+int recvall(int s, char *buf, int *len, int timeout)
+{
+ time_t start_time;
+ time_t current_time;
+ int total = 0;
+ int bytesleft = *len;
+ int n = 0;
+
+ bzero(buf, *len); /* clear the receive buffer */
+ time(&start_time);
+
+ /* receive all data */
+ while (total < *len) {
+ n = recv(s, buf + total, bytesleft, 0); /* receive some data */
+
+ if (n == -1 && errno == EAGAIN) {
+ /* no data has arrived yet (non-blocking socket) */
+ time(&current_time);
+ if (current_time - start_time > timeout)
+ break;
+ sleep(1);
+ continue;
+ } else if (n <= 0)
+ break; /* receive error or client disconnect */
+
+ /* apply bytes we received */
+ total += n;
+ bytesleft -= n;
+ }
+
+ /* return number of bytes actually received here */
+ *len = total;
+
+ /* return <=0 on failure, bytes received on success */
+ return (n <= 0) ? n : total;
+}
+
+
+/* fixes compiler problems under Solaris, since strsep() isn't included */
+
+/* this code is taken from the glibc source */
+char *my_strsep(char **stringp, const char *delim)
+{
+ char *begin, *end;
+
+ begin = *stringp;
+ if (begin == NULL)
+ return NULL;
+
+ /* A frequent case is when the delimiter string contains only one
+ character. Here we don't need to call the expensive `strpbrk'
+ function and instead work using `strchr'. */
+ if (delim[0] == '\0' || delim[1] == '\0') {
+ char ch = delim[0];
+
+ if (ch == '\0')
+ end = NULL;
+ else {
+ if (*begin == ch)
+ end = begin;
+ else
+ end = strchr(begin + 1, ch);
+ }
+
+ } else
+ end = strpbrk(begin, delim); /* Find the end of the token. */
+
+ if (end) {
+ /* Terminate the token and set *STRINGP past NUL character. */
+ *end++ = '\0';
+ *stringp = end;
+ } else
+ /* No more delimiters; this is the last token. */
+ *stringp = NULL;
+
+ return begin;
+}
+
+void open_log_file()
+{
+ int fh;
+ int flags = O_RDWR|O_APPEND|O_CREAT;
+ struct stat st;
+
+ close_log_file();
+
+ if (!log_file)
+ return;
+
+#ifdef O_NOFOLLOW
+ flags |= O_NOFOLLOW;
+#endif
+ if ((fh = open(log_file, flags, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)) == -1) {
+ printf("Warning: Cannot open log file '%s' for writing\n", log_file);
+ logit(LOG_WARNING, "Warning: Cannot open log file '%s' for writing", log_file);
+ return;
+ }
+ log_fp = fdopen(fh, "a+");
+ if(log_fp == NULL) {
+ printf("Warning: Cannot open log file '%s' for writing\n", log_file);
+ logit(LOG_WARNING, "Warning: Cannot open log file '%s' for writing", log_file);
+ return;
+ }
+
+ if ((fstat(fh, &st)) == -1) {
+ log_fp = NULL;
+ close(fh);
+ printf("Warning: Cannot fstat log file '%s'\n", log_file);
+ logit(LOG_WARNING, "Warning: Cannot fstat log file '%s'", log_file);
+ return;
+ }
+ if (st.st_nlink != 1 || (st.st_mode & S_IFMT) != S_IFREG) {
+ log_fp = NULL;
+ close(fh);
+ printf("Warning: log file '%s' has an invalid mode\n", log_file);
+ logit(LOG_WARNING, "Warning: log file '%s' has an invalid mode", log_file);
+ return;
+ }
+
+ (void)fcntl(fileno(log_fp), F_SETFD, FD_CLOEXEC);
+}
+
+void logit(int priority, const char *format, ...)
+{
+ time_t log_time = 0L;
+ va_list ap;
+ char *buffer = NULL;
+
+ if (!format || !*format)
+ return;
+
+ va_start(ap, format);
+ if(vasprintf(&buffer, format, ap) > 0) {
+ if (log_fp) {
+ time(&log_time);
+ /* strip any newlines from the end of the buffer */
+ strip(buffer);
+
+ /* write the buffer to the log file */
+ fprintf(log_fp, "[%llu] %s\n", (unsigned long long)log_time, buffer);
+ fflush(log_fp);
+
+ } else
+ syslog(priority, "%s", buffer);
+
+ free(buffer);
+ }
+ va_end(ap);
+}
+
+void close_log_file()
+{
+ if(!log_fp)
+ return;
+
+ fflush(log_fp);
+ fclose(log_fp);
+ log_fp = NULL;
+ return;
+}
+
+/* show license */
+void display_license(void)
+{
+ printf("This program is released under the GPL (see below) with the additional\n");
+ printf("exemption that compiling, linking, and/or using OpenSSL is allowed.\n\n");
+
+ printf("This program is free software; you can redistribute it and/or modify\n");
+ printf("it under the terms of the GNU General Public License as published by\n");
+ printf("the Free Software Foundation; either version 2 of the License, or\n");
+ printf("(at your option) any later version.\n\n");
+ printf("This program is distributed in the hope that it will be useful,\n");
+ printf("but WITHOUT ANY WARRANTY; without even the implied warranty of\n");
+ printf("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n");
+ printf("GNU General Public License for more details.\n\n");
+ printf("You should have received a copy of the GNU General Public License\n");
+ printf("along with this program; if not, write to the Free Software\n");
+ printf("Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\n\n");
+
+ return;
+}
diff --git a/startup/bsd-init.in b/startup/bsd-init.in
new file mode 100644
index 0000000..96551ae
--- /dev/null
+++ b/startup/bsd-init.in
@@ -0,0 +1,90 @@
+#!/bin/sh
+
+# Start/stop/restart/reload nrpe
+# Copyright (c) 2016 Nagios(R) Core(TM) Development Team
+
+NRPE_BIN=@sbindir@/nrpe
+NRPE_CFG=@pkgsysconfdir@/nrpe.cfg
+PID_DIR=@piddir@
+PID_FILE=@piddir@/nrpe.pid
+
+# Start nrpe
+nrpe_start() {
+ echo -n "Starting nrpe daemon: $NRPE_BIN - "
+ if [ ! -d "$PID_DIR" ]; then
+ mkdir -p "$PID_DIR"
+ fi
+ $NRPE_BIN -c $NRPE_CFG -d
+ if [ $? = 0 ]; then
+ echo "started"
+ else
+ echo "failed"
+ fi
+}
+
+# Stop nrpe
+nrpe_stop() {
+ echo -n "Stopping nrpe daemon - "
+ if [ -r "$PID_FILE" ]; then
+ kill $(cat "$PID_FILE")
+ else
+ killall nrpe
+ fi
+ if [ $? = 0 ]; then
+ echo "stopped"
+ else
+ echo "failed"
+ fi
+}
+
+# Restart nrpe
+nrpe_restart() {
+ nrpe_stop
+ sleep 1
+ nrpe_start
+}
+
+# Reload nrpe
+nrpe_reload() {
+ echo -n "Reloading nrpe daemon - "
+ if [ -r "$PID_FILE" ]; then
+ kill -HUP $(cat "$PID_FILE")
+ else
+ killall -HUP nrpe
+ fi
+ if [ $? = 0 ]; then
+ echo "reloaded"
+ else
+ echo "failed"
+ fi
+}
+
+# nrpe status
+nrpe_status() {
+ if ps -C nrpe >/dev/null; then
+ echo "nrpe is running."
+ else
+ echo "nrpe is stopped."
+ fi
+}
+
+case "$1" in
+'start')
+ nrpe_start
+ ;;
+'stop')
+ nrpe_stop
+ ;;
+'restart')
+ nrpe_restart
+ ;;
+'reload')
+ nrpe_reload
+ ;;
+'status')
+ nrpe_status
+ ;;
+*)
+ echo "Usage $0 start|stop|restart|reload|status"
+ ;;
+esac
diff --git a/startup/debian-init.in b/startup/debian-init.in
new file mode 100644
index 0000000..47341a5
--- /dev/null
+++ b/startup/debian-init.in
@@ -0,0 +1,47 @@
+#!/bin/sh
+#
+# Copyright (c) 2016 Nagios(R) Core(TM) Development Team
+#
+# Start/stop the nrpe daemon.
+
+NRPE_BIN=@sbindir@/nrpe
+NRPE_CFG=@pkgsysconfdir@/nrpe.cfg
+PID_FILE=@piddir@/nrpe.pid
+
+test -x $NRPE_BIN || exit 0
+
+case "$1" in
+
+start)
+ echo -n "Starting nagios remote plugin daemon: nrpe"
+ start-stop-daemon --start --quiet --pidfile $PID_FILE --exec $NRPE_BIN -- -c $NRPE_CFG -d
+ echo "."
+ ;;
+
+stop)
+ echo -n "Stopping nagios remote plugin daemon: nrpe"
+ start-stop-daemon --stop --quiet --pidfile $PID_FILE --exec $NRPE_BIN
+ echo "."
+ ;;
+
+restart|force-reload)
+ echo -n "Restarting nagios remote plugin daemon: nrpe"
+ start-stop-daemon --stop --quiet --pidfile $PID_FILE --exec $NRPE_BIN
+ start-stop-daemon --start --quiet --pidfile $PID_FILE --exec $NRPE_BIN -- -c $NRPE_CFG -d
+ echo "."
+ ;;
+
+reload)
+ echo -n "Reloading configuration files for nagios remote plugin daemon: nrpe"
+ test -f $PID_FILE || exit 0
+ test -x /bin/kill && /bin/kill -HUP `cat $PID_FILE`
+ echo "."
+ ;;
+
+*)
+ echo "Usage: $0 start|stop|restart|reload|force-reload"
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/startup/default-inetd.in b/startup/default-inetd.in
new file mode 100644
index 0000000..04837c9
--- /dev/null
+++ b/startup/default-inetd.in
@@ -0,0 +1,5 @@
+#
+# Enable the following entry to enable the nrpe daemon
+#nrpe stream tcp nowait @nrpe_user@ @sbindir@/nrpe nrpe -c @pkgsysconfdir@/nrpe.cfg --inetd
+# Enable the following entry if the nrpe daemon didn't link with libwrap
+#nrpe stream tcp nowait @nrpe_user@ /usr/sbin/tcpd @sbindir@/nrpe -c @pkgsysconfdir@/nrpe.cfg --inetd
diff --git a/startup/default-init.in b/startup/default-init.in
new file mode 100644
index 0000000..b0f02a2
--- /dev/null
+++ b/startup/default-init.in
@@ -0,0 +1,157 @@
+#!/bin/sh
+#
+# Copyright (c) 2016 Nagios(R) Core(TM) Development Team
+#
+# chkconfig: - 80 30
+# description: Starts and stops the Nagios Remote Plugin Executor \
+# so a remote nagios server can run plugins on this host
+#
+### BEGIN INIT INFO
+# Provides: nrpe
+# Required-Start: $local_fs $remote_fs $time
+# Required-Stop: $local_fs $remote_fs
+# Should-Start: $syslog $network
+# Should-Stop: $syslog $network
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Starts and stops the Nagios Remote Plugin Executor
+# Description: Starts and stops the Nagios Remote Plugin Executor
+# so a remote nagios server can run plugins on this host
+### END INIT INFO
+
+
+NRPE_BIN=@sbindir@/nrpe
+NRPE_CFG=@pkgsysconfdir@/nrpe.cfg
+LOCK_DIR=@subsyslockdir@
+LOCK_FILE=@subsyslockfile@
+PID_FILE=@piddir@/nrpe.pid
+
+test -x $NRPE_BIN || exit 5
+
+RETVAL=0
+_set_rc (){ return; }
+
+# Default these commands/functions to RedHat/CentOS etc. values
+MSG_CMD="echo -n"
+START_CMD="daemon --pidfile $PID_FILE"
+TERM_CMD="killproc -p $PID_FILE $NRPE_BIN -TERM"
+HUP_CMD="killproc -p $PID_FILE $NRPE_BIN -HUP"
+PRT_STAT="echo"
+STAT_MSG="echo -n Checking for nrpe daemon... "
+STAT_CMD="status nrpe"
+EXIT_CMD="exit"
+
+
+# Source the function library
+if [ -f /etc/rc.status ]; then
+
+ . /etc/rc.status
+
+ _set_rc (){ return $RETVAL; }
+
+ # Set these commands/functions to SuSE etc. values
+ START_CMD="startproc -p $PID_FILE"
+ TERM_CMD="killproc -p $PID_FILE -TERM $NRPE_BIN"
+ HUP_CMD="killproc -p $PID_FILE -HUP $NRPE_BIN"
+ PRT_STAT="rc_status -v -r"
+ STAT_CMD="checkproc -p $PID_FILE $NRPE_BIN"
+ EXIT_CMD="rc_exit"
+ rc_reset
+
+elif [ -f /etc/rc.d/init.d/functions ]; then
+
+ . /etc/rc.d/init.d/functions
+
+elif [ -f /etc/init.d/functions ]; then
+
+ . /etc/init.d/functions
+
+elif [ -f /lib/lsb/init-functions ]; then
+
+ . /lib/lsb/init-functions
+
+ MSG_CMD="log_daemon_msg"
+ START_CMD="start_daemon -p $PID_FILE"
+ PRT_STAT="log_end_msg"
+ STAT_MSG=
+ STAT_CMD="status_of_proc -p $PID_FILE $NRPE_BIN nrpe"
+
+elif [ -f /etc/rc.d/functions ]; then
+
+ . /etc/rc.d/functions
+
+fi
+
+
+# See how we were called.
+case "$1" in
+
+start)
+ # Start daemons.
+ $MSG_CMD "Starting nrpe "
+ $START_CMD $NRPE_BIN -c $NRPE_CFG -d
+ RETVAL=$?
+ if test "$PRT_STAT" = log_end_msg; then
+ $PRT_STAT $RETVAL
+ else
+ _set_rc; $PRT_STAT
+ fi
+ if [ $RETVAL = 0 ]; then
+ [ -d $LOCK_DIR ] && touch $LOCK_FILE || true
+ fi
+ ;;
+
+stop)
+ # Stop daemons.
+ $MSG_CMD "Shutting down nrpe "
+ $TERM_CMD
+ RETVAL=$?
+ if test "$PRT_STAT" = log_end_msg; then
+ $PRT_STAT $RETVAL
+ else
+ _set_rc; $PRT_STAT
+ fi
+ if [ $RETVAL = 0 ]; then
+ [ -d $LOCK_DIR ] && rm -f $LOCK_FILE
+ fi
+ ;;
+
+restart|force-reload)
+ $0 stop
+ $0 start
+ RETVAL=$?
+ ;;
+
+reload)
+ $MSG_CMD "Reloading nrpe "
+ $HUP_CMD
+ RETVAL=$?
+ if test "$PRT_STAT" = log_end_msg; then
+ $PRT_STAT $RETVAL
+ else
+ _set_rc; $PRT_STAT
+ fi
+ ;;
+
+try-restart|condrestart)
+ $STAT_CMD || exit 0
+ $0 stop
+ $0 start
+ RETVAL=$?
+ ;;
+
+status)
+ $STAT_MSG
+ $STAT_CMD
+ RETVAL=$?
+ if test "$PRT_STAT" != log_end_msg; then
+ _set_rc; $PRT_STAT
+ fi
+ ;;
+
+*)
+ echo "Usage: nrpe {start|stop|restart|reload|try-restart|condrestart|status}"
+ exit 1
+esac
+
+$EXIT_CMD $RETVAL
diff --git a/startup/default-service.in b/startup/default-service.in
new file mode 100644
index 0000000..b6c6063
--- /dev/null
+++ b/startup/default-service.in
@@ -0,0 +1,24 @@
+[Unit]
+Description=Nagios Remote Plugin Executor
+Documentation=http://www.nagios.org/documentation
+After=var-run.mount nss-lookup.target network.target local-fs.target time-sync.target
+Before=getty@tty1.service plymouth-quit.service xdm.service
+Conflicts=nrpe.socket
+
+[Install]
+WantedBy=multi-user.target
+
+[Service]
+Type=simple
+Restart=on-abort
+PIDFile=@piddir@/nrpe.pid
+RuntimeDirectory=nrpe
+RuntimeDirectoryMode=0755
+ExecStart=@sbindir@/nrpe -c @pkgsysconfdir@/nrpe.cfg -f
+ExecReload=/bin/kill -HUP $MAINPID
+ExecStopPost=/bin/rm -f @piddir@/nrpe.pid
+TimeoutStopSec=60
+User=@nrpe_user@
+Group=@nrpe_group@
+PrivateTmp=true
+OOMScoreAdjust=-500
diff --git a/startup/default-socket-svc.in b/startup/default-socket-svc.in
new file mode 100644
index 0000000..7e6acac
--- /dev/null
+++ b/startup/default-socket-svc.in
@@ -0,0 +1,16 @@
+[Unit]
+Description=Nagios Remote Plugin Executor
+Documentation=http://www.nagios.org/documentation
+After=var-run.mount nss-lookup.target network.target local-fs.target time-sync.target
+
+[Service]
+Restart=on-failure
+ExecStart=@sbindir@/nrpe -c @pkgsysconfdir@/nrpe.cfg --inetd
+KillMode=process
+User=@nrpe_user@
+Group=@nrpe_group@
+PrivateTmp=true
+OOMScoreAdjust=-500
+
+[Install]
+WantedBy=multi-user.target
diff --git a/startup/default-socket.in b/startup/default-socket.in
new file mode 100644
index 0000000..0921fe8
--- /dev/null
+++ b/startup/default-socket.in
@@ -0,0 +1,12 @@
+[Unit]
+Description=Nagios Remote Plugin Executor
+Documentation=http://www.nagios.org/documentation
+Before=nrpe.service
+Conflicts=nrpe.service
+
+[Socket]
+ListenStream=@nrpe_port@
+Accept=yes
+
+[Install]
+WantedBy=sockets.target
diff --git a/startup/default-xinetd.in b/startup/default-xinetd.in
new file mode 100644
index 0000000..3b5e87f
--- /dev/null
+++ b/startup/default-xinetd.in
@@ -0,0 +1,15 @@
+# default: off
+# description: NRPE (Nagios Remote Plugin Executor)
+service nrpe
+{
+ disable = yes
+ socket_type = stream
+ port = @nrpe_port@
+ wait = no
+ user = @nrpe_user@
+ group = @nrpe_group@
+ server = @sbindir@/nrpe
+ server_args = -c @pkgsysconfdir@/nrpe.cfg --inetd
+ only_from = 127.0.0.1
+ log_on_success =
+}
diff --git a/startup/gentoo-init.in b/startup/gentoo-init.in
new file mode 100644
index 0000000..c7adc55
--- /dev/null
+++ b/startup/gentoo-init.in
@@ -0,0 +1,49 @@
+#!/sbin/openrc-run
+#
+# Copyright (c) 2016 Nagios(R) Core(TM) Development Team
+#
+# Start/stop the nrpe daemon.
+#
+# Goes in /etc/init.d - Config is in /etc/conf.d/nrpe
+
+extra_started_commands="reload"
+
+NRPE_BIN="@sbindir@/nrpe"
+NRPE_PID="@piddir@/nrpe.pid"
+NRPE_CFG=@pkgsysconfdir@/nrpe.cfg
+
+depend() {
+ use logger dns net localmount netmount nfsmount
+}
+
+checkconfig() {
+ # Make sure the config file exists
+ if [ ! -f $NRPE_CFG ]; then
+ eerror "You need to setup $NRPE_CFG."
+ return 1
+ fi
+ return 0
+}
+
+start() {
+ checkconfig || return 1
+ ebegin "Starting nrpe"
+ # Make sure we have a sane current directory
+ cd /
+ start-stop-daemon --start --exec $NRPE_BIN --pidfile $NRPE_PID \
+ --background -- -c $NRPE_CFG -f $NRPE_OPTS
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping nrpe"
+ start-stop-daemon --stop --exec $NRPE_BIN --pidfile $NRPE_PID
+ eend $?
+}
+
+reload() {
+ ebegin "Reloading nrpe"
+ start-stop-daemon --stop --oknodo --exec $NRPE_BIN \
+ --pidfile $NRPE_PID --signal HUP
+ eend $?
+}
diff --git a/startup/mac-inetd.plist.in b/startup/mac-inetd.plist.in
new file mode 100644
index 0000000..45197ea
--- /dev/null
+++ b/startup/mac-inetd.plist.in
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple/DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>Label</key>
+ <string>org.nagios.nrpe</string>
+ <key>UserName</key>
+ <string>@nrpe_user@</string>
+ <key>GroupName</key>
+ <string>@nrpe_group@</string>
+ <key>Program</key>
+ <string>@sbindir@/nrpe</string>
+ <key>ProgramArguments</key>
+ <array>
+ <string>nrpe</string>
+ <string>-c</string>
+ <string>@pkgsysconfdir@/nrpe.cfg</string>
+ <string>-i</string>
+ </array>
+ <key>Sockets</key>
+ <dict>
+ <key>Listeners</key>
+ <dict>
+ <key>SockServiceName</key>
+ <string>5666</string>
+ <key>SockType</key>
+ <string>stream</string>
+ <key>SockFamily</key>
+ <string>IPv4</string>
+ </dict>
+ </dict>
+ <key>inetdCompatibility</key>
+ <dict>
+ <key>Wait</key>
+ <false/>
+ </dict>
+ <key>ProcessType</key>
+ <string>Background</string>
+</dict>
+</plist>
diff --git a/startup/mac-init.plist.in b/startup/mac-init.plist.in
new file mode 100644
index 0000000..f51c498
--- /dev/null
+++ b/startup/mac-init.plist.in
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple/DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>Label</key>
+ <string>org.nagios.nrpe</string>
+ <key>UserName</key>
+ <string>@nrpe_user@</string>
+ <key>GroupName</key>
+ <string>@nrpe_group@</string>
+ <key>Program</key>
+ <string>@sbindir@/nrpe</string>
+ <key>ProgramArguments</key>
+ <array>
+ <string>nrpe</string>
+ <string>-c</string>
+ <string>@pkgsysconfdir@/nrpe.cfg</string>
+ <string>-f</string>
+ </array>
+ <key>KeepAlive</key>
+ <dict>
+ <key>SuccessfulExit</key>
+ <false/>
+ <key>NetworkState</key>
+ <true/>
+ </dict>
+ <key>RunAtLoad</key>
+ <true/>
+ <key>ProcessType</key>
+ <string>Background</string>
+</dict>
+</plist>
diff --git a/startup/newbsd-init.in b/startup/newbsd-init.in
new file mode 100644
index 0000000..aa4ed45
--- /dev/null
+++ b/startup/newbsd-init.in
@@ -0,0 +1,35 @@
+#!/bin/sh
+#
+# Copyright (c) 2016 Nagios(R) Core(TM) Development Team
+#
+# PROVIDE: nrpe
+# REQUIRE: DAEMON
+# KEYWORD: shutdown
+
+. /etc/rc.subr
+
+: ${nrpe@bsd_enable@:="NO"}
+: ${nrpe_configfile:="@pkgsysconfdir@/nrpe.cfg"}
+
+name=nrpe
+command="@sbindir@/nrpe"
+command_args="-c $nrpe_configfile -d"
+pidfile="@piddir@/nrpe.pid"
+extra_commands=reload
+sig_reload=HUP
+rcvar=nrpe@bsd_enable@
+load_rc_config "$name"
+required_files="$nrpe_configfile"
+sig_reload=HUP
+
+start_precmd=nrpe_prestart
+
+nrpe_prestart()
+{
+ [ -n "$nrpe_pidfile" ] &&
+ warn "No longer necessary to set nrpe_pidfile in rc.conf[.local]"
+
+ install -d -o @nrpe_user@ ${pidfile%/*}
+}
+
+run_rc_command "$1"
diff --git a/startup/openbsd-init.in b/startup/openbsd-init.in
new file mode 100644
index 0000000..1713646
--- /dev/null
+++ b/startup/openbsd-init.in
@@ -0,0 +1,18 @@
+#!/bin/sh
+#
+# Copyright (c) 2016 Nagios(R) Core(TM) Development Team
+#
+
+daemon="@sbindir@/nrpe"
+
+. /etc/rc.d/rc.subr
+
+rc_pre() {
+ install -d -o @nrpe_user@ ${pidfile%/*}
+}
+
+rc_reload() {
+ pkill -HUP -xf "${pexp}"
+}
+
+rc_cmd "$1"
diff --git a/startup/openrc-conf.in b/startup/openrc-conf.in
new file mode 100644
index 0000000..1e6bd84
--- /dev/null
+++ b/startup/openrc-conf.in
@@ -0,0 +1,7 @@
+# /etc/conf.d/nrpe : config file for /etc/init.d/nrpe
+
+# The configuration file to use.
+NRPE_CFG="@sysconfdir@/nrpe.cfg"
+
+# Any additional options (e.g. -n -4 -6) to pass to the nrpe daemon.
+NRPE_OPTS=""
diff --git a/startup/openrc-init.in b/startup/openrc-init.in
new file mode 100644
index 0000000..baac193
--- /dev/null
+++ b/startup/openrc-init.in
@@ -0,0 +1,17 @@
+#!/sbin/openrc-run
+#
+# Copyright (c) 2017 Nagios(R) Core(TM) Development Team
+#
+
+command="@sbindir@/nrpe"
+command_args="--config=${NRPE_CFG} ${NRPE_OPTS}"
+command_args_background="--daemon"
+description="Nagios Remote Plugin Executor (NRPE) daemon"
+extra_started_commands="reload"
+pidfile="@piddir@/nrpe.pid"
+
+reload() {
+ ebegin "Reloading ${SVCNAME}"
+ start-stop-daemon --signal HUP --pidfile "${pidfile}"
+ eend $?
+}
diff --git a/startup/rh-upstart-init.in b/startup/rh-upstart-init.in
new file mode 100644
index 0000000..58bf3b5
--- /dev/null
+++ b/startup/rh-upstart-init.in
@@ -0,0 +1,17 @@
+# nrpe - the Nagios Remote Plugin Executor
+#
+# nrpe is a program that runs plugins on this host
+# and reports the results back to a nagios server
+#
+# Copyright (c) 2016 Nagios(R) Core(TM) Development Team
+
+description "the Nagios Remote Plugin Executor"
+
+oom -10
+
+start on started network
+stop on runlevel [!2345]
+
+respawn
+
+exec @sbindir@/nrpe -c @pkgsysconfdir@/nrpe.cfg -f
diff --git a/startup/solaris-inetd.xml.in b/startup/solaris-inetd.xml.in
new file mode 100644
index 0000000..85a0a5b
--- /dev/null
+++ b/startup/solaris-inetd.xml.in
@@ -0,0 +1,90 @@
+<?xml version="1.0"?>
+<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
+
+<!--
+ Copyright (c) 2016 Nagios(R) Core(TM) Development Team
+-->
+
+<service_bundle type='manifest' name='NGOS:nrpe'>
+
+ <service
+ name='network/nagios/nrpe'
+ type='service'
+ version='1'>
+
+ <restarter>
+ <service_fmri value='svc:/network/inetd:default' />
+ </restarter>
+
+ <dependency name='config_data'
+ grouping='require_all'
+ restart_on='restart'
+ type='path'>
+ <service_fmri
+ value='file://localhost@sysconfdir@/nrpe.cfg' />
+ </dependency>
+
+ <exec_method
+ type='method'
+ name='inetd_start'
+ exec='@sbindir@/nrpe -c @pkgsysconfdir@/nrpe.cfg -i'
+ timeout_seconds='0'>
+ <method_context>
+ <method_credential user='@nrpe_user@' group='@nrpe_group@'/>
+ </method_context>
+ </exec_method>
+
+ <exec_method
+ type='method'
+ name='inetd_offline'
+ exec=':kill_process'
+ timeout_seconds='0'/>
+
+ <exec_method
+ type='method'
+ name='inetd_disable'
+ exec=':kill'
+ timeout_seconds='0'/>
+
+ <property_group name='inetd' type='framework'>
+ <stability value='Evolving' />
+ <propval name='name' type='astring' value='nrpe' />
+ <propval name='endpoint_type' type='astring' value='stream' />
+ <propval name='proto' type='astring' value='tcp' />
+ <propval name='wait' type='boolean' value='false' />
+ <propval name='isrpc' type='boolean' value='false' />
+ </property_group>
+
+ <property_group name='general' type='framework'>
+ <propval name='enabled'
+ type='boolean'
+ value='false'/>
+ <propval name='action_authorization'
+ type='astring'
+ value='solaris.smf.manage.nrpe'/>
+ <propval name='value_authorization'
+ type='astring'
+ value='solaris.smf.manage.nrpe'/>
+ </property_group>
+
+ <instance name='default' enabled='false' />
+
+ <stability value='Unstable' />
+
+ <template>
+ <common_name>
+ <loctext xml:lang="C">NRPE daemon</loctext>
+ </common_name>
+ <description>
+ <loctext xml:lang="C">
+ Nagios Remote Plugin Executor daemon
+ </loctext>
+ </description>
+ <documentation>
+ <doc_link name='nagios.org' uri='http://www.nagios.org' />
+ </documentation>
+ </template>
+
+ </service>
+
+</service_bundle>
diff --git a/startup/solaris-init.xml.in b/startup/solaris-init.xml.in
new file mode 100644
index 0000000..e4ff84c
--- /dev/null
+++ b/startup/solaris-init.xml.in
@@ -0,0 +1,143 @@
+<?xml version="1.0"?>
+<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
+
+<!--
+ Copyright (c) 2016 Nagios(R) Core(TM) Development Team
+-->
+
+<service_bundle type='manifest' name='NGOS:nrpe'>
+
+ <service
+ name='network/nagios/nrpe'
+ type='service'
+ version='1'>
+
+ <single_instance />
+
+ <dependency
+ name='fs-local'
+ grouping='require_all'
+ restart_on='none'
+ type='service'>
+ <service_fmri value='svc:/system/filesystem/local' />
+ </dependency>
+
+ <dependency
+ name='autofs'
+ grouping='optional_all'
+ restart_on='none'
+ type='service'>
+ <service_fmri value='svc:/system/filesystem/autofs' />
+ </dependency>
+
+ <dependency
+ name='net-loopback'
+ grouping='require_all'
+ restart_on='none'
+ type='service'>
+ <service_fmri value='svc:/network/loopback' />
+ </dependency>
+
+ <dependency
+ name='net-physical'
+ grouping='require_all'
+ restart_on='none'
+ type='service'>
+ <service_fmri value='svc:/network/physical' />
+ </dependency>
+
+ <dependency
+ name='cryptosvc'
+ grouping='require_all'
+ restart_on='none'
+ type='service'>
+ <service_fmri value='svc:/system/cryptosvc' />
+ </dependency>
+
+ <dependency
+ name='utmp'
+ grouping='require_all'
+ restart_on='none'
+ type='service'>
+ <service_fmri value='svc:/system/utmp' />
+ </dependency>
+
+ <dependency
+ name='config_data'
+ grouping='require_all'
+ restart_on='restart'
+ type='path'>
+ <service_fmri
+ value='file://localhost@sysconfdir@/nrpe.cfg' />
+ </dependency>
+
+ <dependency
+ name='system-log'
+ grouping='optional_all'
+ restart_on='none'
+ type='service'>
+ <service_fmri value='svc:/system/system-log' />
+ </dependency>
+
+ <dependent
+ name='nrpe_multi-user-server'
+ grouping='optional_all'
+ restart_on='none'>
+ <service_fmri value='svc:/milestone/multi-user-server'/>
+ </dependent>
+
+ <exec_method
+ type='method'
+ name='start'
+ exec='@sbindir@/nrpe -c @pkgsysconfdir@/nrpe.cfg -d'
+ timeout_seconds='5'>
+ <method_context>
+ <method_credential user='@nrpe_user@' group='@nrpe_group@'/>
+ </method_context>
+ </exec_method>
+
+ <exec_method
+ type='method'
+ name='stop'
+ exec=':kill'
+ timeout_seconds='60'/>
+
+ <exec_method
+ type='method'
+ name='refresh'
+ exec=':hup'
+ timeout_seconds='60'/>
+
+ <property_group name='startd' type='framework'>
+ <propval name='ignore_error' type='astring' value='core,signal'/>
+ </property_group>
+
+ <property_group name='general' type='framework'>
+ <propval name='enabled' type='boolean' value='false'/>
+ <propval name='action_authorization' type='astring'
+ value='solaris.smf.manage.nrpe'/>
+ <propval name='value_authorization' type='astring'
+ value='solaris.smf.manage.nrpe'/>
+ </property_group>
+
+ <instance name='default' enabled='false' />
+
+ <stability value='Unstable' />
+
+ <template>
+ <common_name>
+ <loctext xml:lang="C">NRPE daemon</loctext>
+ </common_name>
+ <description>
+ <loctext xml:lang="C">
+ Nagios Remote Plugin Executor daemon
+ </loctext>
+ </description>
+ <documentation>
+ <doc_link name='nagios.org' uri='http://www.nagios.org' />
+ </documentation>
+ </template>
+
+ </service>
+
+</service_bundle>
diff --git a/startup/tmpfile.conf.in b/startup/tmpfile.conf.in
new file mode 100644
index 0000000..9db7ca6
--- /dev/null
+++ b/startup/tmpfile.conf.in
@@ -0,0 +1,2 @@
+#Type Path Mode UID GID Age Argument
+d @piddir@ 0755 @nrpe_user@ @nrpe_group@ - -
diff --git a/startup/upstart-init.in b/startup/upstart-init.in
new file mode 100644
index 0000000..ec16d7d
--- /dev/null
+++ b/startup/upstart-init.in
@@ -0,0 +1,19 @@
+# nrpe - the Nagios Remote Plugin Executor
+#
+# nrpe is a program that runs plugins on this host
+# and reports the results back to a nagios server
+#
+# Copyright (c) 2016 Nagios(R) Core(TM) Development Team
+
+description "the Nagios Remote Plugin Executor"
+
+oom score -800
+setgid @nrpe_group@
+setuid @nrpe_user@
+
+start on (local-filesystems and net-device-up IFACE!=lo)
+stop on runlevel [!2345]
+
+respawn
+
+exec @sbindir@/nrpe -c @pkgsysconfdir@/nrpe.cfg -f
diff --git a/test-wrapper b/test-wrapper
new file mode 100755
index 0000000..7c5ba46
--- /dev/null
+++ b/test-wrapper
@@ -0,0 +1,3 @@
+#!/bin/bash
+# Replace this once test is working properly.
+./travis-test-1
diff --git a/travis-test-1 b/travis-test-1
new file mode 100755
index 0000000..fca5d95
--- /dev/null
+++ b/travis-test-1
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+# Integration test for nrpe/check_nrpe
+# Should be run only on machines which do NOT have Nagios installed
+# and which do not have an enabled firewall.
+cd sample-config
+echo >> nrpe.cfg # Hopefully this is a newline! I think nrpe.cfg ends in a newling anyways.
+echo 'command[check_test]=/tmp/check_yes.sh' >> nrpe.cfg
+
+# Make sure the directory exists such that nrpe can create the nrpe.pid file in the default location
+mkdir /usr/ || true
+mkdir /usr/local || true
+mkdir /usr/local/nagios || true
+mkdir /usr/local/nagios/var || true
+
+# Make sure nagios user exists
+useradd nagios
+
+# Make a plugin
+touch /tmp/check_yes.sh
+echo 'echo OK' >> /tmp/check_yes.sh
+
+# Give nagios control of plugins
+chown nagios /tmp/check_yes.sh
+chmod +x /tmp/check_yes.sh
+
+# Start running the NRPE daemon to accept commands
+cd ../src
+./nrpe -c ../sample-config/nrpe.cfg -d
+
+# Try to check_nrpe with our check_test command/check_yes.sh plugin
+./check_nrpe -H 127.0.0.1 -c check_test
+
+exit 0
diff --git a/uninstall.in b/uninstall.in
new file mode 100755
index 0000000..0087c11
--- /dev/null
+++ b/uninstall.in
@@ -0,0 +1,417 @@
+#!/bin/sh
+
+# Initialize variables
+myname="$0"
+quiet=0
+prompt=0
+verb=0
+progs=0
+config=0
+start=0
+delusr=0
+delgrp=0
+delscpt=0
+force="-f"
+redir=1
+
+# Set file and path names
+NAME=@PKG_NAME@
+OPSYS=@opsys@
+DIST=@dist_type@
+SBINDIR=@sbindir@
+LIBEXECDIR=@libexecdir@
+PLUGINSDIR=@pluginsdir@
+PIDDIR=@piddir@
+CFGDIR=@pkgsysconfdir@
+INIT_TYPE=@init_type@
+INIT_DIR=@initdir@
+INIT_FILE=@initname@
+INETD_TYPE=@inetd_type@
+INETD_DIR=@inetddir@
+INETD_FILE=@inetdname@
+SRC_INETD=@src_inetd@
+SRC_INIT=@src_init@
+NRPE_USER=@nrpe_user@
+NRPE_GROUP=@nrpe_group@
+NAGIOS_USER=@nagios_user@
+NAGIOS_GROUP=@nagios_group@
+
+
+# Display usage message
+usage() {
+ echo "Usage: $0 [-q] [-p] [-v] progs|config|startup|user|group|script|all"
+ echo " Optional args:"
+ echo " -q Do not print what is happening"
+ echo " -p Prompt for each action"
+ echo " -v Be a little more verbose about what is happening"
+ echo " One or more of the following are required:"
+ echo " progs Delete the program files"
+ echo " config Delete configuration file(s)"
+ echo " startup Delete startup files (inetd, init, etc.)"
+ echo " user Delete the users"
+ echo " group Delete the groups"
+ echo " script Delete this uninstall script"
+ echo " all Do all of the above"
+ exit 1
+}
+
+get_opts() {
+ while test $# -gt 0 ; do
+ arg=$1
+ shift
+ case "$arg" in
+ -q) quiet=1 ;;
+ -p) prompt=1 ;;
+ progs) progs=1 ;;
+ config) config=1 ;;
+ startup) start=1 ;;
+ user) delusr=1; ;;
+ group) delgrp=1; ;;
+ script) delscpt=1; ;;
+ -v) verb=1; force=""; redir=0 ;;
+ all) progs=1; config=1; start=1; delusr=1; delgrp=1; delscpt=1 ;;
+ *) echo "Invalid argument: $arg"; usage ;;
+ esac
+ done
+
+ if test $prompt -eq 1 -a $quiet -eq 1 ; then
+ echo "The -p and -q flags are mutually exclusive"
+ echo Please specify one or the other
+ exit 1
+ fi
+ if test $verb -eq 1 -a $quiet -eq 1 ; then
+ echo "The -v and -q flags are mutually exclusive"
+ echo Please specify one or the other
+ exit 1
+ fi
+ if test $progs -eq 0 -a $config -eq 0 -a $start -eq 0 ; then
+ usage
+ fi
+}
+
+prt_msg() {
+ if test $quiet -eq 1 ; then
+ return 0
+ fi
+
+ case $1 in
+ 0) indent="" ;;
+ 1) indent=" " ;;
+ 2) indent=" " ;;
+ *) indent="" ;;
+ esac
+ shift
+
+ if test $1 -eq 1 -a $verb -eq 0 -a $prompt -eq 0 ; then
+ return 0
+ fi
+ shift
+
+ if test $1 -eq 1 -a $prompt -eq 1 ; then
+ shift
+ echo -n "${indent}$*"
+ echo -n "? [Y|n] "
+ read yn
+ if test "x$yn" = x -o x$yn = xy -o x$yn = xY ; then
+ return 0
+ else
+ return 1
+ fi
+ fi
+
+ shift
+ echo "${indent}$*"
+ return 0
+}
+
+rm_progs() {
+ num=0
+ prt_msg 1 0 0 "*** Uninstalling Progs"
+
+ if test -f "$PLUGINSDIR/check_nrpe" ; then
+ num=1
+ prt_msg 2 0 1 "Delete $PLUGINSDIR/check_nrpe" && {
+ rm $force "$PLUGINSDIR/check_nrpe"
+ prt_msg 2 1 0 "Remove directory $PLUGINSDIR"
+ if test $redir -eq 1; then
+ rmdir "$PLUGINSDIR" 2>/dev/null
+ else
+ rmdir "$PLUGINSDIR"
+ fi
+ prt_msg 2 1 0 "Remove directory $LIBEXECDIR"
+ if test $redir -eq 1; then
+ rmdir "$LIBEXECDIR" 2>/dev/null
+ else
+ rmdir "$LIBEXECDIR"
+ fi
+ }
+ fi
+
+ if test -f "$SBINDIR/$NAME" ; then
+ num=1
+ prt_msg 2 0 1 "Delete $SBINDIR/$NAME" && {
+ rm $force "$SBINDIR/$NAME"
+ }
+ fi
+
+ if test -d "$PIDDIR" ; then
+ num=1
+ prt_msg 2 0 1 "Remove directory $PIDDIR" && {
+ if test $redir -eq 1; then
+ rmdir "$PIDDIR" 2>/dev/null
+ else
+ rmdir "$PIDDIR"
+ fi
+ }
+ fi
+
+ if test $num -eq 0; then
+ prt_msg 2 0 0 "There was nothing to uninstall"
+ fi
+}
+
+rm_startup() {
+ num=0
+ prt_msg 1 0 0 "*** Uninstalling Startup"
+
+ if test "$SRC_INETD" != unknown; then
+ if test "$INETD_TYPE" = inetd; then
+ rc=`grep -E -q "^\W*$NAME\s+" "$INETD_DIR/$INETD_FILE"`
+ if test $rc -eq 0; then
+ num=1
+ prt_msg 2 0 1 "($INETD_TYPE) Remove entries from $INETD_DIR/$INETD_FILE" && {
+ prt_msg 2 1 0 "($INETD_TYPE) Creating temp file: $INETD_DIR/$INETD_FILE.$NAME.unin"
+ grep -v -q "\W*$NAME\s+" "$INETD_DIR/$INETD_FILE" > "$INETD_DIR/$INETD_FILE.$NAME.unin"
+ prt_msg 2 1 0 "($INETD_TYPE) Renaming original to: $INETD_DIR/$INETD_FILE.$NAME_save"
+ mv "$INETD_DIR/$INETD_FILE" "$INETD_DIR/$INETD_FILE.$NAME_save"
+ prt_msg 2 1 0 "($INETD_TYPE) Renaming $INETD_DIR/$INETD_FILE.unin to $INETD_DIR/$INETD_FILE"
+ mv "$INETD_DIR/$INETD_FILE.unin" "$INETD_DIR/$INETD_FILE"
+ prt_msg 2 0 0 "($INETD_TYPE) Old $INETD_DIR/$INETD_FILE saved as $INETD_DIR/$INETD_FILE.$NAME_save"
+ }
+ fi
+ elif test -f "$INETD_DIR/$INETD_FILE"; then
+ num=1
+ if test "$INETD_TYPE" != xinetd; then
+ prt_msg 2 0 1 "($INETD_TYPE) Stop and disable $NAME)" && {
+ case "$INETD_TYPE" in
+ systemd)
+ systemctl stop $NAME; systemctl disable $NAME
+ ;;
+ upstart)
+ if test $verb -eq 1; then
+ stop $NAME
+ else
+ stop $NAME >/dev/null 2>&1
+ fi
+ ;;
+ launchd)
+ launchctl unload $INETD_FILE; launchctl remove $INETD_FILE;
+ ;;
+ smf*)
+ svcadm disable -s $NAME
+ ;;
+ esac
+ }
+ fi
+ prt_msg 2 0 1 "($INETD_TYPE) Delete $INETD_DIR/$INETD_FILE" && {
+ rm $force "$INETD_DIR/$INETD_FILE"
+ if test "$INETD_TYPE" = systemd; then
+ INETD_FILE=`echo "$INETD_FILE" | sed -e 's/socket$/service/'`
+ prt_msg 2 0 1 "($INETD_TYPE) Delete $INETD_DIR/$INETD_FILE" && {
+ rm $force "$INETD_DIR/$INETD_FILE"
+ }
+ elif test "$INETD_TYPE" = smf10 -o "$INETD_TYPE" = smf11; then
+ prt_msg 2 0 1 "($INIT_TYPE) svcadm restart svc:/system/manifest-import" && {
+ svcadm restart svc:/system/manifest-import
+ }
+ fi
+ }
+ fi
+ fi
+
+ if test "$SRC_INIT" != unknown; then
+ if test -f "$INIT_DIR/$INIT_FILE"; then
+ num=1
+ prt_msg 2 0 1 "($INIT_TYPE) Stop and disable $NAME" && {
+ case "$INIT_TYPE" in
+ systemd)
+ systemctl stop $NAME; systemctl disable $NAME
+ ;;
+ upstart)
+ if test $verb -eq 1; then
+ stop $NAME
+ else
+ stop $NAME >/dev/null 2>&1
+ fi
+ ;;
+ launchd)
+ launchctl unload $INIT_FILE; launchctl remove $INIT_FILE;
+ ;;
+ *bsd)
+ if test -x $INIT_DIR/$INIT_FILE ; then
+ $INIT_DIR/$INIT_FILE stop
+ fi
+ chmod 0644 $INIT_DIR/$INIT_FILE
+ ;;
+ openrc|gentoo)
+ /sbin/start-stop-daemon --stop $NAME
+ /sbin/rc-update del $NAME
+ ;;
+ smf*)
+ svcadm disable -s $NAME
+ ;;
+ sysv)
+ service stop $NAME; chkconfig --del $NAME
+ ;;
+ esac
+ }
+ prt_msg 2 0 1 "($INIT_TYPE) Delete $INIT_DIR/$INIT_FILE" && {
+ rm $force "$INIT_DIR/$INIT_FILE"
+ if test ${OPSYS} = bsd; then
+ prt_msg 2 0 1 "($INITD_TYPE) Remove entries from $INETD_DIR/rc.conf" && {
+ prt_msg 2 1 0 "($INIT_TYPE) Creating temp file: $INETD_DIR/rc.conf.$NAME.unin"
+ grep -v -q "^$NAME" "$INETD_DIR/rc.conf" > "$INETD_DIR/rc.conf.$NAME.unin"
+ prt_msg 2 1 0 "($INIT_TYPE) Renaming original to: $INETD_DIR/rc.conf.$NAME_save"
+ mv "$INETD_DIR/rc.conf" "$INETD_DIR/rc.conf.$NAME_save"
+ prt_msg 2 1 0 "($INIT_TYPE) Renaming $INETD_DIR/rc.conf.unin to $INETD_DIR/rc.conf"
+ mv "$INETD_DIR/rc.conf.unin" "$INETD_DIR/rc.conf"
+ prt_msg 2 0 0 "($INIT_TYPE) Old $INETD_DIR/rc.conf saved as $INETD_DIR/rc.conf.$NAME_save"
+ }
+ fi
+ if test $INIT_TYPE = upstart; then
+ prt_msg 2 0 1 "($INIT_TYPE) initctl reload-configuration" && {
+ initctl reload-configuration
+ }
+ elif test "$INIT_TYPE" = smf10 -o "$INIT_TYPE" = smf11; then
+ prt_msg 2 0 1 "($INIT_TYPE) svcadm restart svc:/system/manifest-import" && {
+ svcadm restart svc:/system/manifest-import
+ }
+ fi
+ }
+ fi
+ fi
+
+ if test $num -eq 0; then
+ prt_msg 2 0 0 "There was nothing to uninstall"
+ fi
+}
+
+rm_config() {
+ num=0
+ prt_msg 1 0 0 "*** Uninstalling Config"
+
+ if test -f "$CFGDIR/$NAME.cfg"; then
+ num=1
+ prt_msg 2 0 1 "Delete $CFGDIR/$NAME.cfg" || return
+ rm $force "$CFGDIR/$NAME.cfg"
+ prt_msg 2 1 0 "Removing directory $CFGDIR"
+ if test $redir -eq 1; then
+ rmdir "$CFGDIR" 2>/dev/null
+ else
+ rmdir "$CFGDIR"
+ fi
+ fi
+
+ if test $num -eq 0; then
+ prt_msg 2 0 0 "There was nothing to uninstall"
+ fi
+}
+
+rm_user() {
+ prt_msg 1 0 0 "*** Removing users"
+ prt_msg 2 0 1 "Delete nrpe user:${NRPE_USER} and nagios user:${NAGIOS_USER}" || return
+
+ if test ${OPSYS} = aix; then
+ if test $redir -eq 1; then
+ rmuser -p ${NRPE_USER} 2>/dev/null
+ rmuser -p ${NAGIOS_USER} 2>/dev/null
+ else
+ rmuser -p ${NRPE_USER}
+ rmuser -p ${NAGIOS_USER}
+ fi
+ elif test ${OPSYS} = osx; then
+ dscl . -delete /Groups/${NRPE_GROUP} GroupMembership ${NRPE_USER}
+ dscl . -delete /Users name ${NRPE_USER}
+ dscl . -delete /Groups/${NAGIOS_GROUP} GroupMembership ${NAGIOS_USER}
+ dscl . -delete /Users name ${NAGIOS_USER}
+ elif test ${DIST} = "freebsd"; then
+ if test $redir -eq 1; then
+ pw del user ${NRPE_USER} 2>/dev/null
+ pw del user ${NAGIOS_USER} 2>/dev/null
+ else
+ pw del user ${NRPE_USER}
+ pw del user ${NAGIOS_USER}
+ fi
+ else
+ if test $redir -eq 1; then
+ userdel -r ${NRPE_USER} 2>/dev/null
+ userdel -r ${NAGIOS_USER} 2>/dev/null
+ else
+ userdel -r ${NRPE_USER}
+ userdel -r ${NAGIOS_USER}
+ fi
+ fi
+}
+
+rm_group() {
+ prt_msg 1 0 0 "*** Removing groups"
+ prt_msg 2 0 1 "Delete nrpe group:${NRPE_GROUP} and nagios group:${NAGIOS_GROUP}" || return
+
+ if test ${OPSYS} = aix; then
+ if test $redir -eq 1; then
+ rmgroup -p ${NRPE_GROUP} 2>/dev/null
+ rmgroup -p ${NAGIOS_GROUP} 2>/dev/null
+ else
+ rmgroup -p ${NRPE_GROUP}
+ rmgroup -p ${NAGIOS_GROUP}
+ fi
+ elif test ${OPSYS} = osx; then
+ if test $redir -eq 1; then
+ dscl . -delete /Groups/${NRPE_GROUP} 2>/dev/null
+ dscl . -delete /Groups/${NAGIOS_GROUP} 2>/dev/null
+ else
+ dscl . -delete /Groups/${NRPE_GROUP}
+ dscl . -delete /Groups/${NAGIOS_GROUP}
+ fi
+ elif test ${DIST} = "freebsd"; then
+ if test $redir -eq 1; then
+ pw del group ${NRPE_GROUP} 2>/dev/null
+ pw del group ${NAGIOS_GROUP} 2>/dev/null
+ else
+ pw del group ${NRPE_GROUP}
+ pw del group ${NAGIOS_GROUP}
+ fi
+ else
+ if test $redir -eq 1; then
+ groupdel ${NRPE_GROUP} 2>/dev/null
+ groupdel ${NAGIOS_GROUP} 2>/dev/null
+ else
+ groupdel ${NRPE_GROUP}
+ groupdel ${NAGIOS_GROUP}
+ fi
+ fi
+}
+
+rm_script() {
+ prt_msg 1 0 0 "*** Removing ${myname}"
+ prt_msg 2 0 1 "Delete ${myname}" || return
+
+ if test $redir -eq 1; then
+ rm "${myname}" 2>/dev/null
+ else
+ rm "${myname}"
+ fi
+}
+
+get_opts $@
+
+prt_msg 0 0 0 "* * * Uninstall Starting * * *"
+
+if test $progs -eq 1 ; then rm_progs; fi
+if test $start -eq 1 ; then rm_startup; fi
+if test $config -eq 1 ; then rm_config; fi
+if test $delusr -eq 1; then rm_user; fi
+if test $delgrp -eq 1; then rm_group; fi
+if test $delscpt -eq 1; then rm_script; fi
+
+prt_msg 0 0 0 "* * * Uninstall Complete * * *"
diff --git a/update-cfg.pl b/update-cfg.pl
new file mode 100755
index 0000000..dadc0e8
--- /dev/null
+++ b/update-cfg.pl
@@ -0,0 +1,144 @@
+#! /usr/bin/perl -w
+
+use strict;
+
+my ($fname_in, $fname_out);
+
+if ($#ARGV != 0) {
+ &usage;
+}
+
+$fname_in = $ARGV[0];
+$fname_out = $fname_in . ".new";
+
+if (&check_ssl) {
+ print "\n'$fname_in' already has some or all of the\n";
+ print "new SSL parameters. No processing will be done.\n\n";
+ exit 0;
+}
+
+open IN, $fname_in or die "Could not open '$fname_in' for reading: $!\n";
+open OUT, ">$fname_out" or die "Could not open '$fname_out' for writing: $!\n";
+
+while (<IN>) {
+ print OUT;
+ &add_ssl if $_ =~ /allow_weak_random_seed/;
+}
+
+print "\nConfig file '$fname_in' was read.\n";
+print "The new SSL comments and parameters were added and the output written to\n";
+print "'$fname_out'\n";
+print "Please check this file for accuracy and rename it when you are satisfied.\n\n";
+
+close IN;
+close OUT;
+
+# ==========================================================================
+
+sub usage
+{
+ print "\nUsage: update-cfg.pl <path-to-nrpe.cfg-file>\n\n";
+ print "This perl script will read the nrpe configuration file\n";
+ print "specified on the command line, and write out a new file\n";
+ print "with the new SSL comments and parameters added.\n\n";
+ exit 1;
+}
+
+# --------------------------------------------------------------------------
+# check_ssl checks if the config file already has the ssl parameters
+# --------------------------------------------------------------------------
+sub check_ssl
+{
+ my $has_ssl = 0;
+
+ open IN, $fname_in or die "Could not open '$fname_in' for reading: $!\n";
+
+ while (<IN>) {
+ if ($_ =~ /ssl_version=/ or
+ $_ =~ /ssl_use_adh=/ or
+ $_ =~ /ssl_cipher_list=/ or
+ $_ =~ /ssl_cacert_file=/ or
+ $_ =~ /ssl_cert_file=/ or
+ $_ =~ /ssl_privatekey_file=/ or
+ $_ =~ /ssl_client_certs=/ or
+ $_ =~ /ssl_logging=/)
+ {
+ $has_ssl = 1;
+ last;
+ }
+ }
+
+ close IN;
+
+ return $has_ssl;
+}
+
+# --------------------------------------------------------------------------
+# add_ssl inserts the new SSL comments and parameters into the config file
+# --------------------------------------------------------------------------
+sub add_ssl
+{
+my $txt = <<"END_SSL";
+
+
+
+# SSL/TLS OPTIONS
+# These directives allow you to specify how to use SSL/TLS.
+
+# SSL VERSION
+# This can be any of: SSLv2 (only use SSLv2), SSLv2+ (use any version),
+# SSLv3 (only use SSLv3), SSLv3+ (use SSLv3 or above), TLSv1 (only use
+# TLSv1), TLSv1+ (use TLSv1 or above), TLSv1.1 (only use TLSv1.1),
+# TLSv1.1+ (use TLSv1.1 or above), TLSv1.2 (only use TLSv1.2),
+# TLSv1.2+ (use TLSv1.2 or above)
+# If an "or above" version is used, the best will be negotiated. So if both
+# ends are able to do TLSv1.2 and use specify SSLv2, you will get TLSv1.2.
+
+#ssl_version=SSLv2+
+
+# SSL USE ADH
+# This is for backward compatibility and is DEPRECATED. Set to 1 to enable
+# ADH or 2 to require ADH. 1 is currently the default but will be changed
+# in a later version.
+
+#ssl_use_adh=1
+
+# SSL CIPHER LIST
+# This lists which ciphers can be used. For backward compatibility, this
+# defaults to 'ssl_cipher_list=ALL:!MD5:\@STRENGTH' in this version but
+# will be changed to something like the example below in a later version of NRPE.
+
+#ssl_cipher_list=ALL:!MD5:\@STRENGTH
+#ssl_cipher_list=ALL:!aNULL:!eNULL:!SSLv2:!LOW:!EXP:!RC4:!MD5:\@STRENGTH
+
+# SSL Certificate and Private Key Files
+
+#ssl_cacert_file=/etc/ssl/servercerts/ca-cert.pem
+#ssl_cert_file=/etc/ssl/servercerts/nagios-cert.pem
+#ssl_privatekey_file=/etc/ssl/servercerts/nagios-key.pem
+
+# SSL USE CLIENT CERTS
+# This options determines client certificate usage.
+# Values: 0 = Don't ask for or require client certificates (default)
+# 1 = Ask for client certificates
+# 2 = Require client certificates
+
+#ssl_client_certs=0
+
+# SSL LOGGING
+# This option determines which SSL messages are send to syslog. OR values
+# together to specify multiple options.
+
+# Values: 0x00 (0) = No additional logging (default)
+# 0x01 (1) = Log startup SSL/TLS parameters
+# 0x02 (2) = Log remote IP address
+# 0x04 (4) = Log SSL/TLS version of connections
+# 0x08 (8) = Log which cipher is being used for the connection
+# 0x10 (26) = Log if client has a certificate
+# 0x20 (32) = Log details of client's certificate if it has one
+# -1 or 0xff or 0x2f = All of the above
+
+#ssl_logging=0x00
+END_SSL
+ print OUT $txt;
+}
diff --git a/update-version b/update-version
new file mode 100755
index 0000000..fe242c1
--- /dev/null
+++ b/update-version
@@ -0,0 +1,83 @@
+#!/bin/sh
+
+# Make sure autoconf is installed and is the correct version
+min_autoconf_major=2
+min_autoconf_minor=59
+autoconf_error="Autoconf version $min_autoconf_major.$min_autoconf_minor or later must be installed to run this script."
+autoconf_version=`(autoconf -V 2> /dev/null) |\
+ grep "^autoconf (GNU Autoconf)" | gawk '{print $NF}'`
+if [ "$autoconf_version" != "" ] ; then
+ autoconf_major=`echo $autoconf_version | gawk -F '.' '{print $1}'`
+ autoconf_minor=`echo $autoconf_version | gawk -F '.' '{print $2}'`
+ if [ $autoconf_major -lt $min_autoconf_major -o $autoconf_minor -lt $min_autoconf_minor ] ; then
+ echo $autoconf_error
+ exit 1
+ fi
+else
+ echo $autoconf_error
+ exit 1
+fi
+
+# Get date (two formats)
+if [ -n "$2" ]; then
+ LONGDATE=$(LC_ALL=C date -u -d "$2" "+%B %d, %Y")
+ SHORTDATE=$(date -u -d "$2" "+%Y-%m-%d")
+else
+ LONGDATE=$(LC_ALL=C date -u -d "@${SOURCE_DATE_EPOCH:-$(date +%s)}" "+%B %d, %Y")
+ SHORTDATE=$(date -u -d "@${SOURCE_DATE_EPOCH:-$(date +%s)}" "+%Y-%m-%d")
+fi
+
+# Current version number
+CURRENTVERSION=3.2.1
+
+# Last date
+LASTDATE=2017-09-01
+
+if [ "x$1" = "x" ]
+then
+ echo "Usage: $0 <version number | \"newdate\"> [revision date]"
+ echo ""
+ echo "Run this script with the name of the new version (i.e \"2.6\") to"
+ echo "update version number and modification date in files."
+ echo "Use the \"newdate\" argument if you want to keep the current version"
+ echo "number and just update the modification date."
+ echo "When using \"newdate\" you can specify the release date with"
+ echo "a second argument in the form of YYYY-MM-DD."
+ echo ""
+ echo "Current version=$CURRENTVERSION"
+ echo "Current Modification date=$LASTDATE"
+ echo ""
+ exit 1
+fi
+
+newversion=$1
+if [ "x$newversion" = "xnewdate" ]
+then
+ newversion=$CURRENTVERSION
+fi
+
+# Update version number and release date in common code
+perl -i -p -e "s/VERSION \".*\"/VERSION \"$1\"/;" include/common.h.in
+perl -i -p -e "s/MODIFICATION_DATE \".*\"/MODIFICATION_DATE \"$SHORTDATE\"/;" include/common.h.in
+perl -i -p -e "s/Last Modified: [0-9].*/Last Modified: $SHORTDATE/;" include/common.h.in
+
+# Update version number and release date in main code
+perl -i -p -e "s/Last Modified: [0-9].*/Last Modified: $SHORTDATE/;" src/nrpe.c
+perl -i -p -e "s/Last Modified: [0-9].*/Last Modified: $SHORTDATE/;" src/check_nrpe.c
+
+# Update version number and release date in configure.in
+perl -i -p -e "if( /^AC_INIT/) { s/$CURRENTVERSION/$1/; }" configure.ac
+perl -i -p -e "s/PKG_VERSION=.*/PKG_VERSION=\"$1\"/;" configure.ac
+perl -i -p -e "s/PKG_REL_DATE=.*\"/PKG_REL_DATE=\"$SHORTDATE\"/;" configure.ac
+
+# Run autoconf to update configure (this is easier than updating every instance
+# of the version number in configure)
+autoconf
+
+# Update RPM spec file with version number
+perl -i -p -e "s/%define version .*/%define version $1/;" nrpe.spec.in
+perl -i -p -e "if( /\%define _docdir/) { s/$CURRENTVERSION/$1/; }" nrpe.spec.in
+
+# Update this file with version number and last date
+perl -i -p -e "s/^CURRENTVERSION=.*/CURRENTVERSION=$newversion/;" update-version
+perl -i -p -e "s/^LASTDATE=.*/LASTDATE=$SHORTDATE/;" update-version