]> git.pld-linux.org Git - packages/cyrus-sasl.git/blame - cyrus-sasl-nagios-plugin.patch
- new gcc doesn't like more things
[packages/cyrus-sasl.git] / cyrus-sasl-nagios-plugin.patch
CommitLineData
ccc7c536
ER
1--- cyrus-sasl-2.1.22-nagios/saslauthd/Makefile.am 2009-01-30 18:09:01.984198032 +0200
2+++ cyrus-sasl-2.1.22/saslauthd/Makefile.am 2009-01-30 18:43:20.796560455 +0200
3@@ -1,5 +1,7 @@
53445750 4 AUTOMAKE_OPTIONS = 1.7
ccc7c536 5 sbin_PROGRAMS = saslauthd testsaslauthd
f91fdf36 6+nagios_PROGRAMS = check_saslauthd
ccc7c536 7+nagiosdir = @libexecdir@/nagios/plugins
53445750
ER
8 EXTRA_PROGRAMS = saslcache
9
10 saslauthd_SOURCES = mechanisms.c globals.h \
ccc7c536 11@@ -21,6 +23,10 @@
53445750
ER
12 testsaslauthd_SOURCES = testsaslauthd.c utils.c
13 testsaslauthd_LDADD = @LIB_SOCKET@
14
15+check_saslauthd_SOURCES = testsaslauthd.c utils.c
16+check_saslauthd_LDADD = @LIB_SOCKET@
17+check_saslauthd_CFLAGS = -DNAGIOS_PLUGIN
18+
19 saslcache_SOURCES = saslcache.c
20
21 EXTRA_DIST = saslauthd.8 saslauthd.mdoc config include \
53445750
ER
22--- cyrus-sasl-2.1.22/saslauthd/testsaslauthd.c 2004-01-21 21:54:53.000000000 +0200
23+++ cyrus-sasl-2.1.22-nagios/saslauthd/testsaslauthd.c 2009-01-30 18:36:26.070737112 +0200
24@@ -57,6 +57,13 @@
25 #endif
26 #include <assert.h>
27
28+#ifdef NAGIOS_PLUGIN
29+#define STATE_OK 0
30+#define STATE_WARNING 1
31+#define STATE_CRITICAL 2
32+#define STATE_UNKNOWN 3
33+#endif
34+
35 #include "globals.h"
36 #include "utils.h"
37
38@@ -243,7 +250,11 @@
39 }
40
41 printf("NO \"authentication failed\"\n");
42+#ifdef NAGIOS_PLUGIN
43+ return 1;
44+#else
45 return -1;
46+#endif
47 }
48
49 int
50@@ -293,7 +304,11 @@
51 " [-r realm] [-s servicename]\n"
52 " [-f socket path] [-R repeatnum]\n",
53 argv[0], argv[0]);
54+#ifdef NAGIOS_PLUGIN
55+ exit(STATE_UNKNOWN);
56+#else
57 exit(1);
58+#endif
59 }
60
61 if (!repeat) repeat = 1;
62@@ -302,7 +317,23 @@
63 printf("%d: ", c);
64 result = saslauthd_verify_password(path, user, password, service, realm);
65 }
66+#ifdef NAGIOS_PLUGIN
67+ switch (result) {
68+ case -1:
69+ return STATE_CRITICAL;
70+
71+ case 0: // auth ok
72+ return STATE_OK;
73+
74+ case 1: // auth fail
75+ return STATE_WARNING;
76+
77+ default:
78+ return STATE_UNKNOWN;
79+ }
80+#else
81 return result;
82+#endif
83 }
84
85
This page took 0.165981 seconds and 4 git commands to generate.