Merge pull request #1932 from RincewindsHat/check-ircd-pack-sockaddr

use pack_sockaddr_in rather than hand-rolled
This commit is contained in:
Lorenz Kästle 2023-10-06 11:39:32 +02:00 committed by GitHub
commit 2a7ee15b70
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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"};