]> git.pld-linux.org Git - packages/cyrus-sasl.git/blob - cyrus-sasl-nagios-plugin.patch
c65c562b62962847b35e5414bd83062ef815251a
[packages/cyrus-sasl.git] / cyrus-sasl-nagios-plugin.patch
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 @@
4  AUTOMAKE_OPTIONS = 1.7
5  sbin_PROGRAMS  = saslauthd testsaslauthd
6 +nagios_PROGRAM = check_saslauthd
7 +nagiosdir      = @libexecdir@/nagios/plugins
8  EXTRA_PROGRAMS  = saslcache
9  
10  saslauthd_SOURCES = mechanisms.c globals.h \
11 @@ -21,6 +23,10 @@
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 \
22 --- cyrus-sasl-2.1.22/saslauthd/saslauthd.h.in  2006-05-18 22:38:27.000000000 +0300
23 +++ cyrus-sasl-2.1.22-nagios/saslauthd/saslauthd.h.in   2009-01-30 13:47:59.582432052 +0200
24 @@ -164,9 +164,6 @@
25  /* define if your compiler has __attribute__ */
26  #undef HAVE___ATTRIBUTE__
27  
28 -/* Using Heimdal */
29 -#undef KRB5_HEIMDAL
30 -
31  /* Name of package */
32  #undef PACKAGE
33  
34 @@ -206,7 +203,7 @@
35  /* Use NDBM for SASLdb */
36  #undef SASL_NDBM
37  
38 -/* The size of a `long', as computed by sizeof. */
39 +/* The size of `long', as computed by sizeof. */
40  #undef SIZEOF_LONG
41  
42  /* User KERBEROS_V4 Staticly */
43 --- cyrus-sasl-2.1.22/saslauthd/testsaslauthd.c 2004-01-21 21:54:53.000000000 +0200
44 +++ cyrus-sasl-2.1.22-nagios/saslauthd/testsaslauthd.c  2009-01-30 18:36:26.070737112 +0200
45 @@ -57,6 +57,13 @@
46  #endif
47  #include <assert.h>
48  
49 +#ifdef NAGIOS_PLUGIN
50 +#define STATE_OK    0
51 +#define STATE_WARNING   1
52 +#define STATE_CRITICAL  2
53 +#define STATE_UNKNOWN   3
54 +#endif
55 +
56  #include "globals.h"
57  #include "utils.h"
58  
59 @@ -243,7 +250,11 @@
60      }
61    
62      printf("NO \"authentication failed\"\n");
63 +#ifdef NAGIOS_PLUGIN
64 +    return 1;
65 +#else
66      return -1;
67 +#endif
68  }
69  
70  int
71 @@ -293,7 +304,11 @@
72                   "              [-r realm] [-s servicename]\n"
73                   "              [-f socket path] [-R repeatnum]\n",
74                   argv[0], argv[0]);
75 +#ifdef NAGIOS_PLUGIN
76 +    exit(STATE_UNKNOWN);
77 +#else
78      exit(1);
79 +#endif
80    }
81  
82    if (!repeat) repeat = 1;
83 @@ -302,7 +317,23 @@
84        printf("%d: ", c);
85        result = saslauthd_verify_password(path, user, password, service, realm);
86    }
87 +#ifdef NAGIOS_PLUGIN
88 +  switch (result) {
89 +  case -1:
90 +      return STATE_CRITICAL;
91 +
92 +  case 0: // auth ok
93 +      return STATE_OK;
94 +
95 +  case 1: // auth fail
96 +      return STATE_WARNING;
97 +
98 +  default:
99 +      return STATE_UNKNOWN;
100 +  }
101 +#else
102    return result;
103 +#endif
104  }
105  
106  
This page took 0.052431 seconds and 3 git commands to generate.