summaryrefslogtreecommitdiffstats
path: root/plugins/check_ldap.d/config.h
blob: 97a9cfa784fbaa3d8214724d5d3a52bdf09034d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#pragma once

#include "../../config.h"
#include "thresholds.h"
#include <mysql/udf_registration_types.h>
#include <stddef.h>

static char ld_defattr[] = "(objectclass=*)";

enum {
#ifdef HAVE_LDAP_SET_OPTION
	DEFAULT_PROTOCOL = 2,
#endif
};

typedef struct {
	char *ld_host;
	char *ld_base;
	char *ld_passwd;
	char *ld_binddn;
	char *ld_attr;
	int ld_port;
	bool starttls;
	bool ssl_on_connect;
#ifdef HAVE_LDAP_SET_OPTION
	int ld_protocol;
#endif

	char *warn_entries;
	char *crit_entries;
	thresholds *entries_thresholds;
	bool warn_time_set;
	double warn_time;
	bool crit_time_set;
	double crit_time;
} check_ldap_config;

check_ldap_config check_ldap_config_init() {
	check_ldap_config tmp = {
		.ld_host = NULL,
		.ld_base = NULL,
		.ld_passwd = NULL,
		.ld_binddn = NULL,
		.ld_attr = ld_defattr,
		.ld_port = -1,
		.starttls = false,
		.ssl_on_connect = false,
#ifdef HAVE_LDAP_SET_OPTION
		.ld_protocol = DEFAULT_PROTOCOL,
#endif

		.warn_entries = NULL,
		.crit_entries = NULL,
		.entries_thresholds = NULL,
		.warn_time_set = false,
		.warn_time = 0,
		.crit_time_set = false,
		.crit_time = 0,
	};
	return tmp;
}