[Pkg-nagios-changes] [SCM] UNNAMED PROJECT branch, master, updated. debian/0.3-1-4-gf25c9e7
Alexander Wirt
formorer at debian.org
Sat Mar 16 16:51:59 UTC 2013
The following commit has been merged in the master branch:
commit 3f96ec705485f8167e9d7476079b22b2286bcaed
Author: Alexander Wirt <formorer at debian.org>
Date: Sat Mar 16 11:12:47 2013 +0100
Imported Upstream version 1.0
diff --git a/COPYING b/COPYING
index 6328a68..526ae79 100644
--- a/COPYING
+++ b/COPYING
@@ -36,13 +36,13 @@ be required to reproduce the following copyright notices, depending on which
source files are compiled. The above license statement applies to all of
them.
-If files in the `lib/ev' directory are used during compilation:
+If any files in the `lib/ev' directory are used during compilation:
| Copyright (c) 2007, 2008, 2009, 2010, 2011, 2012
| Marc Alexander Lehmann <libev at schmorp.de>
| Copyright (c) 2011 Emanuele Giaquinta
-If files in the `lib/pidfile' directory are used during compilation:
+If any files in the `lib/pidfile' directory are used during compilation:
| Copyright (c) 2005 Pawel Jakub Dawidek <pjd at FreeBSD.org>
| Copyright (c) 2007 Dag-Erling Coidan Smoergrav
diff --git a/NEWS b/NEWS
index 9f1f04e..363dad2 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,17 @@
NSCA-ng Release History
=======================
+Changes in Release 1.0 (2013-03-06)
+-----------------------------------
+
+ - Actually use the POSIX AIO API if it's provided by the target system.
+ The corresponding Autoconf test was broken since version 0.2.
+ - When opening the command file, check whether it's a named pipe. If it's
+ not, log a warning message and retry opening it later on.
+ - Use the PSK-AES256-CBC-SHA cipher suite (instead of PSK-RC4-SHA) by
+ default.
+ - Various minor fixes and improvements.
+
Changes in Release 0.3 (2013-02-25)
-----------------------------------
@@ -27,4 +38,4 @@ Changes in Release 0.1 (2013-02-08, Unpublished)
- Initial release.
-<!-- vim:set textwidth=76 joinspaces: -->
+<!-- vim:set filetype=markdown textwidth=76 joinspaces: -->
diff --git a/PROTOCOL b/PROTOCOL
index a047069..2afcb70 100644
--- a/PROTOCOL
+++ b/PROTOCOL
@@ -115,10 +115,13 @@ PUSH Request
The client issues a `PUSH` request in order to initiate a "monitoring
command" submission. The "monitoring command" is expected to be in the
format described in the Nagios documentation. The trailing newline
-character MUST be included.
+character MUST be included, and the submitted "monitoring command" MUST NOT
+be CRLF-terminated. Newline characters within the "monitoring command"
+(except for the trailing newline) MUST be replaced with the literal string
+`\n`, and backslash characters MUST be escaped with another backslash.
-The `<size>` parameter specifies the number of octets of the "monitoring
-command", including the trailing newline character.
+The `<size>` parameter specifies the size of the "monitoring command" in
+octets, including the trailing newline character.
On success, the server replies with an `OKAY` response. The client then
transmits the "monitoring command". On success, the server replies with
@@ -226,4 +229,4 @@ cleanly) by both sides.
[2]: http://tools.ietf.org/html/rfc2246 "RFC 2246"
[3]: http://tools.ietf.org/html/rfc4279 "RFC 4279"
-<!-- vim:set textwidth=76 joinspaces: -->
+<!-- vim:set filetype=markdown textwidth=76 joinspaces: -->
diff --git a/README b/README
index 784f84e..200d645 100644
--- a/README
+++ b/README
@@ -156,4 +156,4 @@ subscription required). For usage support, please subscribe to the
[5]: http://libev.schmorp.de/
[6]: http://www.nsca-ng.org/
-<!-- vim:set textwidth=76 joinspaces: -->
+<!-- vim:set filetype=markdown textwidth=76 joinspaces: -->
diff --git a/TODO b/TODO
index f20e66b..32a8408 100644
--- a/TODO
+++ b/TODO
@@ -19,8 +19,10 @@ The wish list items are listed in no particular order.
daemon mode with poor man's check scheduling (i.e., add `check_interval`
and `retry_interval` directives to the client configuration).
+- Let the client talk to multiple servers.
+
- Port the client to Microsoft Windows.
- Create a client library with Perl (and maybe Python) bindings.
-<!-- vim:set textwidth=76 joinspaces: -->
+<!-- vim:set filetype=markdown textwidth=76 joinspaces: -->
diff --git a/configure b/configure
index 590e950..7b1f3b5 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for NSCA-ng 0.3.
+# Generated by GNU Autoconf 2.69 for NSCA-ng 1.0.
#
# Report bugs to <developers at nsca-ng.org>.
#
@@ -580,8 +580,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='NSCA-ng'
PACKAGE_TARNAME='nsca-ng'
-PACKAGE_VERSION='0.3'
-PACKAGE_STRING='NSCA-ng 0.3'
+PACKAGE_VERSION='1.0'
+PACKAGE_STRING='NSCA-ng 1.0'
PACKAGE_BUGREPORT='developers at nsca-ng.org'
PACKAGE_URL='http://www.nsca-ng.org/'
@@ -1302,7 +1302,7 @@ 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 NSCA-ng 0.3 to adapt to many kinds of systems.
+\`configure' configures NSCA-ng 1.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1368,7 +1368,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of NSCA-ng 0.3:";;
+ short | recursive ) echo "Configuration of NSCA-ng 1.0:";;
esac
cat <<\_ACEOF
@@ -1470,7 +1470,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-NSCA-ng configure 0.3
+NSCA-ng configure 1.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2179,7 +2179,7 @@ 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 NSCA-ng $as_me 0.3, which was
+It was created by NSCA-ng $as_me 1.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2531,6 +2531,7 @@ 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
@@ -3048,7 +3049,7 @@ fi
# Define the identity of the package.
PACKAGE='nsca-ng'
- VERSION='0.3'
+ VERSION='1.0'
cat >>confdefs.h <<_ACEOF
@@ -3135,7 +3136,7 @@ fi
AM_BACKSLASH='\'
# Set the release date.
-RELEASE_DATE='February 25, 2013'
+RELEASE_DATE='March 06, 2013'
@@ -8248,36 +8249,38 @@ $as_echo_n "checking whether POSIX AIO works... " >&6; }
if ${nsca_cv_lib_aio_enabled+:} false; then :
$as_echo_n "(cached) " >&6
else
- if test "$cross_compiling" = yes; then :
+ save_LIBS=$LIBS
+ LIBS=$AIOLIBS
+ if test "$cross_compiling" = yes; then :
nsca_cv_lib_aio_enabled=no
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>
- #include <aio.h>
- #include <string.h>
- #include <unistd.h>
+ #include <sys/stat.h>
+ #include <fcntl.h>
+ #include <aio.h>
+ #include <string.h>
+ #include <unistd.h>
int
main ()
{
struct aiocb cb;
- const struct aiocb *cb_list[1];
- char msg[] = "Hello, world!\n";
- int fd;
- if ((fd = open("/dev/null", O_WRONLY)) == -1)
- return 1;
- (void)memset(&cb, 0, sizeof(cb));
- cb.aio_buf = msg;
- cb.aio_nbytes = sizeof(msg);
- cb.aio_fildes = fd;
- cb.aio_offset = 0;
- cb.aio_sigevent.sigev_notify = SIGEV_NONE;
- cb_list[0] = &cb;
- if (aio_write(&cb) == -1 || aio_suspend(cb_list, 1, NULL) == -1)
- return 1;
- (void)close(fd);
+ const struct aiocb *cb_list[1];
+ char msg[] = "Hello, world!\n";
+ int fd;
+ if ((fd = open("/dev/null", O_WRONLY)) == -1)
+ return 1;
+ (void)memset(&cb, 0, sizeof(cb));
+ cb.aio_buf = msg;
+ cb.aio_nbytes = sizeof(msg);
+ cb.aio_fildes = fd;
+ cb.aio_offset = 0;
+ cb.aio_sigevent.sigev_notify = SIGEV_NONE;
+ cb_list[0] = &cb;
+ if (aio_write(&cb) == -1 || aio_suspend(cb_list, 1, NULL) == -1)
+ return 1;
+ (void)close(fd);
;
return 0;
}
@@ -8291,6 +8294,7 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
+ LIBS=$save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $nsca_cv_lib_aio_enabled" >&5
$as_echo "$nsca_cv_lib_aio_enabled" >&6; }
@@ -10456,7 +10460,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by NSCA-ng $as_me 0.3, which was
+This file was extended by NSCA-ng $as_me 1.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -10523,7 +10527,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-NSCA-ng config.status 0.3
+NSCA-ng config.status 1.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index afc926e..235e435 100644
--- a/configure.ac
+++ b/configure.ac
@@ -27,11 +27,12 @@
# Autotools initialization.
AC_PREREQ([2.60]) dnl But Autoconf 2.63 is required for AC_INIT's URL parameter.
AC_INIT([NSCA-ng],
- [0.3],
+ [1.0],
[developers at nsca-ng.org],
[nsca-ng],
[http://www.nsca-ng.org/])
AC_CONFIG_SRCDIR([src/server/nsca-ng.c])
+AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_LIBOBJ_DIR([lib])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_TESTDIR([tests], [tests:src/client:src/server])
@@ -40,7 +41,7 @@ AM_INIT_AUTOMAKE([1.10 -Wall -Werror check-news])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES]) dnl Automake 1.11 added this.
# Set the release date.
-RELEASE_DATE='February 25, 2013'
+RELEASE_DATE='March 06, 2013'
AC_SUBST([RELEASE_DATE])
diff --git a/contrib/README b/contrib/README
index a4691b7..71737f2 100644
--- a/contrib/README
+++ b/contrib/README
@@ -64,4 +64,4 @@ scripts print usage information when called with the `-h` option.
$ nsca-ng.init start
-<!-- vim:set textwidth=76 joinspaces: -->
+<!-- vim:set filetype=markdown textwidth=76 joinspaces: -->
diff --git a/contrib/debug_server b/contrib/debug_server
index 3335f95..7259ad0 100755
--- a/contrib/debug_server
+++ b/contrib/debug_server
@@ -54,7 +54,7 @@ config_file=${config_file:-$default_config_file}
if [ -r "$config_file" ]
then
- eval `sed 's/[[:space:]]*=[[:space:]]*/=/' "$config_file"`
+ eval "`sed 's/[[:space:]]*=[[:space:]]*/=/' "$config_file"`"
else
echo >&2 "Cannot read $config_file (continuing anyway)"
fi
diff --git a/contrib/downtime b/contrib/downtime
index 86dec23..fa173b2 100755
--- a/contrib/downtime
+++ b/contrib/downtime
@@ -66,8 +66,8 @@ test $# -eq 0 || usage
host=${host:-`hostname -s`}
service=${service:+$service}
-start=`date -d ${start:-'now'}`
-end=`date -d ${end:-'+2 hours'}`
+start=`date -d ${start:-'now'} '+%s'`
+end=`date -d ${end:-'+2 hours'} '+%s'`
author=`getent passwd "$USER" | cut -d: -f5`
comment=${comment:-"Submitted by send_nsca@`hostname -s`"}
diff --git a/contrib/invoke_check b/contrib/invoke_check
index d61814a..da74862 100755
--- a/contrib/invoke_check
+++ b/contrib/invoke_check
@@ -58,6 +58,6 @@ state=$?
test $state -le 3 || die "$0: '$@' yields invalid plugin return code $state"
-printf '%b' "$host\t$service\t$state\t$output\n" | send_nsca -C $send_nsca_args
+printf '%b' "$host\t$service\t$state\t$output\n" | send_nsca $send_nsca_args
# vim:set joinspaces noexpandtab textwidth=80:
diff --git a/etc/nsca-ng.cfg b/etc/nsca-ng.cfg
index 6cab584..bcfc035 100644
--- a/etc/nsca-ng.cfg
+++ b/etc/nsca-ng.cfg
@@ -71,18 +71,22 @@ command_file = "/usr/local/nagios/var/rw/nagios.cmd"
# services = ".*"
# }
#
-# Authenticated "web-checker"-Clients may submit check results for arbitrary
-# services on hosts whose names begin with "www".
+# Authenticated "mail-checker" clients may submit check results for arbitrary
+# services on hosts whose names begin with "pop", "imap", or "smtp".
#
-# authorize "web-checker" {
+# authorize "mail-checker" {
# password = "1HOiwYonRoLByCaX6lfY5KDhP484THzV"
-# services = ".+ at www.*"
+# services = {
+# ".+ at pop.*",
+# ".+ at imap.*",
+# ".+ at smtp.*"
+# }
# }
#
-# Other authenticated clients may submit check results for the "disk", "swap",
-# and "load" services on arbitrary hosts.
+# Authenticated "system-checker" clients may submit check results for the
+# "disk", "swap", and "load" services on arbitrary hosts.
#
-# authorize "*" {
+# authorize "system-checker" {
# password = "rDCnSMFaM9wb5Yzjd6JwRcvHEwmC9ZlQ"
# services = {
# "disk",
@@ -90,6 +94,23 @@ command_file = "/usr/local/nagios/var/rw/nagios.cmd"
# "load"
# }
# }
+#
+
+#
+# The "*" section applies when no other section matches the client's identity.
+# In order to authorize clients to actually submit check results (or other
+# commands), at least one "commands" and/or "services" expression must be
+# specified.
+#
+authorize "*" {
+ password = "change-me"
+ #
+ # The original NSCA server permits all authenticated clients to submit
+ # arbitrary check results. To get this behaviour, enable the following
+ # line:
+ #
+ # services = ".*"
+}
#
# Other files can be included.
diff --git a/m4/aio.m4 b/m4/aio.m4
index 68eec8a..c83e17a 100644
--- a/m4/aio.m4
+++ b/m4/aio.m4
@@ -54,33 +54,36 @@ AC_DEFUN([NSCA_LIB_AIO],
AS_IF([test "x$nsca_lib_posix_aio" = xyes],
[AC_CACHE_CHECK([whether POSIX AIO works],
[nsca_cv_lib_aio_enabled],
- [AC_RUN_IFELSE(
- [AC_LANG_PROGRAM(
- [[#include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>
- #include <aio.h>
- #include <string.h>
- #include <unistd.h>]],
- [[struct aiocb cb;
- const struct aiocb *cb_list[1];
- char msg[] = "Hello, world!\n";
- int fd;
- if ((fd = open("/dev/null", O_WRONLY)) == -1)
- return 1;
- (void)memset(&cb, 0, sizeof(cb));
- cb.aio_buf = msg;
- cb.aio_nbytes = sizeof(msg);
- cb.aio_fildes = fd;
- cb.aio_offset = 0;
- cb.aio_sigevent.sigev_notify = SIGEV_NONE;
- cb_list[0] = &cb;
- if (aio_write(&cb) == -1 || aio_suspend(cb_list, 1, NULL) == -1)
- return 1;
- (void)close(fd);]])],
- [nsca_cv_lib_aio_enabled=yes],
- [nsca_cv_lib_aio_enabled=no],
- [nsca_cv_lib_aio_enabled=no])])])
+ [save_LIBS=$LIBS
+ LIBS=$AIOLIBS
+ AC_RUN_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <sys/types.h>
+ #include <sys/stat.h>
+ #include <fcntl.h>
+ #include <aio.h>
+ #include <string.h>
+ #include <unistd.h>]],
+ [[struct aiocb cb;
+ const struct aiocb *cb_list[1];
+ char msg[] = "Hello, world!\n";
+ int fd;
+ if ((fd = open("/dev/null", O_WRONLY)) == -1)
+ return 1;
+ (void)memset(&cb, 0, sizeof(cb));
+ cb.aio_buf = msg;
+ cb.aio_nbytes = sizeof(msg);
+ cb.aio_fildes = fd;
+ cb.aio_offset = 0;
+ cb.aio_sigevent.sigev_notify = SIGEV_NONE;
+ cb_list[0] = &cb;
+ if (aio_write(&cb) == -1 || aio_suspend(cb_list, 1, NULL) == -1)
+ return 1;
+ (void)close(fd);]])],
+ [nsca_cv_lib_aio_enabled=yes],
+ [nsca_cv_lib_aio_enabled=no],
+ [nsca_cv_lib_aio_enabled=no])
+ LIBS=$save_LIBS])])
AS_IF([test "x$nsca_cv_lib_aio_enabled" = xyes],
[AC_DEFINE([HAVE_POSIX_AIO], [1],
[Define to 1 if you have the POSIX AIO API.])
diff --git a/man/nsca-ng.cfg.in b/man/nsca-ng.cfg.in
index 2d2b14a..d77d854 100644
--- a/man/nsca-ng.cfg.in
+++ b/man/nsca-ng.cfg.in
@@ -243,7 +243,7 @@ The format of the string is described in the
.BR ciphers (1)
manual.
By default, the ciphers in the list
-.SM \f(CWPSK-RC4-SHA:PSK-AES256-CBC-SHA:PSK-AES128-CBC-SHA:PSK-3DES-EDE-CBC-SHA\fP
+.SM \f(CWPSK-AES256-CBC-SHA:PSK-AES128-CBC-SHA:PSK-3DES-EDE-CBC-SHA:PSK-RC4-SHA\fP
will be accepted.
.
.TP
@@ -378,6 +378,14 @@ authorize "web-checker" {
}
#
+# Authenticated "nsca-checker" clients may talk to the NSCA-ng
+# server, but may not submit anything to Nagios.
+#
+authorize "nsca-checker" {
+ password = "ceOKwxpz14lKXroC4yUjJZbov6VAyKuT"
+}
+
+#
# Other authenticated clients may submit check results for the
# "disk", "swap", and "load" services on arbitrary hosts.
#
diff --git a/man/send_nsca.cfg.in b/man/send_nsca.cfg.in
index 2f30144..632ef97 100644
--- a/man/send_nsca.cfg.in
+++ b/man/send_nsca.cfg.in
@@ -162,7 +162,7 @@ The format of the string is described in the
.BR ciphers (1)
manual.
By default, the ciphers in the list
-.SM \f(CWPSK-RC4-SHA:PSK-AES256-CBC-SHA:PSK-AES128-CBC-SHA:PSK-3DES-EDE-CBC-SHA\fP
+.SM \f(CWPSK-AES256-CBC-SHA:PSK-AES128-CBC-SHA:PSK-3DES-EDE-CBC-SHA:PSK-RC4-SHA\fP
will be offered.
.
.SH EXAMPLES
diff --git a/src/client/conf.c b/src/client/conf.c
index c02bcfa..d72c729 100644
--- a/src/client/conf.c
+++ b/src/client/conf.c
@@ -45,14 +45,7 @@
#define DEFAULT_SERVER "localhost"
#define DEFAULT_TIMEOUT 15
#define DEFAULT_TLS_CIPHERS \
- "PSK-RC4-SHA:PSK-AES256-CBC-SHA:PSK-AES128-CBC-SHA:PSK-3DES-EDE-CBC-SHA"
-
-/*
- * The PSK-*-CBC-SHA cipher suites are broken in OpenSSL 1.0.1d. Otherwise we'd
- * use the following list of DEFAULT_TLS_CIPHERS:
- *
- * PSK-AES256-CBC-SHA:PSK-AES128-CBC-SHA:PSK-3DES-EDE-CBC-SHA:PSK-RC4-SHA
- */
+ "PSK-AES256-CBC-SHA:PSK-AES128-CBC-SHA:PSK-3DES-EDE-CBC-SHA:PSK-RC4-SHA"
struct conf_s { /* This is typedef'd to `conf' in conf.h. */
const char *key;
diff --git a/src/client/send_nsca.c b/src/client/send_nsca.c
index 3753a46..e7c53e3 100644
--- a/src/client/send_nsca.c
+++ b/src/client/send_nsca.c
@@ -114,7 +114,7 @@ main(int argc, char **argv)
(void)client_start(host_port,
conf_getstr(cfg, "tls_ciphers"),
- (ev_tstamp)conf_getint(cfg, "timeout"),
+ conf_getint(cfg, "timeout"),
opt->raw_commands ? CLIENT_MODE_COMMAND : CLIENT_MODE_CHECK_RESULT,
opt->delimiter);
diff --git a/src/common/tls.c b/src/common/tls.c
index 20a551d..fa60925 100644
--- a/src/common/tls.c
+++ b/src/common/tls.c
@@ -898,6 +898,7 @@ check_tls_error(EV_P_ ev_io *w, int code)
* http://marc.info/?m=127100694709805
*/
warning_f("%s aborted the TLS shutdown", peer);
+ break;
default:
warning_f("Socket error (%s): %m", peer);
}
diff --git a/src/server/conf.c b/src/server/conf.c
index 9814d2b..d94e720 100644
--- a/src/server/conf.c
+++ b/src/server/conf.c
@@ -49,14 +49,7 @@
#define DEFAULT_TEMP_DIRECTORY "/tmp"
#define DEFAULT_TIMEOUT 60.0 /* For considerations, see RFC 5482, section 6. */
#define DEFAULT_TLS_CIPHERS \
- "PSK-RC4-SHA:PSK-AES256-CBC-SHA:PSK-AES128-CBC-SHA:PSK-3DES-EDE-CBC-SHA"
-
-/*
- * The PSK-*-CBC-SHA cipher suites are broken in OpenSSL 1.0.1d. Otherwise we'd
- * use the following list of DEFAULT_TLS_CIPHERS:
- *
- * PSK-AES256-CBC-SHA:PSK-AES128-CBC-SHA:PSK-3DES-EDE-CBC-SHA:PSK-RC4-SHA
- */
+ "PSK-AES256-CBC-SHA:PSK-AES128-CBC-SHA:PSK-3DES-EDE-CBC-SHA:PSK-RC4-SHA"
static void hash_auth_blocks(cfg_t *);
static char *service_to_command(const char *);
diff --git a/src/server/fifo.c b/src/server/fifo.c
index 9483843..f4bef95 100644
--- a/src/server/fifo.c
+++ b/src/server/fifo.c
@@ -163,7 +163,7 @@ fifo_start(const char * restrict path, const char * restrict dump_dir,
ev_init(&fifo->open_watcher, open_cb);
ev_init(&fifo->write_watcher, write_cb);
- ev_invoke(EV_DEFAULT_UC_ &fifo->open_watcher, 0);
+ ev_invoke(EV_DEFAULT_UC_ &fifo->open_watcher, EV_CUSTOM);
return fifo;
}
@@ -229,9 +229,11 @@ fifo_stop(fifo_state *fifo)
*/
static void
-open_cb(EV_P_ ev_timer *w, int revents __attribute__((__unused__)))
+open_cb(EV_P_ ev_timer *w, int revents)
{
fifo_state *fifo = w->data;
+ struct stat sb;
+ int result;
do
fifo->fd = open(fifo->path, O_WRONLY | O_NONBLOCK);
@@ -242,15 +244,29 @@ open_cb(EV_P_ ev_timer *w, int revents __attribute__((__unused__)))
warning("No process is reading the command file");
else
warning("Cannot open %s: %m", fifo->path);
+ } else if ((result = stat(fifo->path, &sb) == -1)
+ || !S_ISFIFO(sb.st_mode)) {
+ if (result == -1)
+ warning("Cannot get status of %s: %m", fifo->path);
+ else
+ warning("%s is not a named pipe", fifo->path);
- ev_timer_set(&fifo->open_watcher, TIMEOUT, 0.0);
- ev_timer_start(EV_A_ w);
+ (void)close(fifo->fd);
+ fifo->fd = -1;
} else {
- debug("Opened command file for writing");
+ if (revents == EV_CUSTOM) /* We were invoked by fifo_start(). */
+ debug("Opened command file for writing");
+ else
+ notice("Opened the command file successfully");
ev_io_set(&fifo->write_watcher, fifo->fd, EV_WRITE);
if (!buffers_are_empty(fifo))
dispatch_data(fifo);
}
+
+ if (fifo->fd == -1) {
+ ev_timer_set(&fifo->open_watcher, TIMEOUT, 0.0);
+ ev_timer_start(EV_A_ w);
+ }
}
static void
diff --git a/src/server/server.c b/src/server/server.c
index 83acda2..0fcd193 100644
--- a/src/server/server.c
+++ b/src/server/server.c
@@ -154,7 +154,6 @@ handle_connect(tls_state *tls)
static void
handle_handshake(tls_state * restrict tls, char * restrict line)
{
- connection_state *connection = tls->data;
char *args[3];
info("%s C: %s", tls->peer, line);
diff --git a/tests/package.m4 b/tests/package.m4
index f719388..0266ec6 100644
--- a/tests/package.m4
+++ b/tests/package.m4
@@ -4,9 +4,9 @@ m4_define([AT_PACKAGE_NAME],
m4_define([AT_PACKAGE_TARNAME],
[nsca-ng])
m4_define([AT_PACKAGE_VERSION],
- [0.3])
+ [1.0])
m4_define([AT_PACKAGE_STRING],
- [NSCA-ng 0.3])
+ [NSCA-ng 1.0])
m4_define([AT_PACKAGE_BUGREPORT],
[developers at nsca-ng.org])
m4_define([AT_PACKAGE_URL],
diff --git a/tests/testsuite b/tests/testsuite
index 64f2dfc..287ba4d 100755
--- a/tests/testsuite
+++ b/tests/testsuite
@@ -917,7 +917,7 @@ fi
# List of tests.
if $at_list_p; then
cat <<_ATEOF || at_write_fail=1
-NSCA-ng 0.3 test suite test groups:
+NSCA-ng 1.0 test suite test groups:
NUM: FILE-NAME:LINE TEST-GROUP-NAME
KEYWORDS
@@ -958,7 +958,7 @@ _ATEOF
exit $at_write_fail
fi
if $at_version_p; then
- $as_echo "$as_me (NSCA-ng 0.3)" &&
+ $as_echo "$as_me (NSCA-ng 1.0)" &&
cat <<\_ATEOF || at_write_fail=1
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1144,11 +1144,11 @@ exec 5>>"$at_suite_log"
# Banners and logs.
$as_echo "## ----------------------- ##
-## NSCA-ng 0.3 test suite. ##
+## NSCA-ng 1.0 test suite. ##
## ----------------------- ##"
{
$as_echo "## ----------------------- ##
-## NSCA-ng 0.3 test suite. ##
+## NSCA-ng 1.0 test suite. ##
## ----------------------- ##"
echo
@@ -1992,7 +1992,7 @@ _ASBOX
$as_echo "Please send $at_msg and all information you think might help:
To: <developers at nsca-ng.org>
- Subject: [NSCA-ng 0.3] $as_me: $at_fail_list${at_fail_list:+ failed${at_xpass_list:+, }}$at_xpass_list${at_xpass_list:+ passed unexpectedly}
+ Subject: [NSCA-ng 1.0] $as_me: $at_fail_list${at_fail_list:+ failed${at_xpass_list:+, }}$at_xpass_list${at_xpass_list:+ passed unexpectedly}
You may investigate any problem if you feel able to do so, in which
case the test suite provides a good starting point. Its output may
--
UNNAMED PROJECT
More information about the Pkg-nagios-changes
mailing list