summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ba7ba99)
raw | patch | inline | side by side (parent: ba7ba99)
author | Jeremy T. Bouse <undrgrid@users.sourceforge.net> | |
Mon, 10 Feb 2003 18:36:46 +0000 (18:36 +0000) | ||
committer | Jeremy T. Bouse <undrgrid@users.sourceforge.net> | |
Mon, 10 Feb 2003 18:36:46 +0000 (18:36 +0000) |
Corrected return codes and output
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@306 f882894a-f735-0410-b71e-b25c423dba1c
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@306 f882894a-f735-0410-b71e-b25c423dba1c
plugins/check_ssh.c | patch | blob | history |
diff --git a/plugins/check_ssh.c b/plugins/check_ssh.c
index 3efc2e625ad9aa12b8db68d013222506cd4c3798..bd0a2451a44a9ec54d2c973ba378c75c9364e5b2 100644 (file)
--- a/plugins/check_ssh.c
+++ b/plugins/check_ssh.c
int
main (int argc, char **argv)
{
+ int result;
if (process_arguments (argc, argv) == ERROR)
usage ("Could not parse arguments\n");
alarm (socket_timeout);
/* ssh_connect exits if error is found */
- ssh_connect (server_name, port);
+ result = ssh_connect (server_name, port);
alarm (0);
- return (STATE_OK);
+ return (result);
}
}
c = optind;
- if (server_name == NULL && argv[c]) {
+ if (server_name == NULL && c < argc) {
if (is_host (argv[c])) {
server_name = argv[c++];
}
}
- if (port == -1 && argv[c]) {
+ if (port == -1 && c < argc) {
if (is_intpos (argv[c])) {
port = atoi (argv[c++]);
}
ssh_server = ssh_proto + strspn (ssh_proto, "-0123456789. ");
ssh_proto[strspn (ssh_proto, "0123456789. ")] = 0;
printf
- ("SSH ok - %s (protocol %s)\n",
+ ("SSH OK - %s (protocol %s)\n",
ssh_server, ssh_proto);
asprintf (&buffer, "SSH-%s-check_ssh_%s\r\n", ssh_proto, revision);
send (sd, buffer, strlen (buffer), MSG_DONTWAIT);