update 06_checkircd.dpatch

This commit is contained in:
Jan Wagner 2009-10-14 21:13:11 +00:00
parent 4c56464a2d
commit ba575ac4de
2 changed files with 56 additions and 11 deletions

1
debian/changelog vendored
View file

@ -14,6 +14,7 @@ nagios-plugins (1.4.14-1) UNRELEASED; urgency=low
Alexander Wirt (Closes: #545940) Alexander Wirt (Closes: #545940)
* Remove coreutils from build-depends, it's essential * Remove coreutils from build-depends, it's essential
* Raise compat level to 5 * Raise compat level to 5
* Update 06_checkircd.dpatch, which got fixed upstream
-- Jan Wagner <waja@cyconet.org> Thu, 06 Aug 2009 00:11:51 +0200 -- Jan Wagner <waja@cyconet.org> Thu, 06 Aug 2009 00:11:51 +0200

View file

@ -1,5 +1,9 @@
#! /bin/sh -e #! /bin/sh -e
## 06_checkircd.dpatch by <ultrotter@debian.org> ## 06_checkircd.dpatch
## From: Thomas Guyot-Sionnest <dermoth@aei.ca>
## Date: Sat, 19 Sep 2009 05:44:10 +0000 (-0400)
## Subject: Fix check_ircd binding to wrong interface (#668778)
## X-Git-Url: http://repo.or.cz/w/nagiosplugins.git?a=commitdiff_plain;h=bc3c8c7cfbdbce716e8987bee211f69911ea8db2
## ##
## DP: Make it working on multihomed host, by choosing the kernel the correct interface ## DP: Make it working on multihomed host, by choosing the kernel the correct interface
@ -22,23 +26,63 @@ esac
exit 0 exit 0
@DPATCH@ @DPATCH@
diff -urNad /home/ultrotter/docs/projects/deb/nagios/new/nagios-plugins-1.3.1.0/plugins-scripts/check_ircd.pl nagios-plugins-1.3.1.0/plugins-scripts/check_ircd.pl diff --git a/plugins-scripts/check_ircd.pl b/plugins-scripts/check_ircd.pl
--- /home/ultrotter/docs/projects/deb/nagios/new/nagios-plugins-1.3.1.0/plugins-scripts/check_ircd.pl 2002-05-07 07:35:49.000000000 +0200 index cc730cf..3fbce2e 100755
+++ nagios-plugins-1.3.1.0/plugins-scripts/check_ircd.pl 2004-08-12 15:54:50.000000000 +0200 --- a/plugins-scripts/check_ircd.pl
@@ -148,7 +148,6 @@ +++ b/plugins-scripts/check_ircd.pl
@@ -59,7 +59,7 @@ use utils qw($TIMEOUT %ERRORS &print_revision &support &usage);
sub print_help ();
sub print_usage ();
sub connection ($$$$);
-sub bindRemote ($$$);
+sub bindRemote ($$);
# -------------------------------------------------------------[ Enviroment ]--
@@ -141,28 +141,20 @@ Perl Check IRCD plugin for Nagios
# -------------------------------------------------------------[ bindRemote ]--
-sub bindRemote ($$$)
+sub bindRemote ($$)
{
- my ($in_remotehost, $in_remoteport, $in_hostname) = @_;
+ my ($in_remotehost, $in_remoteport) = @_;
my $proto = getprotobyname('tcp'); my $proto = getprotobyname('tcp');
my $sockaddr; my $sockaddr;
my $this; - my $this;
- my $thisaddr = gethostbyname($in_hostname); - my $thisaddr = gethostbyname($in_hostname);
my $that; my $that;
my ($name, $aliases,$type,$len,$thataddr) = gethostbyname($in_remotehost); my ($name, $aliases,$type,$len,$thataddr) = gethostbyname($in_remotehost);
# ($name,$aliases,$type,$len,$thisaddr) = gethostbyname($in_hostname); -# ($name,$aliases,$type,$len,$thisaddr) = gethostbyname($in_hostname);
@@ -158,7 +157,7 @@
if (!socket(ClientSocket,AF_INET, SOCK_STREAM, $proto)) {
print "IRCD UNKNOWN: Could not start socket ($!)\n";
exit $ERRORS{"UNKNOWN"}; exit $ERRORS{"UNKNOWN"};
} }
$sockaddr = 'S n a4 x8'; $sockaddr = 'S n a4 x8';
- $this = pack($sockaddr, AF_INET, 0, $thisaddr); - $this = pack($sockaddr, AF_INET, 0, $thisaddr);
+ $this = pack($sockaddr, AF_INET, 0, INADDR_ANY);
$that = pack($sockaddr, AF_INET, $in_remoteport, $thataddr); $that = pack($sockaddr, AF_INET, $in_remoteport, $thataddr);
if (!bind(ClientSocket, $this)) { - if (!bind(ClientSocket, $this)) {
print "IRCD UNKNOWN: Could not bind socket ($!)\n"; - print "IRCD UNKNOWN: Could not bind socket ($!)\n";
- exit $ERRORS{"UNKNOWN"};
- }
if (!connect(ClientSocket, $that)) {
print "IRCD UNKNOWN: Could not connect socket ($!)\n";
exit $ERRORS{"UNKNOWN"};
@@ -221,13 +213,10 @@ MAIN:
alarm($TIMEOUT);
- chomp($hostname = `/bin/hostname`);
- $hostname = $1 if ($hostname =~ /([-.a-zA-Z0-9]+)/);
my ($name, $alias, $proto) = getprotobyname('tcp');
- print "MAIN(debug): hostname = $hostname\n" if $verbose;
- print "MAIN(debug): binding to remote host: $remotehost -> $remoteport -> $hostname\n" if $verbose;
- my $ClientSocket = &bindRemote($remotehost,$remoteport,$hostname);
+ print "MAIN(debug): binding to remote host: $remotehost -> $remoteport\n" if $verbose;
+ my $ClientSocket = &bindRemote($remotehost,$remoteport);
print ClientSocket "NICK $NICK\nUSER $USER_INFO\n";