summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS3
-rwxr-xr-xplugins-scripts/check_ircd.pl21
2 files changed, 8 insertions, 16 deletions
diff --git a/NEWS b/NEWS
index 9e2906f..e6df579 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,8 @@
1This file documents the major additions and syntax changes between releases. 1This file documents the major additions and syntax changes between releases.
2 2
31.4.15 ...
4 Fix check_ircd binding to wrong interface (#668778)
5
31.4.14 16th September 2009 61.4.14 16th September 2009
4 check_http has options to specify the HTTP method (#2155152) 7 check_http has options to specify the HTTP method (#2155152)
5 check_users thresholds were not working exactly as documented (>= rather than >) 8 check_users thresholds were not working exactly as documented (>= rather than >)
diff --git a/plugins-scripts/check_ircd.pl b/plugins-scripts/check_ircd.pl
index cc730cf..3fbce2e 100755
--- a/plugins-scripts/check_ircd.pl
+++ b/plugins-scripts/check_ircd.pl
@@ -59,7 +59,7 @@ use utils qw($TIMEOUT %ERRORS &print_revision &support &usage);
59sub print_help (); 59sub print_help ();
60sub print_usage (); 60sub print_usage ();
61sub connection ($$$$); 61sub connection ($$$$);
62sub bindRemote ($$$); 62sub bindRemote ($$);
63 63
64# -------------------------------------------------------------[ Enviroment ]-- 64# -------------------------------------------------------------[ Enviroment ]--
65 65
@@ -141,28 +141,20 @@ Perl Check IRCD plugin for Nagios
141 141
142# -------------------------------------------------------------[ bindRemote ]-- 142# -------------------------------------------------------------[ bindRemote ]--
143 143
144sub bindRemote ($$$) 144sub bindRemote ($$)
145{ 145{
146 my ($in_remotehost, $in_remoteport, $in_hostname) = @_; 146 my ($in_remotehost, $in_remoteport) = @_;
147 my $proto = getprotobyname('tcp'); 147 my $proto = getprotobyname('tcp');
148 my $sockaddr; 148 my $sockaddr;
149 my $this;
150 my $thisaddr = gethostbyname($in_hostname);
151 my $that; 149 my $that;
152 my ($name, $aliases,$type,$len,$thataddr) = gethostbyname($in_remotehost); 150 my ($name, $aliases,$type,$len,$thataddr) = gethostbyname($in_remotehost);
153# ($name,$aliases,$type,$len,$thisaddr) = gethostbyname($in_hostname);
154 151
155 if (!socket(ClientSocket,AF_INET, SOCK_STREAM, $proto)) { 152 if (!socket(ClientSocket,AF_INET, SOCK_STREAM, $proto)) {
156 print "IRCD UNKNOWN: Could not start socket ($!)\n"; 153 print "IRCD UNKNOWN: Could not start socket ($!)\n";
157 exit $ERRORS{"UNKNOWN"}; 154 exit $ERRORS{"UNKNOWN"};
158 } 155 }
159 $sockaddr = 'S n a4 x8'; 156 $sockaddr = 'S n a4 x8';
160 $this = pack($sockaddr, AF_INET, 0, $thisaddr);
161 $that = pack($sockaddr, AF_INET, $in_remoteport, $thataddr); 157 $that = pack($sockaddr, AF_INET, $in_remoteport, $thataddr);
162 if (!bind(ClientSocket, $this)) {
163 print "IRCD UNKNOWN: Could not bind socket ($!)\n";
164 exit $ERRORS{"UNKNOWN"};
165 }
166 if (!connect(ClientSocket, $that)) { 158 if (!connect(ClientSocket, $that)) {
167 print "IRCD UNKNOWN: Could not connect socket ($!)\n"; 159 print "IRCD UNKNOWN: Could not connect socket ($!)\n";
168 exit $ERRORS{"UNKNOWN"}; 160 exit $ERRORS{"UNKNOWN"};
@@ -221,13 +213,10 @@ MAIN:
221 213
222 alarm($TIMEOUT); 214 alarm($TIMEOUT);
223 215
224 chomp($hostname = `/bin/hostname`);
225 $hostname = $1 if ($hostname =~ /([-.a-zA-Z0-9]+)/);
226 my ($name, $alias, $proto) = getprotobyname('tcp'); 216 my ($name, $alias, $proto) = getprotobyname('tcp');
227 print "MAIN(debug): hostname = $hostname\n" if $verbose;
228 217
229 print "MAIN(debug): binding to remote host: $remotehost -> $remoteport -> $hostname\n" if $verbose; 218 print "MAIN(debug): binding to remote host: $remotehost -> $remoteport\n" if $verbose;
230 my $ClientSocket = &bindRemote($remotehost,$remoteport,$hostname); 219 my $ClientSocket = &bindRemote($remotehost,$remoteport);
231 220
232 print ClientSocket "NICK $NICK\nUSER $USER_INFO\n"; 221 print ClientSocket "NICK $NICK\nUSER $USER_INFO\n";
233 222