summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--BUGS1
-rw-r--r--plugins/check_by_ssh.c21
2 files changed, 12 insertions, 10 deletions
diff --git a/BUGS b/BUGS
index 4465d25..bbcc3cd 100644
--- a/BUGS
+++ b/BUGS
@@ -6,7 +6,6 @@ For the 1.4.8 release:
6 6
71687867 - check_http: buffer overflow vulnerability 71687867 - check_http: buffer overflow vulnerability
81675306 - check_dhcp: does not add mandatory 'end' option 81675306 - check_dhcp: does not add mandatory 'end' option
91675286 - check_ssh: -S flag not working
101652471 - check_http: missing Accept header 91652471 - check_http: missing Accept header
111648570 - check_dhcp error by asking 2 dhcp servers 101648570 - check_dhcp error by asking 2 dhcp servers
121637767 - check_ping on FreeBSD 5.4 fails 111637767 - check_ping on FreeBSD 5.4 fails
diff --git a/plugins/check_by_ssh.c b/plugins/check_by_ssh.c
index 1675071..65eee3c 100644
--- a/plugins/check_by_ssh.c
+++ b/plugins/check_by_ssh.c
@@ -46,9 +46,9 @@ int validate_arguments (void);
46void print_help (void); 46void print_help (void);
47void print_usage (void); 47void print_usage (void);
48 48
49int commands = 0; 49unsigned int commands = 0;
50int services = 0; 50unsigned int services = 0;
51int skip = 0; 51unsigned int skip = 0;
52char *remotecmd = NULL; 52char *remotecmd = NULL;
53char *comm = NULL; 53char *comm = NULL;
54char *hostname = NULL; 54char *hostname = NULL;
@@ -92,12 +92,13 @@ main (int argc, char **argv)
92 printf ("%s\n", comm); 92 printf ("%s\n", comm);
93 93
94 result = np_runcmd(comm, &chld_out, &chld_err, 0); 94 result = np_runcmd(comm, &chld_out, &chld_err, 0);
95 /* UNKNOWN if output found on stderr */ 95 /* UNKNOWN if (non-skipped) output found on stderr */
96 if(chld_err.buflen) { 96 if((signed)chld_err.lines - (signed)skip > 0) {
97 printf(_("Remote command execution failed: %s\n"), 97 printf(_("Remote command execution failed: %s\n"),
98 chld_err.buflen ? chld_err.buf : _("Unknown error")); 98 skip < chld_err.lines ? chld_err.line[skip] : chld_err.buf);
99 return STATE_UNKNOWN; 99 return STATE_UNKNOWN;
100 } 100 }
101 skip -= chld_err.lines;
101 102
102 /* this is simple if we're not supposed to be passive. 103 /* this is simple if we're not supposed to be passive.
103 * Wrap up quickly and keep the tricks below */ 104 * Wrap up quickly and keep the tricks below */
@@ -336,7 +337,7 @@ print_help (void)
336 printf (" %s\n", _("tell ssh to use Protocol 1")); 337 printf (" %s\n", _("tell ssh to use Protocol 1"));
337 printf (" %s\n", "-2, --proto2"); 338 printf (" %s\n", "-2, --proto2");
338 printf (" %s\n", _("tell ssh to use Protocol 2")); 339 printf (" %s\n", _("tell ssh to use Protocol 2"));
339 printf (" %s\n", "-S, --skiplines=n"); 340 printf (" %s\n", "-S, --skip=n");
340 printf (" %s\n", _("Ignore first n lines on STDERR (to suppress a logon banner)")); 341 printf (" %s\n", _("Ignore first n lines on STDERR (to suppress a logon banner)"));
341 printf (" %s\n", "-f"); 342 printf (" %s\n", "-f");
342 printf (" %s\n", _("tells ssh to fork rather than create a tty")); 343 printf (" %s\n", _("tells ssh to fork rather than create a tty"));
@@ -383,6 +384,8 @@ void
383print_usage (void) 384print_usage (void)
384{ 385{
385 printf (_("Usage:")); 386 printf (_("Usage:"));
386 printf(" %s [-fq46] [-t timeout] [-i identity] [-l user] -H <host> -C <command>",progname); 387 printf (" %s -H <host> -C <command> [-fq] [-1|-2] [-4|-6]\n"
387 printf(" [-n name] [-s servicelist] [-O outputfile] [-p port] [-o ssh-option]\n"); 388 " [-S lines] [-t timeout] [-i identity] [-l user] [-n name]\n"
389 " [-s servicelist] [-O outputfile] [-p port] [-o ssh-option]\n",
390 progname);
388} 391}