summaryrefslogtreecommitdiffstats
path: root/web/attachments/60404-check_nt.patch
blob: 4e52b76236f1117c6a69ec6e29e8449bf8bf4fa0 (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
--- check_nt.c	Wed Apr 23 05:51:16 2003
+++ /usr/src/nagios-plugins-1.3.1/plugins/check_nt.c	Tue Sep  2 12:31:02 2003
@@ -108,13 +108,23 @@
 	alarm(socket_timeout);
 
 	if (vars_to_check==CHECK_CLIENTVERSION) {
-			
+	/* Amendment, we now optionally check the version and make critical if it's not the correct version */			
 		asprintf(&send_buffer,strcat(req_password,"&1"));
-		result=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
-		if(result!=STATE_OK)
-			return result;
-		asprintf(&output_message,recv_buffer);
-		return_code=STATE_OK;
+		return_code=process_tcp_request(server_address,server_port,send_buffer,recv_buffer,sizeof(recv_buffer));
+		if(return_code!=STATE_OK)
+			return return_code;
+		/* If they have supplied a parameter we need to check it */
+		if (check_value_list==TRUE) {
+			if(strcmp(recv_buffer, value_list)!=0)
+				{
+				asprintf(&output_message,"Wrong client version: Running: %s Required: %s",recv_buffer,value_list);
+				return_code=STATE_WARNING;
+				}
+			}
+		if(return_code==STATE_OK)
+			{
+			asprintf(&output_message,recv_buffer);
+			};
 	}
 	else if(vars_to_check==CHECK_CPULOAD){