summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0bbf7f0)
raw | patch | inline | side by side (parent: 0bbf7f0)
author | Holger Weiss <hweiss@users.sourceforge.net> | |
Sat, 14 Apr 2007 03:09:39 +0000 (03:09 +0000) | ||
committer | Holger Weiss <hweiss@users.sourceforge.net> | |
Sat, 14 Apr 2007 03:09:39 +0000 (03:09 +0000) |
lines written to stderr. With revision 1.36 and newer, "-S" skipped the
specified number of lines written to stdout. Now, "-S" skips the
specified number of lines written to stderr; and if the number specified
via "-S" minus the number of lines written to stderr is larger than 0,
the difference is used as the number of lines written to stdout to skip.
Also, the "--help" output was fixed. (Hector - 1675286)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1685 f882894a-f735-0410-b71e-b25c423dba1c
specified number of lines written to stdout. Now, "-S" skips the
specified number of lines written to stderr; and if the number specified
via "-S" minus the number of lines written to stderr is larger than 0,
the difference is used as the number of lines written to stdout to skip.
Also, the "--help" output was fixed. (Hector - 1675286)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1685 f882894a-f735-0410-b71e-b25c423dba1c
BUGS | patch | blob | history | |
plugins/check_by_ssh.c | patch | blob | history |
index 4465d253eec48c925c6ae4c426cfe72d51c746b3..bbcc3cd5311e8d4aa72a423df6df3bc7abc8e152 100644 (file)
--- a/BUGS
+++ b/BUGS
1687867 - check_http: buffer overflow vulnerability
1675306 - check_dhcp: does not add mandatory 'end' option
-1675286 - check_ssh: -S flag not working
1652471 - check_http: missing Accept header
1648570 - check_dhcp error by asking 2 dhcp servers
1637767 - check_ping on FreeBSD 5.4 fails
diff --git a/plugins/check_by_ssh.c b/plugins/check_by_ssh.c
index 1675071c187e08cc5776ca160d8a8f72dbaeb119..65eee3c56a448d0a37f84b60b9bf8714265e3bcd 100644 (file)
--- a/plugins/check_by_ssh.c
+++ b/plugins/check_by_ssh.c
void print_help (void);
void print_usage (void);
-int commands = 0;
-int services = 0;
-int skip = 0;
+unsigned int commands = 0;
+unsigned int services = 0;
+unsigned int skip = 0;
char *remotecmd = NULL;
char *comm = NULL;
char *hostname = NULL;
printf ("%s\n", comm);
result = np_runcmd(comm, &chld_out, &chld_err, 0);
- /* UNKNOWN if output found on stderr */
- if(chld_err.buflen) {
+ /* UNKNOWN if (non-skipped) output found on stderr */
+ if((signed)chld_err.lines - (signed)skip > 0) {
printf(_("Remote command execution failed: %s\n"),
- chld_err.buflen ? chld_err.buf : _("Unknown error"));
+ skip < chld_err.lines ? chld_err.line[skip] : chld_err.buf);
return STATE_UNKNOWN;
}
+ skip -= chld_err.lines;
/* this is simple if we're not supposed to be passive.
* Wrap up quickly and keep the tricks below */
printf (" %s\n", _("tell ssh to use Protocol 1"));
printf (" %s\n", "-2, --proto2");
printf (" %s\n", _("tell ssh to use Protocol 2"));
- printf (" %s\n", "-S, --skiplines=n");
+ printf (" %s\n", "-S, --skip=n");
printf (" %s\n", _("Ignore first n lines on STDERR (to suppress a logon banner)"));
printf (" %s\n", "-f");
printf (" %s\n", _("tells ssh to fork rather than create a tty"));
print_usage (void)
{
printf (_("Usage:"));
- printf(" %s [-fq46] [-t timeout] [-i identity] [-l user] -H <host> -C <command>",progname);
- printf(" [-n name] [-s servicelist] [-O outputfile] [-p port] [-o ssh-option]\n");
+ printf (" %s -H <host> -C <command> [-fq] [-1|-2] [-4|-6]\n"
+ " [-S lines] [-t timeout] [-i identity] [-l user] [-n name]\n"
+ " [-s servicelist] [-O outputfile] [-p port] [-o ssh-option]\n",
+ progname);
}