70 lines
2.5 KiB
Plaintext
70 lines
2.5 KiB
Plaintext
# $NetBSD: patch-ad,v 1.5 1999/12/28 18:15:43 itojun Exp $
|
|
# $OpenBSD: patch-lchat-pl,v 1.2 2007/03/20 00:35:52 pvalchev Exp $
|
|
|
|
--- lchat.pl.orig Fri May 29 13:05:46 1998
|
|
+++ lchat.pl Mon Mar 19 18:31:12 2007
|
|
@@ -117,7 +117,7 @@ sub open_port { ## public
|
|
|
|
# We may be multi-homed, start with 0, fixup once connexion is made
|
|
$thisaddr = "\0\0\0\0" ;
|
|
- $thisproc = pack($sockaddr, 2, 0, $thisaddr);
|
|
+ $thisproc = pack_sockaddr_in(0, $thisaddr);
|
|
|
|
if ($server =~ /^(\d+)+\.(\d+)\.(\d+)\.(\d+)$/) {
|
|
$serveraddr = pack('C4', $1, $2, $3, $4);
|
|
@@ -128,7 +128,7 @@ sub open_port { ## public
|
|
}
|
|
$serveraddr = $x[4];
|
|
}
|
|
- $serverproc = pack($sockaddr, 2, $port, $serveraddr);
|
|
+ $serverproc = pack_sockaddr_in($port, $serveraddr);
|
|
unless (socket(S, $main'pf_inet, $main'sock_stream, $main'tcp_proto)) {
|
|
($!) = ($!, close(S)); # close S while saving $!
|
|
return undef;
|
|
@@ -137,12 +137,12 @@ sub open_port { ## public
|
|
# The SOCKS documentation claims that this bind before the connet
|
|
# is unnecessary. Not just, that, but when used with SOCKS,
|
|
# a connect() must not follow a bind(). -Erez Zadok.
|
|
- unless( $using_socks ){
|
|
- unless (bind(S, $thisproc)) {
|
|
- ($!) = ($!, close(S)); # close S while saving $!
|
|
- return undef;
|
|
- }
|
|
- }
|
|
+# unless( $using_socks ){
|
|
+# unless (bind(S, $thisproc)) {
|
|
+# ($!) = ($!, close(S)); # close S while saving $!
|
|
+# return undef;
|
|
+# }
|
|
+# }
|
|
unless (connect(S, $serverproc)) {
|
|
($!) = ($!, close(S)); # close S while saving $!
|
|
return undef;
|
|
@@ -152,7 +152,7 @@ sub open_port { ## public
|
|
# multi-homed, with IP forwarding off, so fix-up.
|
|
local($fam,$lport);
|
|
($fam,$lport,$thisaddr) = unpack($sockaddr, getsockname(S));
|
|
- $thisproc = pack($sockaddr, 2, 0, $thisaddr);
|
|
+ $thisproc = pack_sockaddr_in(0, $thisaddr);
|
|
# end of post-connect fixup
|
|
select((select(S), $| = 1)[0]);
|
|
return 1;
|
|
@@ -167,7 +167,7 @@ sub open_newport { ## public
|
|
|
|
# We may be multi-homed, start with 0, fixup once connexion is made
|
|
$thisaddr = "\0\0\0\0" ;
|
|
- $thisproc = pack($sockaddr, 2, 0, $thisaddr);
|
|
+ $thisproc = pack_sockaddr_in(0, $thisaddr);
|
|
|
|
if ($server =~ /^(\d+)+\.(\d+)\.(\d+)\.(\d+)$/) {
|
|
$serveraddr = pack('C4', $1, $2, $3, $4);
|
|
@@ -189,7 +189,7 @@ sub open_newport { ## public
|
|
# multi-homed, with IP forwarding off, so fix-up.
|
|
local($fam,$lport);
|
|
($fam,$lport,$thisaddr) = unpack($sockaddr, getsockname($newsock));
|
|
- $thisproc = pack($sockaddr, 2, 0, $thisaddr);
|
|
+ $thisproc = pack_sockaddr_in(0, $thisaddr);
|
|
# end of post-connect fixup
|
|
select((select($newsock), $| = 1)[0]);
|
|
return 1;
|