summaryrefslogtreecommitdiffstats
path: root/web/attachments/267584-nagios-plugins-1.4.8-checksshproto.patch
diff options
context:
space:
mode:
Diffstat (limited to 'web/attachments/267584-nagios-plugins-1.4.8-checksshproto.patch')
-rw-r--r--web/attachments/267584-nagios-plugins-1.4.8-checksshproto.patch88
1 files changed, 88 insertions, 0 deletions
diff --git a/web/attachments/267584-nagios-plugins-1.4.8-checksshproto.patch b/web/attachments/267584-nagios-plugins-1.4.8-checksshproto.patch
new file mode 100644
index 0000000..6ae62c5
--- /dev/null
+++ b/web/attachments/267584-nagios-plugins-1.4.8-checksshproto.patch
@@ -0,0 +1,88 @@
1--- nagios-plugins-1.4.8/plugins/check_ssh.c.orig 2008-01-07 16:18:34.000000000 -0800
2+++ nagios-plugins-1.4.8/plugins/check_ssh.c 2008-02-22 10:23:37.000000000 -0800
3@@ -54,6 +54,7 @@
4 int port = -1;
5 char *server_name = NULL;
6 char *remote_version = NULL;
7+char *remote_protocol = NULL;
8 int verbose = FALSE;
9
10 int process_arguments (int, char **);
11@@ -61,7 +62,7 @@
12 void print_help (void);
13 void print_usage (void);
14
15-int ssh_connect (char *haddr, int hport, char *remote_version);
16+int ssh_connect (char *haddr, int hport, char *remote_version, char *remote_protocol);
17
18
19
20@@ -83,7 +84,7 @@
21 alarm (socket_timeout);
22
23 /* ssh_connect exits if error is found */
24- result = ssh_connect (server_name, port, remote_version);
25+ result = ssh_connect (server_name, port, remote_version, remote_protocol);
26
27 alarm (0);
28
29@@ -110,6 +111,7 @@
30 {"timeout", required_argument, 0, 't'},
31 {"verbose", no_argument, 0, 'v'},
32 {"remote-version", required_argument, 0, 'r'},
33+ {"remote-protcol", required_argument, 0, 'P'},
34 {0, 0, 0, 0}
35 };
36
37@@ -121,7 +123,7 @@
38 strcpy (argv[c], "-t");
39
40 while (1) {
41- c = getopt_long (argc, argv, "+Vhv46t:r:H:p:", longopts, &option);
42+ c = getopt_long (argc, argv, "+Vhv46t:r:H:p:P:", longopts, &option);
43
44 if (c == -1 || c == EOF)
45 break;
46@@ -157,6 +159,9 @@
47 case 'r': /* remote version */
48 remote_version = optarg;
49 break;
50+ case 'P': /* remote version */
51+ remote_protocol = optarg;
52+ break;
53 case 'H': /* host */
54 if (is_host (optarg) == FALSE)
55 usage2 (_("Invalid hostname/address"), optarg);
56@@ -211,7 +216,7 @@
57
58
59 int
60-ssh_connect (char *haddr, int hport, char *remote_version)
61+ssh_connect (char *haddr, int hport, char *remote_version, char *remote_protocol)
62 {
63 int sd;
64 int result;
65@@ -254,6 +259,13 @@
66 ssh_server, ssh_proto, remote_version);
67 exit (STATE_WARNING);
68 }
69+
70+ if (remote_protocol && strcmp(remote_protocol, ssh_proto)) {
71+ printf
72+ (_("SSH WARNING - %s (protocol %s) protocol version mismatch, expected '%s'\n"),
73+ ssh_server, ssh_proto, remote_protocol);
74+ exit (STATE_WARNING);
75+ }
76
77 printf
78 (_("SSH OK - %s (protocol %s)\n"),
79@@ -293,6 +305,9 @@
80 printf (" %s\n", "-r, --remote-version=STRING");
81 printf (" %s\n", _("Warn if string doesn't match expected server version (ex: OpenSSH_3.9p1)"));
82
83+ printf (" %s\n", "-P, --remote-protocol=STRING");
84+ printf (" %s\n", _("Warn if protocol doesn't match expected protocol version (ex: 2.0)"));
85+
86 printf (_(UT_VERBOSE));
87
88 printf (_(UT_SUPPORT));