diff --git a/plugins/check_ssh.c b/plugins/check_ssh.c
index ea74fa8865939a29c71b925b2993e20801650cbc..5617addc66baded12d9ead64636878626471b551 100644 (file)
--- a/plugins/check_ssh.c
+++ b/plugins/check_ssh.c
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ $Id$
+
******************************************************************************/
-#include "common.h"
-#include "netutils.h"
-#include "utils.h"
-
const char *progname = "check_ssh";
const char *revision = "$Revision$";
-const char *copyright = "2000-2003";
+const char *copyright = "2000-2004";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
+#include "common.h"
+#include "netutils.h"
+#include "utils.h"
+
#ifndef MSG_DONTWAIT
#define MSG_DONTWAIT 0
#endif
int ssh_connect (char *haddr, int hport, char *remote_version);
+
+
int
main (int argc, char **argv)
{
- int result;
+ int result = STATE_UNKNOWN;
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
if (process_arguments (argc, argv) == ERROR)
- usage (_("Could not parse arguments\n"));
+ usage4 (_("Could not parse arguments"));
/* initialize alarm signal handling */
signal (SIGALRM, socket_timeout_alarm_handler);
+
alarm (socket_timeout);
/* ssh_connect exits if error is found */
}
+
/* process command-line arguments */
int
process_arguments (int argc, char **argv)
switch (c) {
case '?': /* help */
- usage (_("Unknow argument\n"));
- break;
+ usage2 (_("Unknown argument"), optarg);
case 'V': /* version */
print_revision (progname, revision);
exit (STATE_OK);
#ifdef USE_IPV6
address_family = AF_INET6;
#else
- usage (_("IPv6 support not available\n"));
+ usage4 (_("IPv6 support not available"));
#endif
break;
case 'r': /* remote version */
port = atoi (optarg);
}
else {
- printf ("Port number nust be a positive integer: %s\n", optarg);
- usage ("");
+ usage2 (_("Port number must be a positive integer"), optarg);
}
}
-
}
c = optind;
*
*-----------------------------------------------------------------------*/
+
int
ssh_connect (char *haddr, int hport, char *remote_version)
{
printf
(_("SSH OK - %s (protocol %s)\n"),
ssh_server, ssh_proto);
+ close(sd);
exit (STATE_OK);
}
}
+
+
void
print_help (void)
{
printf (_(UT_SUPPORT));
}
+
+
void
print_usage (void)
{
- printf (_("\
-Usage: %s [-46] [-t <timeout>] [-r <remote version>] [-p <port>] <host>\n"), progname);
- printf (_(UT_HLP_VRS), progname, progname);
+ printf ("\
+Usage: %s [-46] [-t <timeout>] [-r <remote version>] [-p <port>] <host>\n", progname);
}
-/* end of check_ssh.c */