summaryrefslogtreecommitdiffstats
path: root/web/attachments/66460-nagios-plugins-1.3.1-check-ldap.patch
blob: 31bf7d15632586abe07f46030ca7eee3c157a318 (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
62
63
64
65
66
67
--- ./plugins/check_ldap.c~	2003-01-29 06:16:15.000000000 +0000
+++ ./plugins/check_ldap.c	2003-10-22 11:10:44.000000000 +0100
@@ -45,8 +45,6 @@
 char *ld_attr = ld_defattr;
 char *ld_host = "";
 char *ld_base = "";
-char *ld_passwd = NULL;
-char *ld_binddn = NULL;
 unsigned int ld_port = DEFAULT_PORT;
 int warn_time = UNDEFINED;
 int crit_time = UNDEFINED;
@@ -74,20 +72,12 @@
 	time (&time0);
 
 	/* initialize ldap */
-	if (!(ld = ldap_open (ld_host, ld_port))) {
+	if (!(ld = ldap_init (ld_host, ld_port))) {
 		/*ldap_perror(ld, "ldap_open"); */
 		printf ("Could not connect to the server at port %i\n", ld_port);
 		return STATE_CRITICAL;
 	}
 
-	/* bind to the ldap server */
-	if (ldap_bind_s (ld, ld_binddn, ld_passwd, LDAP_AUTH_SIMPLE) !=
-			LDAP_SUCCESS) {
-		/*ldap_perror(ld, "ldap_bind"); */
-		printf ("Could not bind to the ldap-server\n");
-		return STATE_CRITICAL;
-	}
-
 	/* do a search of all objectclasses in the base dn */
 	if (ldap_search_s (ld, ld_base, LDAP_SCOPE_BASE, ld_attr, NULL, 0, &result)
 			!= LDAP_SUCCESS) {
@@ -140,8 +130,6 @@
 		{"host", required_argument, 0, 'H'},
 		{"base", required_argument, 0, 'b'},
 		{"attr", required_argument, 0, 'a'},
-		{"bind", required_argument, 0, 'D'},
-		{"pass", required_argument, 0, 'P'},
 		{"port", required_argument, 0, 'p'},
 		{"warn", required_argument, 0, 'w'},
 		{"crit", required_argument, 0, 'c'},
@@ -159,9 +147,9 @@
 
 	while (1) {
 #ifdef HAVE_GETOPT_H
-		c =	getopt_long (argc, argv, "hVt:c:w:H:b:p:a:D:P:", longopts, &option_index);
+		c =	getopt_long (argc, argv, "hVt:c:w:H:b:p:a:", longopts, &option_index);
 #else
-		c = getopt (argc, argv, "+?hVt:c:w:H:b:p:a:D:P:");
+		c = getopt (argc, argv, "+?hVt:c:w:H:b:p:a:");
 #endif
 
 		if (c == -1 || c == EOF)
@@ -191,12 +179,6 @@
 		case 'a':
 			ld_attr = optarg;
 			break;
-		case 'D':
-			ld_binddn = optarg;
-			break;
-		case 'P':
-			ld_passwd = optarg;
-			break;
 		case 'w':
 			warn_time = atoi (optarg);
 			break;