From 0369a5a54628d35a0391b4624eba1887bd5ff71d Mon Sep 17 00:00:00 2001 From: "Paul \\\"LeoNerd\\\" Evans" Date: Tue, 22 Nov 2011 15:11:49 +0000 Subject: Snapshot of P/PE/PEVANS/Socket-1.94_07.tar.gz --- cpan/Socket/Makefile.PL | 13 ++++++++---- cpan/Socket/Socket.pm | 53 ++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 61 insertions(+), 5 deletions(-) (limited to 'cpan') diff --git a/cpan/Socket/Makefile.PL b/cpan/Socket/Makefile.PL index 0667b31023..5518e33f88 100644 --- a/cpan/Socket/Makefile.PL +++ b/cpan/Socket/Makefile.PL @@ -92,9 +92,12 @@ my @names = (qw(AF_802 AF_AAL AF_APPLETALK AF_CCITT AF_CHAOS AF_CTF AF_LAST AF_LAT AF_LINK AF_MAX AF_NBS AF_NIT AF_NS AF_OSI AF_OSINET AF_PUP AF_ROUTE AF_SNA AF_UNIX AF_UNSPEC AF_USER AF_WAN AF_X25 - AI_CANONNAME AI_NUMERICHOST AI_NUMERICSERV AI_PASSIVE - EAI_ADDRFAMILY EAI_AGAIN EAI_BADFLAGS EAI_FAIL EAI_FAMILY - EAI_NODATA EAI_NONAME EAI_SERVICE EAI_SOCKTYPE + AI_ADDRCONFIG AI_ALL AI_CANONIDN AI_CANONNAME AI_IDN + AI_IDN_ALLOW_UNASSIGNED AI_IDN_USE_STD3_ASCII_RULES + AI_NUMERICHOST AI_NUMERICSERV AI_PASSIVE AI_V4MAPPED + EAI_ADDRFAMILY EAI_AGAIN EAI_BADFLAGS EAI_BADHINTS EAI_FAIL + EAI_FAMILY EAI_NODATA EAI_NONAME EAI_PROTOCOL EAI_SERVICE + EAI_SOCKTYPE EAI_SYSTEM IOV_MAX IP_OPTIONS IP_HDRINCL IP_TOS IP_TTL IP_RECVOPTS IP_RECVRETOPTS IP_RETOPTS IPV6_ADD_MEMBERSHIP IPV6_DROP_MEMBERSHIP IPV6_MTU @@ -104,7 +107,9 @@ my @names = (qw(AF_802 AF_AAL AF_APPLETALK AF_CCITT AF_CHAOS AF_CTF MSG_EOF MSG_EOR MSG_ERRQUEUE MSG_ETAG MSG_FIN MSG_MAXIOVLEN MSG_MCAST MSG_NOSIGNAL MSG_RST MSG_SYN MSG_TRUNC MSG_URG MSG_WAITALL MSG_WIRE - NI_DGRAM NI_NAMEREQD NI_NUMERICHOST NI_NUMERICSERV + NI_DGRAM NI_IDN NI_IDN_ALLOW_UNASSIGNED + NI_IDN_USE_STD3_ASCII_RULES NI_NAMEREQD NI_NOFQDN + NI_NUMERICHOST NI_NUMERICSERV PF_802 PF_AAL PF_APPLETALK PF_CCITT PF_CHAOS PF_CTF PF_DATAKIT PF_DECnet PF_DLI PF_ECMA PF_GOSIP PF_HYLINK PF_IMPLINK PF_INET PF_INET6 PF_ISO PF_KEY diff --git a/cpan/Socket/Socket.pm b/cpan/Socket/Socket.pm index 5fff0d0150..34deb63779 100644 --- a/cpan/Socket/Socket.pm +++ b/cpan/Socket/Socket.pm @@ -3,7 +3,7 @@ package Socket; use strict; our($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS); -$VERSION = "1.94_03"; +$VERSION = "1.94_07"; =head1 NAME @@ -506,20 +506,30 @@ require XSLoader; IN6ADDR_ANY IN6ADDR_LOOPBACK + AI_ADDRCONFIG + AI_ALL + AI_CANONIDN AI_CANONNAME + AI_IDN + AI_IDN_ALLOW_UNASSIGNED + AI_IDN_USE_STD3_ASCII_RULES AI_NUMERICHOST AI_NUMERICSERV AI_PASSIVE + AI_V4MAPPED EAI_ADDRFAMILY EAI_AGAIN EAI_BADFLAGS + EAI_BADHINTS EAI_FAIL EAI_FAMILY EAI_NODATA EAI_NONAME + EAI_PROTOCOL EAI_SERVICE EAI_SOCKTYPE + EAI_SYSTEM IPPROTO_IP IPPROTO_IPV6 @@ -539,7 +549,11 @@ require XSLoader; IPV6_V6ONLY NI_DGRAM + NI_IDN + NI_IDN_ALLOW_UNASSIGNED + NI_IDN_USE_STD3_ASCII_RULES NI_NAMEREQD + NI_NOFQDN NI_NUMERICHOST NI_NUMERICSERV @@ -634,6 +648,9 @@ if( defined &getaddrinfo ) { AI_PASSIVE => 1, AI_CANONNAME => 2, AI_NUMERICHOST => 4, + AI_V4MAPPED => 8, + AI_ALL => 16, + AI_ADDRCONFIG => 32, # RFC 2553 doesn't define this but Linux does - lets be nice and # provide it since we can AI_NUMERICSERV => 1024, @@ -646,8 +663,25 @@ if( defined &getaddrinfo ) { NI_NUMERICHOST => 1, NI_NUMERICSERV => 2, + NI_NOFQDN => 4, NI_NAMEREQD => 8, NI_DGRAM => 16, + + # Constants we don't support. Export them, but croak if anyone tries to + # use them + AI_IDN => 64, + AI_CANONIDN => 128, + AI_IDN_ALLOW_UNASSIGNED => 256, + AI_IDN_USE_STD3_ASCII_RULES => 512, + NI_IDN => 32, + NI_IDN_ALLOW_UNASSIGNED => 64, + NI_IDN_USE_STD3_ASCII_RULES => 128, + + # Error constants we'll never return, so it doesn't matter what value + # these have, nor that we don't provide strings for them + EAI_SYSTEM => -11, + EAI_BADHINTS => -1000, + EAI_PROTOCOL => -1001 ); foreach my $name ( keys %constants ) { @@ -706,6 +740,14 @@ sub fake_getaddrinfo my $flag_numerichost = $flags & AI_NUMERICHOST(); $flags &= ~AI_NUMERICHOST(); my $flag_numericserv = $flags & AI_NUMERICSERV(); $flags &= ~AI_NUMERICSERV(); + # These constants don't apply to AF_INET-only lookups, so we might as well + # just ignore them. For AI_ADDRCONFIG we just presume the host has ability + # to talk AF_INET. If not we'd have to return no addresses at all. :) + $flags &= ~(AI_V4MAPPED()|AI_ALL()|AI_ADDRCONFIG()); + + $flags & (AI_IDN()|AI_CANONIDN()|AI_IDN_ALLOW_UNASSIGNED()|AI_IDN_USE_STD3_ASCII_RULES()) and + croak "Socket::getaddrinfo() does not support IDN"; + $flags == 0 or return fake_makeerr( EAI_BADFLAGS() ); $node eq "" and $service eq "" and return fake_makeerr( EAI_NONAME() ); @@ -797,9 +839,13 @@ sub fake_getnameinfo my $flag_numerichost = $flags & NI_NUMERICHOST(); $flags &= ~NI_NUMERICHOST(); my $flag_numericserv = $flags & NI_NUMERICSERV(); $flags &= ~NI_NUMERICSERV(); + my $flag_nofqdn = $flags & NI_NOFQDN(); $flags &= ~NI_NOFQDN(); my $flag_namereqd = $flags & NI_NAMEREQD(); $flags &= ~NI_NAMEREQD(); my $flag_dgram = $flags & NI_DGRAM() ; $flags &= ~NI_DGRAM(); + $flags & (NI_IDN()|NI_IDN_ALLOW_UNASSIGNED()|NI_IDN_USE_STD3_ASCII_RULES()) and + croak "Socket::getnameinfo() does not support IDN"; + $flags == 0 or return fake_makeerr( EAI_BADFLAGS() ); my $node; @@ -812,6 +858,11 @@ sub fake_getnameinfo return fake_makeerr( EAI_NONAME() ) if $flag_namereqd; $node = Socket::inet_ntoa( $inetaddr ); } + elsif( $flag_nofqdn ) { + my ( $shortname ) = split m/\./, $node; + my ( $fqdn ) = gethostbyname $shortname; + $node = $shortname if defined $fqdn and $fqdn eq $node; + } } my $service; -- cgit v1.2.1