summaryrefslogtreecommitdiffstats
path: root/web/attachments/149231-check_tcp.diff
blob: e964ddf2e43803deb8f031382184e7db6d481f74 (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
--- nagios-plugins-1.4.1-org/plugins/check_tcp.c	2005-06-05 19:43:58.000000000 +0200
+++ nagios-plugins-1.4.1/plugins/check_tcp.c	2005-09-16 00:07:16.000000000 +0200
@@ -108,6 +108,7 @@
 {
 	int result = STATE_UNKNOWN;
 	int i;
+	int j;
 	char *status = NULL;
 	struct timeval tv;
 	size_t len, match = -1;
@@ -221,6 +222,30 @@
 	if(EXPECT && !server_expect_count)
 		server_expect_count++;
 
+	j=0;
+	for(i=0; server_send[i]; i++) {
+		if (server_send[i] == '\\') {
+			switch(server_send[i+1]) {
+				case 'n':
+					server_send[j++] = '\n';
+					i++;
+					break;
+				case 'r':
+					server_send[j++] = '\r';
+					i++;
+					break;
+				case 't':
+					server_send[j++] = '\t';
+					i++;
+					break;
+			}
+		}
+		else {
+			server_send[j++] = server_send[i];
+		}
+	}
+	server_send[j] = 0;
+
 	/* set up the timer */
 	signal (SIGALRM, socket_timeout_alarm_handler);
 	alarm (socket_timeout);