aboutsummaryrefslogtreecommitdiff
path: root/plugins/check_ssh.c
diff options
context:
space:
mode:
authorGravatar Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> 2007-11-09 13:08:43 +0000
committerGravatar Thomas Guyot-Sionnest <dermoth@users.sourceforge.net> 2007-11-09 13:08:43 +0000
commit25624346481067be006ccd4a3b07afcf0cbb96ae (patch)
treed598c8fbbd371257c57e8a6371a4630cad7f0e5c /plugins/check_ssh.c
parentdca25be31acd52ee6a640d7c5150c183b539c762 (diff)
downloadmonitoring-plugins-25624346481067be006ccd4a3b07afcf0cbb96ae.tar.gz
Close the socket on all exits (not just the OK one)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1813 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_ssh.c')
-rw-r--r--plugins/check_ssh.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/plugins/check_ssh.c b/plugins/check_ssh.c
index afe44c95..9de7de38 100644
--- a/plugins/check_ssh.c
+++ b/plugins/check_ssh.c
@@ -233,6 +233,7 @@ ssh_connect (char *haddr, int hport, char *remote_version)
recv (sd, output, BUFF_SZ, 0);
if (strncmp (output, "SSH", 3)) {
printf (_("Server answer: %s"), output);
+ close(sd);
exit (STATE_CRITICAL);
}
else {
@@ -252,6 +253,7 @@ ssh_connect (char *haddr, int hport, char *remote_version)
printf
(_("SSH WARNING - %s (protocol %s) version mismatch, expected '%s'\n"),
ssh_server, ssh_proto, remote_version);
+ close(sd);
exit (STATE_WARNING);
}