summaryrefslogtreecommitdiffstats
path: root/plugins/t
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/t')
0 files changed, 0 insertions, 0 deletions
diff --git a/plugins/check_ssh.c b/plugins/check_ssh.c
index 3efc2e6..bd0a245 100644
--- a/plugins/check_ssh.c
+++ b/plugins/check_ssh.c
@@ -39,6 +39,7 @@ int ssh_connect (char *haddr, short hport);
39int 39int
40main (int argc, char **argv) 40main (int argc, char **argv)
41{ 41{
42 int result;
42 43
43 if (process_arguments (argc, argv) == ERROR) 44 if (process_arguments (argc, argv) == ERROR)
44 usage ("Could not parse arguments\n"); 45 usage ("Could not parse arguments\n");
@@ -48,11 +49,11 @@ main (int argc, char **argv)
48 alarm (socket_timeout); 49 alarm (socket_timeout);
49 50
50 /* ssh_connect exits if error is found */ 51 /* ssh_connect exits if error is found */
51 ssh_connect (server_name, port); 52 result = ssh_connect (server_name, port);
52 53
53 alarm (0); 54 alarm (0);
54 55
55 return (STATE_OK); 56 return (result);
56} 57}
57 58
58 59
@@ -126,13 +127,13 @@ process_arguments (int argc, char **argv)
126 } 127 }
127 128
128 c = optind; 129 c = optind;
129 if (server_name == NULL && argv[c]) { 130 if (server_name == NULL && c < argc) {
130 if (is_host (argv[c])) { 131 if (is_host (argv[c])) {
131 server_name = argv[c++]; 132 server_name = argv[c++];
132 } 133 }
133 } 134 }
134 135
135 if (port == -1 && argv[c]) { 136 if (port == -1 && c < argc) {
136 if (is_intpos (argv[c])) { 137 if (is_intpos (argv[c])) {
137 port = atoi (argv[c++]); 138 port = atoi (argv[c++]);
138 } 139 }
@@ -195,7 +196,7 @@ ssh_connect (char *haddr, short hport)
195 ssh_server = ssh_proto + strspn (ssh_proto, "-0123456789. "); 196 ssh_server = ssh_proto + strspn (ssh_proto, "-0123456789. ");
196 ssh_proto[strspn (ssh_proto, "0123456789. ")] = 0; 197 ssh_proto[strspn (ssh_proto, "0123456789. ")] = 0;
197 printf 198 printf
198 ("SSH ok - %s (protocol %s)\n", 199 ("SSH OK - %s (protocol %s)\n",
199 ssh_server, ssh_proto); 200 ssh_server, ssh_proto);
200 asprintf (&buffer, "SSH-%s-check_ssh_%s\r\n", ssh_proto, revision); 201 asprintf (&buffer, "SSH-%s-check_ssh_%s\r\n", ssh_proto, revision);
201 send (sd, buffer, strlen (buffer), MSG_DONTWAIT); 202 send (sd, buffer, strlen (buffer), MSG_DONTWAIT);