diff options
author | Doug Barton <dougb@FreeBSD.org> | 2009-03-06 09:06:13 +0000 |
---|---|---|
committer | Doug Barton <dougb@FreeBSD.org> | 2009-03-06 09:06:13 +0000 |
commit | 80826c19a2dcf6ca6b0438d1d78da3759f35af72 (patch) | |
tree | 83cfbc83d40c978583d4867980bda23686da1991 /irc/sirc/files | |
parent | c386334b8700207b4fbb215a4ab6b6b769fb8ff1 (diff) |
Notes
Diffstat (limited to 'irc/sirc/files')
-rw-r--r-- | irc/sirc/files/dsirc-ipv6 | 107 | ||||
-rw-r--r-- | irc/sirc/files/dsirc-minimal | 39 | ||||
-rw-r--r-- | irc/sirc/files/patch-ssfe.c | 18 | ||||
-rw-r--r-- | irc/sirc/files/pkg-message-socks | 12 |
4 files changed, 176 insertions, 0 deletions
diff --git a/irc/sirc/files/dsirc-ipv6 b/irc/sirc/files/dsirc-ipv6 new file mode 100644 index 000000000000..db1d50806d6e --- /dev/null +++ b/irc/sirc/files/dsirc-ipv6 @@ -0,0 +1,107 @@ +--- dsirc.orig 1998-03-10 04:55:50.000000000 -0800 ++++ dsirc 2009-03-05 00:34:19.000000000 -0800 +@@ -52,6 +52,7 @@ + } + + if ($] >= 5 && (eval "use Socket;", $@ eq '')) { ++ use Socket6; + } elsif (-f "$libdir/sircsock.ph") { + do "$libdir/sircsock.ph"; + } elsif (-f $ENV{'HOME'}."/sircsock.ph") { +@@ -95,6 +96,7 @@ + $restrict=$opt_R; + $set{"LOCALHOST"}=$opt_H || $ENV{"SIRCHOST"} || $ENV{"IRCHOST"} || + $ENV{"LOCALHOST"} || ""; ++$use_ipv6=0; # enabled when the given server gets resolved by gethostbyname2 + + if ($set{"LOCALHOST"}) { + $bindaddr=&resolve($set{"LOCALHOST"}); +@@ -148,7 +150,16 @@ + } elsif ($_[0] =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/) { + return pack("c4", $1, $2, $3, $4); + } else { +- return (gethostbyname($_[0]))[4]; ++ local $rc; ++ ++ $rc = (gethostbyname2($_[0], AF_INET6))[4]; ++ ++ if ($rc) { ++ $use_ipv6 = 1; ++ return $rc; ++ } else { ++ return (gethostbyname($_[0]))[4]; ++ } + } + } + +@@ -162,19 +173,31 @@ + local($fh, $host, $port)=@_; + local($adr, $otherend)=&resolve($host); + &tell("*\cbE\cb* Hostname `$host' not found"), return 0 unless $adr; +- $otherend=pack("S n a4 x8", &AF_INET, $port, $adr); +- &print("*\cbE\cb* Out of file descriptors"), return 0 +- unless socket($fh, &PF_INET, &SOCK_STREAM, 0); +- if ($set{"LOCALHOST"}) { +- bind($fh, pack("S n a4 x8", &AF_INET, 0, $bindaddr)) || +- &tell("*\cbE\cb* Warning: can't bind to sirc host ".$set{'LOCALHOST'}); ++ if ($use_ipv6) { ++ $otherend=pack_sockaddr_in6($port, $adr); ++ &print("*\cbE\cb* Out of file descriptors"), return 0 ++ unless socket($fh, &PF_INET6, &SOCK_STREAM, 0); ++ } else { ++ $otherend=pack_sockaddr_in($port, $adr); ++ &print("*\cbE\cb* Out of file descriptors"), return 0 ++ unless socket($fh, &PF_INET, &SOCK_STREAM, 0); ++ } ++ if (! $use_ipv6) { ++ if ($set{"LOCALHOST"}) { ++ bind($fh, pack("S n a4 x8", &AF_INET, 0, $bindaddr)) || ++ &tell("*\cbE\cb* Warning: can't bind to sirc host ".$set{'LOCALHOST'}); ++ } + } + $trysock=$fh; + $SIG{'QUIT'}='sigquit'; + &print("*\cbE\cb* Can't connect to host: $!"), close $fh, + $SIG{'QUIT'}='IGNORE', return 0 unless connect($fh, $otherend); + $SIG{'QUIT'}='IGNORE'; +- $bindaddr=(unpack("S n a4", getsockname($fh)))[2] if !$bindaddr; ++ if ($use_ipv6) { ++ $bindaddr=(unpack_sockaddr_in6(getsockname($fh)))[2] if !$bindaddr; ++ } else { ++ $bindaddr=(unpack_sockaddr_in(getsockname($fh)))[2] if !$bindaddr; ++ } + select($fh); $|=1; select(STDOUT); + return 1; + } +@@ -183,15 +206,26 @@ + $_[0]=&newfh; + local($fh, $port)=@_; + local($thisend); +- $bindaddr=pack("x4", 0) unless $bindaddr; +- $thisend=pack("S n a4 x8", &AF_INET, $port+0, $bindaddr); +- &tell("*\cbE\cb* Out of file descriptors"), return 0 +- unless socket($fh, &PF_INET, &SOCK_STREAM, 0); ++ if ($use_ipv6) { ++ $bindaddr=pack_sockaddr_in6(0, 0) unless $bindaddr; ++ $thisend=pack_sockaddr_in6($port+0, $bindaddr); ++ &tell("*\cbE\cb* Out of file descriptors"), return 0 ++ unless socket($fh, &PF_INET6, &SOCK_STREAM, 0); ++ } else { ++ $bindaddr=pack_sockaddr_in(0, 0) unless $bindaddr; ++ $thisend=pack_sockaddr_in($port+0, $bindaddr); ++ &tell("*\cbE\cb* Out of file descriptors"), return 0 ++ unless socket($fh, &PF_INET, &SOCK_STREAM, 0); ++ } + &tell("*\cbE\cb* Can't bind local socket!"), close $fh, return 0 + unless bind($fh, $thisend); + &tell("*\cbE\cb* Can't listen to socket!"), close $fh, return + unless listen($fh, 5); +- return (unpack("S n", getsockname($fh)))[1]; ++ if ($use_ipv6) { ++ return (unpack_sockaddr_in6(getsockname($fh)))[1]; ++ } else { ++ return (unpack_sockaddr_in(getsockname($fh)))[1]; ++ } + } + + sub accept { diff --git a/irc/sirc/files/dsirc-minimal b/irc/sirc/files/dsirc-minimal new file mode 100644 index 000000000000..82eb44b8646d --- /dev/null +++ b/irc/sirc/files/dsirc-minimal @@ -0,0 +1,39 @@ +--- dsirc.orig 1998-03-10 04:55:50.000000000 -0800 ++++ dsirc 2009-03-06 00:15:29.000000000 -0800 +@@ -162,7 +162,7 @@ + local($fh, $host, $port)=@_; + local($adr, $otherend)=&resolve($host); + &tell("*\cbE\cb* Hostname `$host' not found"), return 0 unless $adr; +- $otherend=pack("S n a4 x8", &AF_INET, $port, $adr); ++ $otherend=pack_sockaddr_in($port, $adr); + &print("*\cbE\cb* Out of file descriptors"), return 0 + unless socket($fh, &PF_INET, &SOCK_STREAM, 0); + if ($set{"LOCALHOST"}) { +@@ -174,7 +174,7 @@ + &print("*\cbE\cb* Can't connect to host: $!"), close $fh, + $SIG{'QUIT'}='IGNORE', return 0 unless connect($fh, $otherend); + $SIG{'QUIT'}='IGNORE'; +- $bindaddr=(unpack("S n a4", getsockname($fh)))[2] if !$bindaddr; ++ $bindaddr=(unpack_sockaddr_in(getsockname($fh)))[2] if !$bindaddr; + select($fh); $|=1; select(STDOUT); + return 1; + } +@@ -183,15 +183,15 @@ + $_[0]=&newfh; + local($fh, $port)=@_; + local($thisend); +- $bindaddr=pack("x4", 0) unless $bindaddr; +- $thisend=pack("S n a4 x8", &AF_INET, $port+0, $bindaddr); ++ $bindaddr=pack_sockaddr_in(0, 0) unless $bindaddr; ++ $thisend=pack_sockaddr_in($port+0, $bindaddr); + &tell("*\cbE\cb* Out of file descriptors"), return 0 + unless socket($fh, &PF_INET, &SOCK_STREAM, 0); + &tell("*\cbE\cb* Can't bind local socket!"), close $fh, return 0 + unless bind($fh, $thisend); + &tell("*\cbE\cb* Can't listen to socket!"), close $fh, return + unless listen($fh, 5); +- return (unpack("S n", getsockname($fh)))[1]; ++ return (unpack_sockaddr_in(getsockname($fh)))[1]; + } + + sub accept { diff --git a/irc/sirc/files/patch-ssfe.c b/irc/sirc/files/patch-ssfe.c new file mode 100644 index 000000000000..63abe4e22d9c --- /dev/null +++ b/irc/sirc/files/patch-ssfe.c @@ -0,0 +1,18 @@ +--- ssfe.c.orig 1998-03-10 04:55:53.000000000 -0800 ++++ ssfe.c 2009-03-04 22:46:01.000000000 -0800 +@@ -23,6 +23,7 @@ + #include <fcntl.h> + #include <unistd.h> + #include <signal.h> ++#include <string.h> + #include <errno.h> + + #ifdef USE_SGTTY +@@ -106,7 +107,6 @@ + int ansi_cs = 0; + + fd_set ready, result; +-extern int errno; + + #ifdef __GNUC__ + extern unsigned char *tgoto(unsigned char *cm, int col, int line); diff --git a/irc/sirc/files/pkg-message-socks b/irc/sirc/files/pkg-message-socks new file mode 100644 index 000000000000..c8dcaf6086b5 --- /dev/null +++ b/irc/sirc/files/pkg-message-socks @@ -0,0 +1,12 @@ + +*************************************************************************** + SOCKS support has been added. To take advantage of it you + must add the following to ~/.sircrc.pl: + +$ENV{"SOCKS_SERVER"} = # You must set this +# $ENV{"SOCKS_PORT"} = 1080 # This is the default +# $ENV{"SOCKS_DNS"} = 1 # For DNS through the proxy + +&load("socks.pl"); +*************************************************************************** + |