mirror of
https://github.com/monitoring-plugins/monitoring-plugins.git
synced 2026-04-15 22:00:06 -04:00
use pack_sockaddr_in rather than hand-rolled
On some OS, sockaddr structs include a length field. Perl's pack_sockaddr_in
takes this into account; the hand-rolled "pack('S n a4 x8'..." doesn't do so,
resulting in connection failures.
This commit is contained in:
parent
be0e475339
commit
c2f20fdd94
1 changed files with 1 additions and 3 deletions
|
|
@ -146,7 +146,6 @@ sub bindRemote ($$)
|
|||
{
|
||||
my ($in_remotehost, $in_remoteport) = @_;
|
||||
my $proto = getprotobyname('tcp');
|
||||
my $sockaddr;
|
||||
my $that;
|
||||
my ($name, $aliases,$type,$len,$thataddr) = gethostbyname($in_remotehost);
|
||||
|
||||
|
|
@ -154,8 +153,7 @@ sub bindRemote ($$)
|
|||
print "IRCD UNKNOWN: Could not start socket ($!)\n";
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
}
|
||||
$sockaddr = 'S n a4 x8';
|
||||
$that = pack($sockaddr, AF_INET, $in_remoteport, $thataddr);
|
||||
$that = pack_sockaddr_in ($in_remoteport, $thataddr);
|
||||
if (!connect(ClientSocket, $that)) {
|
||||
print "IRCD UNKNOWN: Could not connect socket ($!)\n";
|
||||
exit $ERRORS{"UNKNOWN"};
|
||||
|
|
|
|||
Loading…
Reference in a new issue