summaryrefslogtreecommitdiffstats
path: root/web/attachments/200576-ssh_connect_parse.patch
diff options
context:
space:
mode:
Diffstat (limited to 'web/attachments/200576-ssh_connect_parse.patch')
-rw-r--r--web/attachments/200576-ssh_connect_parse.patch95
1 files changed, 95 insertions, 0 deletions
diff --git a/web/attachments/200576-ssh_connect_parse.patch b/web/attachments/200576-ssh_connect_parse.patch
new file mode 100644
index 0000000..7f7e707
--- /dev/null
+++ b/web/attachments/200576-ssh_connect_parse.patch
@@ -0,0 +1,95 @@
1diff -ruN nagios-plugins-1.4.4.orig/plugins/check_ssh.c nagios-plugins-1.4.4/plugins/check_ssh.c
2--- nagios-plugins-1.4.4.orig/plugins/check_ssh.c 2006-06-21 07:05:00.000000000 -0400
3+++ nagios-plugins-1.4.4/plugins/check_ssh.c 2006-10-29 20:20:11.000000000 -0500
4@@ -50,6 +50,7 @@
5 int port = -1;
6 char *server_name = NULL;
7 char *remote_version = NULL;
8+char *parse_remote_version = NULL;
9 int verbose = FALSE;
10
11 int process_arguments (int, char **);
12@@ -57,7 +58,7 @@
13 void print_help (void);
14 void print_usage (void);
15
16-int ssh_connect (char *haddr, int hport, char *remote_version);
17+int ssh_connect (char *haddr, int hport, char *remote_version, char *parse_remote_version);
18
19
20
21@@ -79,7 +80,7 @@
22 alarm (socket_timeout);
23
24 /* ssh_connect exits if error is found */
25- result = ssh_connect (server_name, port, remote_version);
26+ result = ssh_connect (server_name, port, remote_version, parse_remote_version);
27
28 alarm (0);
29
30@@ -105,6 +106,7 @@
31 {"timeout", required_argument, 0, 't'},
32 {"verbose", no_argument, 0, 'v'},
33 {"remote-version", required_argument, 0, 'r'},
34+ {"parse-remote-version", required_argument, 0, 's'},
35 {0, 0, 0, 0}
36 };
37
38@@ -116,7 +118,7 @@
39 strcpy (argv[c], "-t");
40
41 while (1) {
42- c = getopt_long (argc, argv, "+Vhv46t:r:H:p:", longopts, &option);
43+ c = getopt_long (argc, argv, "+Vhv46t:r:s:H:p:", longopts, &option);
44
45 if (c == -1 || c == EOF)
46 break;
47@@ -152,6 +154,9 @@
48 case 'r': /* remote version */
49 remote_version = optarg;
50 break;
51+ case 's': /* remote version */
52+ parse_remote_version = optarg;
53+ break;
54 case 'H': /* host */
55 if (is_host (optarg) == FALSE)
56 usage2 (_("Invalid hostname/address"), optarg);
57@@ -206,7 +211,7 @@
58
59
60 int
61-ssh_connect (char *haddr, int hport, char *remote_version)
62+ssh_connect (char *haddr, int hport, char *remote_version, char *parse_remote_version)
63 {
64 int sd;
65 int result;
66@@ -248,6 +253,11 @@
67 (_("SSH WARNING - %s (protocol %s) version mismatch, expected '%s'\n"),
68 ssh_server, ssh_proto, remote_version);
69 exit (STATE_WARNING);
70+ } else if (parse_remote_version && !strstr(parse_remote_version, ssh_server)) {
71+ printf
72+ (_("SSH WARNING - %s (protocol %s) version mismatch, expected '%s'\n"),
73+ ssh_server, ssh_proto, parse_remote_version);
74+ exit (STATE_WARNING);
75 }
76
77 printf
78@@ -285,6 +295,9 @@
79
80 printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT);
81
82+ printf (" %s\n", "-s, --parse-remote-version=STRING");
83+ printf (" %s\n", _("Warn if STRING isnt in server version(ex: SSH)"));
84+
85 printf (" %s\n", "-r, --remote-version=STRING");
86 printf (" %s\n", _("Warn if string doesn't match expected server version (ex: OpenSSH_3.9p1)"));
87
88@@ -299,6 +312,6 @@
89 print_usage (void)
90 {
91 printf (_("Usage:"));
92- printf ("%s [-46] [-t <timeout>] [-r <remote version>] [-p <port>] <host>\n", progname);
93+ printf ("%s [-46] [-t <timeout>] [-r <remote version> | -s <remote string>] [-p <port>] <host>\n", progname);
94 }
95