diff options
author | Jasper Lievisse Adriaanse <jasper@cvs.openbsd.org> | 2014-09-05 06:53:08 +0000 |
---|---|---|
committer | Jasper Lievisse Adriaanse <jasper@cvs.openbsd.org> | 2014-09-05 06:53:08 +0000 |
commit | 8f145aa3f421c1f0b786a72f68ac6b0ceb8715e2 (patch) | |
tree | e97265696ef647518b670989da2044386f25681f /gnu/usr.bin/perl | |
parent | de2d3439cb5bba4e2015e395bc98119a3706256b (diff) |
update libnet to 1.27; various bugfixes and improvements:
http://cpansearch.perl.org/src/SHAY/libnet-1.27/Changes
ok millert@
Diffstat (limited to 'gnu/usr.bin/perl')
27 files changed, 661 insertions, 350 deletions
diff --git a/gnu/usr.bin/perl/cpan/libnet/Changes b/gnu/usr.bin/perl/cpan/libnet/Changes index ff26b1d8cc0..279ad6d0ac0 100644 --- a/gnu/usr.bin/perl/cpan/libnet/Changes +++ b/gnu/usr.bin/perl/cpan/libnet/Changes @@ -1,3 +1,75 @@ +libnet 1.27 -- Fri May 30 2014 + + * Simplified Makefile.PL requirements. + +libnet 1.26 -- Fri May 30 2014 + + * Set minimum required ExtUtils::MakeMaker version to 6.64 to ensure that all + parameters used are supported, to save jumping through hoops to support + earlier versions. (This should not be a problem since ExtUtils::MakeMaker + 6.64 is easily installed into Perl 5.8.1 and above, that being the whole + point of the new choice of minimum supported Perl version.) + * Set minimum required Perl version to 5.8.1. This is in line with the + minimum requirement of the "Perl Toolchain". + +libnet 1.25 -- Tue Feb 04 2014 + + * Fix Net::FTP::pasv_wait() not handling errors from Net::Cmd::reponse() + [bergner@cs.umu.se; resolves CPAN RT#50420] + * Make inheritance from Net::Cmd clearer in the documentation [Resolves CPAN + RT#72889] + * Set timeout for data connection creation in Net::FTP [Oleg G; resolves CPAN + RT#78926] + * Stop Net::Domain::domainname() from giving out warnings in android [Brian + Fraser] + +libnet 1.24 -- Mon Jan 06 2014 + + * Fix incorrect handling of CRLF in Net::FTP [Willem Monsuwé; resolves CPAN + RT#41642/62029] + * POD fixes [Dominic Hargreaves; resolves CPAN RT#91761] + +libnet 1.23 -- Mon Aug 12 2013 + + * Typo fixes [David Steinbrunner; resolves CPAN RT#87681] + +libnet 1.22_02 -- Thu Aug 08 2013 + + * Make Net::FTP::dataconn::close() more robust [Together with changes to + Net::FTP already made in 1.22_01, this resolves CPAN RT#37700] + * Document scalar/list context return values from Net::Cmd::message() + * Fix broken URL [Resolves CPAN RT#68749] + * Fix documentation typo in Net::Netrc + * Fix broken POD in Net::POP3 + * Improve Net::SMTP documentation of new(), auth() and message() [Resolves + CPAN RT#36038] + * Add proper skips to skipped tests in ftp.t + * Import hostname.t fix from perl core commit #adeb94125a + * Add time.t, imported from perl core commit #c85707204c + * Add new maintainer information, with updated CPAN and GitHub links + +libnet 1.22_01 -- Mon May 31 09:40:25 CDT 2010 + + * Do not create/pass a remote name if one is not given to put_unique + * Add ->passive method to switch between PORT/PASV connections + * Accept - in command parsed from SMTP HELO response + * Allow group to set to a group named "0" + * Set $@ when ->new returns undef + * Add support for LocalAddr to be passed to ->new + * Document that timeout is in seconds + * Fix leading . encoding in datasend + * Make ->supported check ->feature + * Allow words other than FILE to prefix the unique name returned in info message from stou + * Send ALLO command just before the store command + * Avoid warnings when server do not prefix messages with codes + * Use uppercase characters for xtext encoding + * Catch timeout condition while doing an abort + * Ensure REST is sent directly before command being restarted + * [rt.cpan.org #49920] Fix URL [Leon Brocard] + * Avoid long hang on Mac OS X when hostname is *.local by not calling gethostbyname [Father Chrysostomos] + * Avoid infinite recursion in rmdir + * Allow finding _netrc on machines that do not support .netrc [Ben Bimber] + libnet 1.22 -- Sun Aug 26 07:13:18 CDT 2007 Bug Fixes diff --git a/gnu/usr.bin/perl/cpan/libnet/Config.eg b/gnu/usr.bin/perl/cpan/libnet/Config.eg index 77dc1f138b8..820231537df 100644 --- a/gnu/usr.bin/perl/cpan/libnet/Config.eg +++ b/gnu/usr.bin/perl/cpan/libnet/Config.eg @@ -13,37 +13,37 @@ use strict; # Below this line is auto-generated, *ANY* changes will be lost %NetConfig = ( - # the followinf parameters are all lists of hosts for the - # respective protocols. - nntp_hosts => [], - snpp_hosts => [], - pop3_hosts => [], - smtp_hosts => [], - ph_hosts => [], - daytime_hosts => [], - time_hosts => [], - - # your internet domain - inet_domain => undef, - - # If you have an ftp proxy firewall (not an http firewall) - # then set this to the name of the firewall - ftp_firewall => undef, - - # set if all connections done via the firewall should use - # passive data connections - ftp_ext_passive => 0, - - # set if all connections not done via the firewall should use - # passive data connections - ftp_int_passive => 0, - - # If set the make test will attempt to connect to the hosts above - test_hosts => 0, - - # Used during Configure (which you are not using) to do - # DNS lookups to ensure hosts exist - test_exist => 0, + # the followinf parameters are all lists of hosts for the + # respective protocols. + nntp_hosts => [], + snpp_hosts => [], + pop3_hosts => [], + smtp_hosts => [], + ph_hosts => [], + daytime_hosts => [], + time_hosts => [], + + # your internet domain + inet_domain => undef, + + # If you have an ftp proxy firewall (not an http firewall) + # then set this to the name of the firewall + ftp_firewall => undef, + + # set if all connections done via the firewall should use + # passive data connections + ftp_ext_passive => 0, + + # set if all connections not done via the firewall should use + # passive data connections + ftp_int_passive => 0, + + # If set the make test will attempt to connect to the hosts above + test_hosts => 0, + + # Used during Configure (which you are not using) to do + # DNS lookups to ensure hosts exist + test_exist => 0, ); 1; diff --git a/gnu/usr.bin/perl/cpan/libnet/Makefile.PL b/gnu/usr.bin/perl/cpan/libnet/Makefile.PL index 92c7d5facd6..7e21e3c61cd 100644 --- a/gnu/usr.bin/perl/cpan/libnet/Makefile.PL +++ b/gnu/usr.bin/perl/cpan/libnet/Makefile.PL @@ -1,10 +1,151 @@ +#!perl +#=============================================================================== +# +# Makefile.PL +# +# DESCRIPTION +# Makefile creation script. +# +# COPYRIGHT +# Copyright (C) 2014 Steve Hay. All rights reserved. +# +# LICENCE +# You may distribute under the terms of either the GNU General Public License +# or the Artistic License, as specified in the LICENCE file. +# +#=============================================================================== + +use 5.008001; + use strict; -use ExtUtils::MakeMaker; - -WriteMakefile ( - NAME => 'Net', - DISTNAME => 'libnet', - VERSION => '1.22', # finds $VERSION - AUTHOR => 'Graham Barr <gbarr@pobox.com>', - ABSTRACT => 'Collection of Network protocol modules', -); +use warnings; + +use ExtUtils::MakeMaker 6.64; +use ExtUtils::MakeMaker qw(WriteMakefile); + +#=============================================================================== +# INITIALIZATION +#=============================================================================== + +our($CfgFile, $CfgPath); + +BEGIN { + $CfgFile = 'libnet.cfg'; + $CfgPath = "Net/$CfgFile"; +} + +#=============================================================================== +# MAIN PROGRAM +#=============================================================================== + +MAIN: { + my %prereq_pms = (); + $prereq_pms{'Convert::EBCDIC'} = '0.06' if $^O eq 'os390'; + + WriteMakefile( + NAME => 'Net', + DISTNAME => 'libnet', + ABSTRACT => 'Collection of network protocol modules', + AUTHOR => 'Graham Barr <gbarr@pobox.com>, Steve Hay <shay@cpan.org>', + LICENSE => 'perl_5', + VERSION => '1.27', + + META_MERGE => { + 'meta-spec' => { + version => 2 + }, + + resources => { + repository => { + type => 'git', + url => 'https://github.com/steve-m-hay/perl-libnet.git' + } + }, + + optional_features => { + APOP => { + description => 'APOP support', + prereqs => { + runtime => { + requires => { + 'Digest::MD5' => '0' + } + } + } + }, + + AUTH => { + description => 'AUTH support', + prereqs => { + runtime => { + requires => { + 'Authen::SASL' => '0', + 'MIME::Base64' => '0' + } + } + } + } + } + }, + + MIN_PERL_VERSION => '5.008001', + + CONFIGURE_REQUIRES => { + 'ExtUtils::MakeMaker' => '6.64', + 'Getopt::Std' => '0', + 'IO:File' => '0', + 'perl' => '5.008001', + 'strict' => '0', + 'vars' => '0', + 'warnings' => '0' + }, + + TEST_REQUIRES => { + 'Cwd' => '0' + }, + + PREREQ_PM => { + %prereq_pms, + 'Carp' => '0', + 'Errno' => '0', + 'Exporter' => '0', + 'Fcntl' => '0', + 'File::Basename' => '0', + 'FileHandle' => '0', + 'IO::Select' => '0', + 'IO::Socket' => '1.05', + 'POSIX' => '0', + 'Socket' => '1.3', + 'Symbol' => '0', + 'Time::Local' => '0', + 'strict' => '0', + 'vars' => '0' + }, + + INSTALLDIRS => 'perl', + + realclean => { + FILES => $CfgFile + }, + + dist => { + PREOP => 'find $(DISTVNAME) -type d -print|xargs chmod 0755 && ' . + 'find $(DISTVNAME) -type f -print|xargs chmod 0644', + TO_UNIX => 'find $(DISTVNAME) -type f -print|xargs dos2unix' + } + ); +} + +#=============================================================================== +# MAKEMAKER OVERRIDES +#=============================================================================== + +sub MY::post_initialize { + my $self = shift; + return '' if $self->{PERL_CORE}; + system(($^O eq 'VMS' ? 'mcr ': ()), $^X, 'Configure') unless -f $CfgFile; + $self->{PM}{$CfgFile} = $self->catfile('$(INST_LIBDIR)',$CfgPath); + return ''; +} + +#=============================================================================== diff --git a/gnu/usr.bin/perl/cpan/libnet/Net/Cmd.pm b/gnu/usr.bin/perl/cpan/libnet/Net/Cmd.pm index 4f0e4449f80..d1a1fed8af2 100644 --- a/gnu/usr.bin/perl/cpan/libnet/Net/Cmd.pm +++ b/gnu/usr.bin/perl/cpan/libnet/Net/Cmd.pm @@ -37,7 +37,7 @@ BEGIN { } } -$VERSION = "2.29"; +$VERSION = "2.30"; @ISA = qw(Exporter); @EXPORT = qw(CMD_INFO CMD_OK CMD_MORE CMD_REJECT CMD_ERROR CMD_PENDING); @@ -353,6 +353,7 @@ sub response { ($code, $more) = $cmd->parse_response($str); unless (defined $code) { $cmd->ungetline($str); + $@ = $str; # $@ used as tunneling hack last; } @@ -363,6 +364,7 @@ sub response { last unless ($more); } + return undef unless defined $code; substr($code, 0, 1); } @@ -406,6 +408,8 @@ sub datasend { return 0 unless defined(fileno($cmd)); my $last_ch = ${*$cmd}{'net_cmd_last_ch'}; + + # We have not send anything yet, so last_ch = "\012" means we are at the start of a line $last_ch = ${*$cmd}{'net_cmd_last_ch'} = "\012" unless defined $last_ch; return 1 unless length $line; @@ -421,9 +425,13 @@ sub datasend { my $first_ch = ''; if ($last_ch eq "\015") { - $first_ch = "\012" if $line =~ s/^\012//; + # Remove \012 so it does not get prefixed with another \015 below + # and escape the . if there is one following it because the fixup + # below will not find it + $first_ch = "\012" if $line =~ s/^\012(\.?)/$1$1/; } elsif ($last_ch eq "\012") { + # Fixup below will not find the . as the first character of the buffer $first_ch = "." if $line =~ /^\./; } @@ -649,7 +657,9 @@ debug level for a given class. =item message () -Returns the text message returned from the last command +Returns the text message returned from the last command. In a scalar +context it returns a single string, in a list context it will return +each line as a separate element =item code () diff --git a/gnu/usr.bin/perl/cpan/libnet/Net/Config.pm b/gnu/usr.bin/perl/cpan/libnet/Net/Config.pm index db51c1fc0d2..f9d04e13432 100644 --- a/gnu/usr.bin/perl/cpan/libnet/Net/Config.pm +++ b/gnu/usr.bin/perl/cpan/libnet/Net/Config.pm @@ -13,7 +13,7 @@ use strict; @EXPORT = qw(%NetConfig); @ISA = qw(Net::LocalCfg Exporter); -$VERSION = "1.11"; +$VERSION = "1.14"; eval { local $SIG{__DIE__}; require Net::LocalCfg }; @@ -49,9 +49,9 @@ my %nc = ( ftp_ext_passive => \$InternetConfig{"646F676F\xA5UsePassiveMode"} || 0, ftp_int_passive => \$InternetConfig{"646F676F\xA5UsePassiveMode"} || 0, socks_hosts => - \$InternetConfig{ kICUseSocks() } ? [ \$InternetConfig{ kICSocksHost() } ] : [], + \$InternetConfig{ kICUseSocks() } ? [ \$InternetConfig{ kICSocksHost() } ] : [], ftp_firewall => - \$InternetConfig{ kICUseFTPProxy() } ? [ \$InternetConfig{ kICFTPProxyHost() } ] : [], + \$InternetConfig{ kICUseFTPProxy() } ? [ \$InternetConfig{ kICFTPProxyHost() } ] : [], ); \@NetConfig{keys %nc} = values %nc; } @@ -141,7 +141,7 @@ For example # .libnetrc { nntp_hosts => [ "my_preferred_host" ], - ph_hosts => [ "my_ph_server" ], + ph_hosts => [ "my_ph_server" ], } __END__ @@ -213,23 +213,23 @@ sequence of commands that Net::FTP will use =over 4 -=item 0 +=item 0Z<> There is no firewall -=item 1 +=item 1Z<> USER user@remote.host PASS pass -=item 2 +=item 2Z<> USER fwuser PASS fwpass USER user@remote.host PASS pass -=item 3 +=item 3Z<> USER fwuser PASS fwpass @@ -237,7 +237,7 @@ There is no firewall USER user PASS pass -=item 4 +=item 4Z<> USER fwuser PASS fwpass @@ -245,19 +245,19 @@ There is no firewall USER user PASS pass -=item 5 +=item 5Z<> USER user@fwuser@remote.site PASS pass@fwpass -=item 6 +=item 6Z<> USER fwuser@remote.site PASS fwpass USER user PASS pass -=item 7 +=item 7Z<> USER user@remote.host PASS pass @@ -274,7 +274,7 @@ FTP servers can work in passive or active mode. Active mode is when you want to transfer data you have to tell the server the address and port to connect to. Passive mode is when the server provide the address and port and you establish the connection. - + With some firewalls active mode does not work as the server cannot connect to your machine (because you are behind a firewall) and the firewall does not re-write the command. In this case you should set C<ftp_ext_passive> diff --git a/gnu/usr.bin/perl/cpan/libnet/Net/Domain.pm b/gnu/usr.bin/perl/cpan/libnet/Net/Domain.pm index 330909da49d..5b964c3d5fa 100644 --- a/gnu/usr.bin/perl/cpan/libnet/Net/Domain.pm +++ b/gnu/usr.bin/perl/cpan/libnet/Net/Domain.pm @@ -16,7 +16,7 @@ use Net::Config; @ISA = qw(Exporter); @EXPORT_OK = qw(hostname hostdomain hostfqdn domainname); -$VERSION = "2.20"; +$VERSION = "2.23"; my ($host, $domain, $fqdn) = (undef, undef, undef); @@ -169,7 +169,7 @@ sub _hostdomain { } chop($dom = `domainname 2>/dev/null`) - unless (defined $dom || $^O =~ /^(?:cygwin|MSWin32)/); + unless (defined $dom || $^O =~ /^(?:cygwin|MSWin32|android)/); if (defined $dom) { my @h = (); @@ -222,12 +222,19 @@ sub domainname { if (defined $fqdn); _hostname(); + + # *.local names are special on darwin. If we call gethostbyname below, it + # may hang while waiting for another, non-existent computer to respond. + if($^O eq 'darwin' && $host =~ /\.local$/) { + return $host; + } + _hostdomain(); # Assumption: If the host name does not contain a period # and the domain name does, then assume that they are correct # this helps to eliminate calls to gethostbyname, and therefore - # eleminate DNS lookups + # eliminate DNS lookups return $fqdn = $host . "." . $domain if (defined $host diff --git a/gnu/usr.bin/perl/cpan/libnet/Net/FTP.pm b/gnu/usr.bin/perl/cpan/libnet/Net/FTP.pm index 9ed6d385d9c..8107ef77e65 100644 --- a/gnu/usr.bin/perl/cpan/libnet/Net/FTP.pm +++ b/gnu/usr.bin/perl/cpan/libnet/Net/FTP.pm @@ -21,11 +21,11 @@ use Net::Cmd; use Net::Config; use Fcntl qw(O_WRONLY O_RDONLY O_APPEND O_CREAT O_TRUNC); -$VERSION = '2.77'; +$VERSION = '2.79'; @ISA = qw(Exporter Net::Cmd IO::Socket::INET); # Someday I will "use constant", when I am not bothered to much about -# compatability with older releases of perl +# compatibility with older releases of perl use vars qw($TELNET_IAC $TELNET_IP $TELNET_DM); ($TELNET_IAC, $TELNET_IP, $TELNET_DM) = (255, 244, 242); @@ -107,7 +107,8 @@ sub new { unless ($ftp->response() == CMD_OK) { $ftp->close(); - $@ = $ftp->message; + # keep @$ if no message. Happens, when response did not start with a code. + $@ = $ftp->message || $@; undef $ftp; } @@ -124,6 +125,12 @@ sub host { ${*$me}{'net_ftp_host'}; } +sub passive { + my $ftp = shift; + return ${*$ftp}{'net_ftp_passive'} unless @_; + ${*$ftp}{'net_ftp_passive'} = shift; +} + sub hash { my $ftp = shift; # self @@ -583,6 +590,9 @@ sub rmdir { return undef unless @filelist; # failed, it is probably not a directory + return $ftp->delete($dir) + if @filelist == 1 and $dir eq $filelist[0]; + # Go thru and delete each file or the directory my $file; foreach $file (map { m,/, ? $_ : "$dir/$_" } @filelist) { @@ -688,7 +698,7 @@ sub _store_cmd { my $localfd = ref($local) || ref(\$local) eq "GLOB"; - unless (defined $remote) { + if (!defined($remote) and 'STOU' ne uc($cmd)) { croak 'Must specify remote filename with stream input' if $localfd; @@ -705,10 +715,10 @@ sub _store_cmd { # a pipe, or device) and if so get the file size from stat, and send # an ALLO command before sending the STOR, STOU, or APPE command. my $size = do { local $^W; -f $local && -s _ }; # no ALLO if sending data from a pipe - $ftp->_ALLO($size) if $size; + ${*$ftp}{'net_ftp_allo'} = $size if $size; } croak("Bad remote filename '$remote'\n") - if $remote =~ /[\r\n]/s; + if defined($remote) and $remote =~ /[\r\n]/s; if ($localfd) { $loc = $local; @@ -730,10 +740,10 @@ sub _store_cmd { delete ${*$ftp}{'net_ftp_port'}; delete ${*$ftp}{'net_ftp_pasv'}; - $sock = $ftp->_data_cmd($cmd, $remote) + $sock = $ftp->_data_cmd($cmd, grep { defined } $remote) or return undef; - $remote = ($ftp->message =~ /FILE:\s*(.*)/)[0] + $remote = ($ftp->message =~ /\w+\s*:\s*(.*)/)[0] if 'STOU' eq uc $cmd; my $blksize = ${*$ftp}{'net_ftp_blksize'}; @@ -852,6 +862,9 @@ sub supported { return $hash->{$cmd} if exists $hash->{$cmd}; + return $hash->{$cmd} = 1 + if $ftp->feature($cmd); + return $hash->{$cmd} = 0 unless $ftp->_HELP($cmd); @@ -930,7 +943,8 @@ sub _dataconn { PeerAddr => join(".", @port[0 .. 3]), PeerPort => $port[4] * 256 + $port[5], LocalAddr => ${*$ftp}{'net_ftp_localaddr'}, - Proto => 'tcp' + Proto => 'tcp', + Timeout => $ftp->timeout ); } elsif (defined ${*$ftp}{'net_ftp_listen'}) { @@ -1005,22 +1019,24 @@ sub _data_cmd { { my $data = undef; - $ok = defined $ftp->pasv; - $ok = $ftp->_REST($where) - if $ok && $where; - - if ($ok) { - $ftp->command($cmd, @_); - $data = $ftp->_dataconn(); - $ok = CMD_INFO == $ftp->response(); - if ($ok) { - $data->reading - if $data && $cmd =~ /RETR|LIST|NLST/; - return $data; - } - $data->_close - if $data; + return undef unless defined $ftp->pasv; + $data = $ftp->_dataconn() or return undef; + + if ($where and !$ftp->_REST($where)) { + my ($status, $message) = ($ftp->status, $ftp->message); + $ftp->abort; + $ftp->set_status($status, $message); + return undef; + } + + $ftp->command($cmd, @_); + if (CMD_INFO == $ftp->response()) { + $data->reading + if $cmd =~ /RETR|LIST|NLST/; + return $data; } + $data->_close; + return undef; } @@ -1034,6 +1050,11 @@ sub _data_cmd { return undef unless $ok; + if ($cmd =~ /(STOR|APPE|STOU)/ and exists ${*$ftp}{net_ftp_allo}) { + $ftp->_ALLO(delete ${*$ftp}{net_ftp_allo}) + or return undef; + } + $ftp->command($cmd, @_); return 1 @@ -1077,7 +1098,7 @@ sub command { sub response { my $ftp = shift; - my $code = $ftp->SUPER::response(); + my $code = $ftp->SUPER::response() || 5; # assume 500 if undef delete ${*$ftp}{'net_ftp_pasv'} if ($code != CMD_MORE && $code != CMD_INFO); @@ -1093,8 +1114,9 @@ sub parse_response { my $ftp = shift; # Darn MS FTP server is a load of CRAP !!!! + # Expect to see undef here. return () - unless ${*$ftp}{'net_cmd_code'} + 0; + unless 0 + (${*$ftp}{'net_cmd_code'} || 0); (${*$ftp}{'net_cmd_code'}, 1); } @@ -1145,8 +1167,11 @@ sub pasv_wait { vec($rin = '', fileno($ftp), 1) = 1; select($rout = $rin, undef, undef, undef); - $ftp->response(); - $non_pasv->response(); + my $dres = $ftp->response(); + my $sres = $non_pasv->response(); + + return undef + unless $dres == CMD_OK && $sres == CMD_OK; return undef unless $ftp->ok() && $non_pasv->ok(); @@ -1276,6 +1301,8 @@ C<Net::FTP> is a class implementing a simple FTP client in Perl as described in RFC959. It provides wrappers for a subset of the RFC959 commands. +The Net::FTP class is a subclass of Net::Cmd and IO::Socket::INET. + =head1 OVERVIEW FTP stands for File Transfer Protocol. It is a way of transferring @@ -1344,7 +1371,7 @@ transfers. (defaults to 10240) B<Port> - The port number to connect to on the remote machine for the FTP connection -B<Timeout> - Set a timeout value (defaults to 120) +B<Timeout> - Set a timeout value in seconds (defaults to 120) B<Debug> - debug level (see the debug method in L<Net::Cmd>) @@ -1382,6 +1409,10 @@ value, with I<true> meaning that the operation was a success. When a method states that it returns a value, failure will be returned as I<undef> or an empty list. +C<Net::FTP> inherits from C<Net::Cmd> so methods defined in C<Net::Cmd> may +be used to send commands to the remote FTP server in addition to the methods +documented here. + =over 4 =item login ([LOGIN [,PASSWORD [, ACCOUNT] ] ]) @@ -1439,6 +1470,10 @@ to change the directory to the root directory. Change directory to the parent of the current directory. +=item passive ( [ PASSIVE ] ) + +Set or get if data connections will be initiated in passive mode. + =item pwd () Returns the full pathname of the current directory. @@ -1676,9 +1711,6 @@ Send the QUIT command to the remote FTP server and close the socket connection. =head2 Methods for the adventurous -C<Net::FTP> inherits from C<Net::Cmd> so methods defined in C<Net::Cmd> may -be used to send commands to the remote FTP server. - =over 4 =item quot (CMD [,ARGS]) @@ -1796,7 +1828,7 @@ L<Net::Netrc> L<Net::Cmd> ftp(1), ftpd(8), RFC 959 -http://www.cis.ohio-state.edu/htbin/rfc/rfc959.html +http://www.ietf.org/rfc/rfc959.txt =head1 USE EXAMPLES diff --git a/gnu/usr.bin/perl/cpan/libnet/Net/FTP/A.pm b/gnu/usr.bin/perl/cpan/libnet/Net/FTP/A.pm index 427d02b19e9..c117d6937d4 100644 --- a/gnu/usr.bin/perl/cpan/libnet/Net/FTP/A.pm +++ b/gnu/usr.bin/perl/cpan/libnet/Net/FTP/A.pm @@ -10,7 +10,7 @@ use Carp; require Net::FTP::dataconn; @ISA = qw(Net::FTP::dataconn); -$VERSION = "1.18"; +$VERSION = "1.19"; sub read { @@ -77,8 +77,8 @@ sub write { my $timeout = @_ ? shift: $data->timeout; my $nr = (my $tmp = substr($buf, 0, $size)) =~ tr/\r\n/\015\012/; - $tmp =~ s/([^\015])\012/$1\015\012/sg if $nr; - $tmp =~ s/^\012/\015\012/ unless ${*$data}{'net_ftp_outcr'}; + $tmp =~ s/(?<!\015)\012/\015\012/sg if $nr; + $tmp =~ s/^\015// if ${*$data}{'net_ftp_outcr'}; ${*$data}{'net_ftp_outcr'} = substr($tmp, -1) eq "\015"; # If the remote server has closed the connection we will be signal'd diff --git a/gnu/usr.bin/perl/cpan/libnet/Net/FTP/dataconn.pm b/gnu/usr.bin/perl/cpan/libnet/Net/FTP/dataconn.pm index eeaf2719fc0..3f9366894d1 100644 --- a/gnu/usr.bin/perl/cpan/libnet/Net/FTP/dataconn.pm +++ b/gnu/usr.bin/perl/cpan/libnet/Net/FTP/dataconn.pm @@ -9,7 +9,7 @@ use vars qw(@ISA $timeout $VERSION); use Net::Cmd; use Errno; -$VERSION = '0.11'; +$VERSION = '0.12'; @ISA = qw(IO::Socket::INET); @@ -27,7 +27,7 @@ sub abort { return $data->close if ${*$data}{'net_ftp_eof'}; - # for some reason if we continously open RETR connections and not + # for some reason if we continuously open RETR connections and not # read a single byte, then abort them after a while the server will # close our connection, this prevents the unexpected EOF on the # command channel -- GMB @@ -64,7 +64,7 @@ sub close { if (exists ${*$data}{'net_ftp_bytesread'} && !${*$data}{'net_ftp_eof'}) { my $junk; - $data->read($junk, 1, 0); + eval { local($SIG{__DIE__}); $data->read($junk, 1, 0) }; return $data->abort unless ${*$data}{'net_ftp_eof'}; } diff --git a/gnu/usr.bin/perl/cpan/libnet/Net/NNTP.pm b/gnu/usr.bin/perl/cpan/libnet/Net/NNTP.pm index a742aed04c8..07c373776e9 100644 --- a/gnu/usr.bin/perl/cpan/libnet/Net/NNTP.pm +++ b/gnu/usr.bin/perl/cpan/libnet/Net/NNTP.pm @@ -14,7 +14,7 @@ use Carp; use Time::Local; use Net::Config; -$VERSION = "2.24"; +$VERSION = "2.26"; @ISA = qw(Net::Cmd IO::Socket::INET); @@ -39,23 +39,24 @@ sub new { @{$hosts} = qw(news) unless @{$hosts}; + my %connect = ( Proto => 'tcp'); + my $o; + foreach $o (qw(LocalAddr Timeout)) { + $connect{$o} = $arg{$o} if exists $arg{$o}; + } + $connect{Timeout} = 120 unless defined $connect{Timeout}; + $connect{PeerPort} = $arg{Port} || 'nntp(119)'; my $h; foreach $h (@{$hosts}) { - $obj = $type->SUPER::new( - PeerAddr => ($host = $h), - PeerPort => $arg{Port} || 'nntp(119)', - Proto => 'tcp', - Timeout => defined $arg{Timeout} - ? $arg{Timeout} - : 120 - ) + $connect{PeerAddr} = $h; + $obj = $type->SUPER::new(%connect) and last; } return undef unless defined $obj; - ${*$obj}{'net_nntp_host'} = $host; + ${*$obj}{'net_nntp_host'} = $connect{PeerAddr}; $obj->autoflush(1); $obj->debug(exists $arg{Debug} ? $arg{Debug} : undef); @@ -74,7 +75,7 @@ sub new { # talking to innd not nnrpd if ($obj->reader) { - # If reader suceeds the we need to consider this code to determine postok + # If reader succeeds the we need to consider this code to determine postok $c = $obj->code; } else { @@ -213,16 +214,18 @@ sub nntpstat { sub group { @_ == 1 || @_ == 2 or croak 'usage: $nntp->group( [ GROUP ] )'; my $nntp = shift; - my $grp = ${*$nntp}{'net_nntp_group'} || undef; + my $grp = ${*$nntp}{'net_nntp_group'}; return $grp unless (@_ || wantarray); my $newgrp = shift; - return wantarray ? () : undef - unless $nntp->_GROUP($newgrp || $grp || "") - && $nntp->message =~ /(\d+)\s+(\d+)\s+(\d+)\s+(\S+)/; + $newgrp = (defined($grp) and length($grp)) ? $grp : "" + unless defined($newgrp) and length($newgrp); + + return + unless $nntp->_GROUP($newgrp) and $nntp->message =~ /(\d+)\s+(\d+)\s+(\d+)\s+(\S+)/; my ($count, $first, $last, $group) = ($1, $2, $3, $4); @@ -712,7 +715,9 @@ Net::NNTP - NNTP Client class =head1 DESCRIPTION C<Net::NNTP> is a class implementing a simple NNTP client in Perl as described -in RFC977. C<Net::NNTP> inherits its communication methods from C<Net::Cmd> +in RFC977. + +The Net::NNTP class is a subclass of Net::Cmd and IO::Socket::INET. =head1 CONSTRUCTOR @@ -747,6 +752,11 @@ so that the remote server becomes innd. If the C<Reader> option is given with a value of zero, then this command will not be sent and the connection will be left talking to nnrpd. +B<LocalAddr> - If multiple IP addresses are present on the client host +with a valid route to the destination, you can specify the address your +C<Net::NNTP> connects from and this way override the operating system's +pick. + =back =head1 METHODS @@ -756,6 +766,10 @@ value, with I<true> meaning that the operation was a success. When a method states that it returns a value, failure will be returned as I<undef> or an empty list. +C<Net::NNTP> inherits from C<Net::Cmd> so methods defined in C<Net::Cmd> may +be used to send commands to the remote NNTP server in addition to the methods +documented here. + =over 4 =item article ( [ MSGID|MSGNUM ], [FH] ) diff --git a/gnu/usr.bin/perl/cpan/libnet/Net/Netrc.pm b/gnu/usr.bin/perl/cpan/libnet/Net/Netrc.pm index 28c826b38cd..fbe8d6d5be4 100644 --- a/gnu/usr.bin/perl/cpan/libnet/Net/Netrc.pm +++ b/gnu/usr.bin/perl/cpan/libnet/Net/Netrc.pm @@ -9,9 +9,9 @@ package Net::Netrc; use Carp; use strict; use FileHandle; -use vars qw($VERSION); +use vars qw($VERSION $TESTING); -$VERSION = "2.12"; +$VERSION = "2.14"; my %netrc = (); @@ -27,10 +27,18 @@ sub _readrc { } else { - # Some OS's don't have `getpwuid', so we default to $ENV{HOME} + # Some OS's don't have "getpwuid", so we default to $ENV{HOME} $home = eval { (getpwuid($>))[7] } || $ENV{HOME}; $home ||= $ENV{HOMEDRIVE} . ($ENV{HOMEPATH} || '') if defined $ENV{HOMEDRIVE}; - $file = $home . "/.netrc"; + if (-e $home . "/.netrc") { + $file = $home . "/.netrc"; + } + elsif (-e $home . "/_netrc") { + $file = $home . "/_netrc"; + } + else { + return unless $TESTING; + } } my ($login, $pass, $acct) = (undef, undef, undef); @@ -39,7 +47,7 @@ sub _readrc { $netrc{default} = undef; - # OS/2 and Win32 do not handle stat in a way compatable with this check :-( + # OS/2 and Win32 do not handle stat in a way compatible with this check :-( unless ($^O eq 'os2' || $^O eq 'MSWin32' || $^O eq 'MacOS' @@ -303,7 +311,7 @@ Return the account information for the netrc entry =item lpa () -Return a list of login, password and account information fir the netrc entry +Return a list of login, password and account information for the netrc entry =back diff --git a/gnu/usr.bin/perl/cpan/libnet/Net/POP3.pm b/gnu/usr.bin/perl/cpan/libnet/Net/POP3.pm index 8381c81815e..4b94a11a87e 100644 --- a/gnu/usr.bin/perl/cpan/libnet/Net/POP3.pm +++ b/gnu/usr.bin/perl/cpan/libnet/Net/POP3.pm @@ -13,7 +13,7 @@ use Net::Cmd; use Carp; use Net::Config; -$VERSION = "2.29"; +$VERSION = "2.31"; @ISA = qw(Net::Cmd IO::Socket::INET); @@ -307,26 +307,22 @@ sub _get_mailbox_count { } -sub _STAT { shift->command('STAT')->response() == CMD_OK } -sub _LIST { shift->command('LIST', @_)->response() == CMD_OK } +sub _STAT { shift->command('STAT' )->response() == CMD_OK } +sub _LIST { shift->command('LIST', @_)->response() == CMD_OK } sub _RETR { shift->command('RETR', $_[0])->response() == CMD_OK } sub _DELE { shift->command('DELE', $_[0])->response() == CMD_OK } -sub _NOOP { shift->command('NOOP')->response() == CMD_OK } -sub _RSET { shift->command('RSET')->response() == CMD_OK } -sub _QUIT { shift->command('QUIT')->response() == CMD_OK } -sub _TOP { shift->command('TOP', @_)->response() == CMD_OK } -sub _UIDL { shift->command('UIDL', @_)->response() == CMD_OK } +sub _NOOP { shift->command('NOOP' )->response() == CMD_OK } +sub _RSET { shift->command('RSET' )->response() == CMD_OK } +sub _QUIT { shift->command('QUIT' )->response() == CMD_OK } +sub _TOP { shift->command( 'TOP', @_)->response() == CMD_OK } +sub _UIDL { shift->command('UIDL', @_)->response() == CMD_OK } sub _USER { shift->command('USER', $_[0])->response() == CMD_OK } sub _PASS { shift->command('PASS', $_[0])->response() == CMD_OK } -sub _APOP { shift->command('APOP', @_)->response() == CMD_OK } +sub _APOP { shift->command('APOP', @_)->response() == CMD_OK } sub _PING { shift->command('PING', $_[0])->response() == CMD_OK } - - sub _RPOP { shift->command('RPOP', $_[0])->response() == CMD_OK } -sub _LAST { shift->command('LAST')->response() == CMD_OK } - - -sub _CAPA { shift->command('CAPA')->response() == CMD_OK } +sub _LAST { shift->command('LAST' )->response() == CMD_OK } +sub _CAPA { shift->command('CAPA' )->response() == CMD_OK } sub quit { @@ -488,9 +484,9 @@ sub auth { return 0; }; - # We dont support sasl mechanisms that encrypt the socket traffic. + # We don't support sasl mechanisms that encrypt the socket traffic. # todo that we would really need to change the ISA hierarchy - # so we dont inherit from IO::Socket, but instead hold it in an attribute + # so we don't inherit from IO::Socket, but instead hold it in an attribute my @cmd = ("AUTH", $client->mechanism); my $code; @@ -561,11 +557,13 @@ A new Net::POP3 object must be created with the I<new> method. Once this has been done, all POP3 commands are accessed via method calls on the object. +The Net::POP3 class is a subclass of Net::Cmd and IO::Socket::INET. + =head1 CONSTRUCTOR =over 4 -=item new ( [ HOST ] [, OPTIONS ] 0 +=item new ( [ HOST ] [, OPTIONS ] ) This is the constructor for a new Net::POP3 object. C<HOST> is the name of the remote host to which an POP3 connection is required. @@ -600,6 +598,10 @@ value, with I<true> meaning that the operation was a success. When a method states that it returns a value, failure will be returned as I<undef> or an empty list. +C<Net::POP3> inherits from C<Net::Cmd> so methods defined in C<Net::Cmd> may +be used to send commands to the remote POP3 server in addition to the methods +documented here. + =over 4 =item auth ( USERNAME, PASSWORD ) diff --git a/gnu/usr.bin/perl/cpan/libnet/Net/SMTP.pm b/gnu/usr.bin/perl/cpan/libnet/Net/SMTP.pm index a28496d6886..3d193a44d7a 100644 --- a/gnu/usr.bin/perl/cpan/libnet/Net/SMTP.pm +++ b/gnu/usr.bin/perl/cpan/libnet/Net/SMTP.pm @@ -16,7 +16,7 @@ use IO::Socket; use Net::Cmd; use Net::Config; -$VERSION = "2.31"; +$VERSION = "2.34"; @ISA = qw(Net::Cmd IO::Socket::INET); @@ -59,7 +59,9 @@ sub new { $obj->debug(exists $arg{Debug} ? $arg{Debug} : undef); unless ($obj->response() == CMD_OK) { + my $err = ref($obj) . ": " . $obj->code . " " . $obj->message; $obj->close(); + $@ = $err; return undef; } @@ -70,7 +72,9 @@ sub new { (${*$obj}{'net_smtp_domain'}) = $obj->message =~ /\A\s*(\S+)/; unless ($obj->hello($arg{Hello} || "")) { + my $err = ref($obj) . ": " . $obj->code . " " . $obj->message; $obj->close(); + $@ = $err; return undef; } @@ -143,9 +147,9 @@ sub auth { my $client = $sasl->client_new('smtp', ${*$self}{'net_smtp_host'}, 0); my $str = $client->client_start; - # We dont support sasl mechanisms that encrypt the socket traffic. + # We don't support sasl mechanisms that encrypt the socket traffic. # todo that we would really need to change the ISA hierarchy - # so we dont inherit from IO::Socket, but instead hold it in an attribute + # so we don't inherit from IO::Socket, but instead hold it in an attribute my @cmd = ("AUTH", $client->mechanism); my $code; @@ -176,7 +180,7 @@ sub hello { my $ln; foreach $ln (@msg) { $h->{uc $1} = $2 - if $ln =~ /(\w+)\b[= \t]*([^\n]*)/; + if $ln =~ /([-\w]+)\b[= \t]*([^\n]*)/; } } elsif ($me->status == CMD_ERROR) { @@ -286,7 +290,7 @@ sub mail { if (defined($v = delete $opt{Envelope})) { if (exists $esmtp->{DSN}) { - $v =~ s/([^\041-\176]|=|\+)/sprintf "+%02x", ord($1)/sge; + $v =~ s/([^\041-\176]|=|\+)/sprintf "+%02X", ord($1)/sge; $opts .= " ENVID=$v"; } else { @@ -575,16 +579,18 @@ known as mailhost: use Net::SMTP; - $smtp = Net::SMTP->new('mailhost'); + my $smtp = Net::SMTP->new('mailhost'); $smtp->mail($ENV{USER}); - $smtp->to('postmaster'); - - $smtp->data(); - $smtp->datasend("To: postmaster\n"); - $smtp->datasend("\n"); - $smtp->datasend("A simple test message\n"); - $smtp->dataend(); + if ($smtp->to('postmaster')) { + $smtp->data(); + $smtp->datasend("To: postmaster\n"); + $smtp->datasend("\n"); + $smtp->datasend("A simple test message\n"); + $smtp->dataend(); + } else { + print "Error: ", $smtp->message(); + } $smtp->quit; @@ -597,6 +603,9 @@ known as mailhost: This is the constructor for a new Net::SMTP object. C<HOST> is the name of the remote host to which an SMTP connection is required. +On failure C<undef> will be returned and C<$@> will contain the reason +for the failure. + C<HOST> is optional. If C<HOST> is not given then it may instead be passed as the C<Host> option described below. If neither is given then the C<SMTP_Hosts> specified in C<Net::Config> will be used. @@ -608,11 +617,14 @@ B<Hello> - SMTP requires that you identify yourself. This option specifies a string to pass as your mail domain. If not given localhost.localdomain will be used. -B<Host> - SMTP host to connect to. It may be a single scalar, as defined for -the C<PeerAddr> option in L<IO::Socket::INET>, or a reference to +B<Host> - SMTP host to connect to. It may be a single scalar (hostname[:port]), +as defined for the C<PeerAddr> option in L<IO::Socket::INET>, or a reference to an array with hosts to try in turn. The L</host> method will return the value which was used to connect to the host. +B<Port> - port to connect to. Format - C<PeerHost> from L<IO::Socket::INET> new method. +Default - 25. + B<LocalAddr> and B<LocalPort> - These parameters are passed directly to IO::Socket to allow binding the socket to a local port. @@ -630,24 +642,24 @@ Example: $smtp = Net::SMTP->new('mailhost', - Hello => 'my.mail.domain', - Timeout => 30, + Hello => 'my.mail.domain', + Timeout => 30, Debug => 1, - ); + ); # the same $smtp = Net::SMTP->new( - Host => 'mailhost', - Hello => 'my.mail.domain', - Timeout => 30, + Host => 'mailhost', + Hello => 'my.mail.domain', + Timeout => 30, Debug => 1, - ); + ); # Connect to the default server from Net::config $smtp = Net::SMTP->new( - Hello => 'my.mail.domain', - Timeout => 30, - ); + Hello => 'my.mail.domain', + Timeout => 30, + ); =back @@ -658,6 +670,10 @@ value, with I<true> meaning that the operation was a success. When a method states that it returns a value, failure will be returned as I<undef> or an empty list. +C<Net::SMTP> inherits from C<Net::Cmd> so methods defined in C<Net::Cmd> may +be used to send commands to the remote SMTP server in addition to the methods +documented here. + =over 4 =item banner () @@ -688,7 +704,7 @@ Request a queue run for the DOMAIN given. =item auth ( USERNAME, PASSWORD ) -Attempt SASL authentication. +Attempt SASL authentication. Requires Authen::SASL module. =item mail ( ADDRESS [, OPTIONS] ) @@ -768,7 +784,7 @@ that a DSN not be returned to the sender under any conditions." $smtp->recipient(@recipients, { Notify => ['NEVER'], SkipBad => 1 }); # Good You may use any combination of these three values 'SUCCESS','FAILURE','DELAY' in -the anonymous array reference as defined by RFC3461 (see http://rfc.net/rfc3461.html +the anonymous array reference as defined by RFC3461 (see http://www.ietf.org/rfc/rfc3461.txt for more information. Note: quotations in this topic from same.). A Notify parameter of 'SUCCESS' or 'FAILURE' "requests that a DSN be issued on @@ -844,7 +860,7 @@ to extract the mail address and pass that. If C<ExactAddresses> is passed to the constructor, then addresses should be a valid rfc2821-quoted address, although Net::SMTP will -accept accept the address surrounded by angle brackets. +accept the address surrounded by angle brackets. funny user@domain WRONG "funny user"@domain RIGHT, recommended diff --git a/gnu/usr.bin/perl/cpan/libnet/Net/Time.pm b/gnu/usr.bin/perl/cpan/libnet/Net/Time.pm index 6f1dd04586e..6b3b641643a 100644 --- a/gnu/usr.bin/perl/cpan/libnet/Net/Time.pm +++ b/gnu/usr.bin/perl/cpan/libnet/Net/Time.pm @@ -17,7 +17,7 @@ use IO::Select; @ISA = qw(Exporter); @EXPORT_OK = qw(inet_time inet_daytime); -$VERSION = "2.10"; +$VERSION = "2.11"; $TIMEOUT = 120; @@ -107,11 +107,11 @@ Net::Time - time and daytime network client interface use Net::Time qw(inet_time inet_daytime); - print inet_time(); # use default host from Net::Config + print inet_time(); # use default host from Net::Config print inet_time('localhost'); print inet_time('localhost', 'tcp'); - print inet_daytime(); # use default host from Net::Config + print inet_daytime(); # use default host from Net::Config print inet_daytime('localhost'); print inet_daytime('localhost', 'tcp'); diff --git a/gnu/usr.bin/perl/cpan/libnet/Net/libnetFAQ.pod b/gnu/usr.bin/perl/cpan/libnet/Net/libnetFAQ.pod index e6ec362f36a..78efe8c44bb 100644 --- a/gnu/usr.bin/perl/cpan/libnet/Net/libnetFAQ.pod +++ b/gnu/usr.bin/perl/cpan/libnet/Net/libnetFAQ.pod @@ -9,12 +9,14 @@ libnetFAQ - libnet Frequently Asked Questions This document is distributed with the libnet distribution, and is also available on the libnet web page at - http://search.cpan.org/~gbarr/libnet/ + http://search.cpan.org/dist/libnet/ =head2 How to contribute to this document -You may mail corrections, additions, and suggestions to me -gbarr@pobox.com. +You may report corrections, additions, and suggestions on the +CPAN request tracker at + + http://rt.cpan.org/Dist/Display.html?Name=libnet =head1 Author and Copyright Information @@ -22,6 +24,8 @@ Copyright (c) 1997-1998 Graham Barr. All rights reserved. This document is free; you can redistribute it and/or modify it under the terms of the Artistic License. +Currently maintained by Steve Hay <shay@cpan.org>. + =head2 Disclaimer This information is offered in good faith and in the hope that it may @@ -65,12 +69,7 @@ should not be the case with perl version 5.004 or later. The latest libnet release is always on CPAN, you will find it in - http://www.cpan.org/modules/by-module/Net/ - -The latest release and information is also available on the libnet web page -at - - http://search.cpan.org/~gbarr/libnet/ + http://search.cpan.org/dist/libnet/ =head1 Using Net::FTP @@ -188,7 +187,7 @@ Net::FTP uses IO::Socket to open the connection and IO::Socket allows the port number to be specified as part of the hostname. So this problem can be resolved by either passing a Firewall option like C<"hostname:1234"> or by setting the C<ftp_firewall> option in Net::Config to be a string -in in the same form. +in the same form. =head2 Is it possible to change the file permissions of a file on an FTP server ? diff --git a/gnu/usr.bin/perl/cpan/libnet/README b/gnu/usr.bin/perl/cpan/libnet/README index 25b6c73ffd4..4edac85f26e 100644 --- a/gnu/usr.bin/perl/cpan/libnet/README +++ b/gnu/usr.bin/perl/cpan/libnet/README @@ -10,27 +10,27 @@ point look at: The RFC implemented in this distribution are -Net::FTP RFC959 File Transfer Protocol -Net::SMTP RFC821 Simple Mail Transfer Protocol -Net::Time RFC867 Daytime Protocol -Net::Time RFC868 Time Protocol -Net::NNTP RFC977 Network News Transfer Protocol -Net::POP3 RFC1939 Post Office Protocol 3 +Net::FTP RFC959 File Transfer Protocol +Net::SMTP RFC821 Simple Mail Transfer Protocol +Net::Time RFC867 Daytime Protocol +Net::Time RFC868 Time Protocol +Net::NNTP RFC977 Network News Transfer Protocol +Net::POP3 RFC1939 Post Office Protocol 3 AVAILABILITY The latest version of libnet is available from the Comprehensive Perl Archive Network (CPAN). To find a CPAN site near you see: - http://search.cpan.org/~gbarr/libnet/ + http://search.cpan.org/dist/libnet/ -The subversion source repository can be browsed at +The GitHub source repository can be browsed at - http://svn.goingon.net/viewvc/libnet/ + http://github.com/steve-m-hay/perl-libnet -If you have a subversion client, then you can checkout the latest code with +If you have a Git client, then you can checkout the latest code with - svn co http://svn.goingon.net/repos/libnet/trunk libnet + git clone http://github.com/steve-m-hay/perl-libnet.git INSTALLATION @@ -93,7 +93,9 @@ SUPPORT Questions about how to use this library should be directed to the comp.lang.perl.modules USENET Newsgroup. Bug reports and suggestions -for improvements can be sent to me at <gbarr@pobox.com>. +for improvements can be reported on the CPAN request tracker at + + http://rt.cpan.org/Dist/Display.html?Name=libnet Most of the modules in this library have an option to output a debug transcript to STDERR. When reporting bugs/problems please, if possible, @@ -106,4 +108,6 @@ COPYRIGHT This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. +Currently maintained by Steve Hay <shay@cpan.org>. + Share and Enjoy! diff --git a/gnu/usr.bin/perl/cpan/libnet/t/config.t b/gnu/usr.bin/perl/cpan/libnet/t/config.t index 08df82b1ee4..3a3425123ff 100755 --- a/gnu/usr.bin/perl/cpan/libnet/t/config.t +++ b/gnu/usr.bin/perl/cpan/libnet/t/config.t @@ -2,11 +2,11 @@ BEGIN { if ($ENV{PERL_CORE}) { - chdir 't' if -d 't'; - @INC = '../lib'; + chdir 't' if -d 't'; + @INC = '../lib'; } if (!eval "require Socket") { - print "1..0 # no Socket\n"; exit 0; + print "1..0 # no Socket\n"; exit 0; } undef *{Socket::inet_aton}; undef *{Socket::inet_ntoa}; @@ -19,29 +19,29 @@ BEGIN { package Socket; sub import { - my $pkg = caller(); - no strict 'refs'; - *{ $pkg . '::inet_aton' } = \&inet_aton; - *{ $pkg . '::inet_ntoa' } = \&inet_ntoa; + my $pkg = caller(); + no strict 'refs'; + *{ $pkg . '::inet_aton' } = \&inet_aton; + *{ $pkg . '::inet_ntoa' } = \&inet_ntoa; } my $fail = 0; my %names; sub set_fail { - $fail = shift; + $fail = shift; } sub inet_aton { - return if $fail; - my $num = unpack('N', pack('C*', split(/\./, $_[0]))); - $names{$num} = $_[0]; - return $num; + return if $fail; + my $num = unpack('N', pack('C*', split(/\./, $_[0]))); + $names{$num} = $_[0]; + return $num; } sub inet_ntoa { - return if $fail; - return $names{$_[0]}; + return if $fail; + return $names{$_[0]}; } package main; @@ -59,29 +59,29 @@ ok( keys %NetConfig, '%NetConfig should be imported' ); Socket::set_fail(1); undef $NetConfig{'ftp_firewall'}; is( Net::Config->requires_firewall(), 0, - 'requires_firewall() should return 0 without ftp_firewall defined' ); + 'requires_firewall() should return 0 without ftp_firewall defined' ); $NetConfig{'ftp_firewall'} = 1; is( Net::Config->requires_firewall('a.host.not.there'), -1, - '... should return -1 without a valid hostname' ); + '... should return -1 without a valid hostname' ); Socket::set_fail(0); delete $NetConfig{'local_netmask'}; is( Net::Config->requires_firewall('127.0.0.1'), 0, - '... should return 0 without local_netmask defined' ); + '... should return 0 without local_netmask defined' ); $NetConfig{'local_netmask'} = '127.0.0.1/24'; is( Net::Config->requires_firewall('127.0.0.1'), 0, - '... should return false if host is within netmask' ); + '... should return false if host is within netmask' ); is( Net::Config->requires_firewall('192.168.10.0'), 1, - '... should return true if host is outside netmask' ); + '... should return true if host is outside netmask' ); # now try more netmasks $NetConfig{'local_netmask'} = [ '127.0.0.1/24', '10.0.0.0/8' ]; is( Net::Config->requires_firewall('10.10.255.254'), 0, - '... should find success with mutiple local netmasks' ); + '... should find success with mutiple local netmasks' ); is( Net::Config->requires_firewall('192.168.10.0'), 1, - '... should handle failure with multiple local netmasks' ); + '... should handle failure with multiple local netmasks' ); is( \&Net::Config::is_external, \&Net::Config::requires_firewall, - 'is_external() should be an alias for requires_firewall()' ); + 'is_external() should be an alias for requires_firewall()' ); diff --git a/gnu/usr.bin/perl/cpan/libnet/t/datasend.t b/gnu/usr.bin/perl/cpan/libnet/t/datasend.t index 96b5b7c6197..f6423407576 100755 --- a/gnu/usr.bin/perl/cpan/libnet/t/datasend.t +++ b/gnu/usr.bin/perl/cpan/libnet/t/datasend.t @@ -2,11 +2,11 @@ BEGIN { if ($ENV{PERL_CORE}) { - chdir 't' if -d 't'; - @INC = '../lib'; + chdir 't' if -d 't'; + @INC = '../lib'; } if (!eval "require Socket") { - print "1..0 # no Socket\n"; exit 0; + print "1..0 # no Socket\n"; exit 0; } if (ord('A') == 193 && !eval "require Convert::EBCDIC") { print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0; diff --git a/gnu/usr.bin/perl/cpan/libnet/t/ftp.t b/gnu/usr.bin/perl/cpan/libnet/t/ftp.t index 32d750efe8f..0c1b0e338ca 100755 --- a/gnu/usr.bin/perl/cpan/libnet/t/ftp.t +++ b/gnu/usr.bin/perl/cpan/libnet/t/ftp.t @@ -2,22 +2,27 @@ BEGIN { unless (-d 'blib') { - chdir 't' if -d 't'; - @INC = '../lib'; + chdir 't' if -d 't'; + @INC = '../lib'; } if (!eval "require Socket") { - print "1..0 # no Socket\n"; exit 0; + print "1..0 # Skip: no Socket module\n"; exit 0; } if (ord('A') == 193 && !eval "require Convert::EBCDIC") { - print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0; + print "1..0 # Skip: EBCDIC but no Convert::EBCDIC\n"; exit 0; } } use Net::Config; use Net::FTP; -unless(defined($NetConfig{ftp_testhost}) && $NetConfig{test_hosts}) { - print "1..0\n"; +unless(defined($NetConfig{ftp_testhost})) { + print "1..0 # Skip: no ftp_testhost defined in config\n"; + exit 0; +} + +unless($NetConfig{test_hosts}) { + print "1..0 # Skip: test_hosts not enabled in config\n"; exit 0; } @@ -25,7 +30,7 @@ my $t = 1; print "1..7\n"; $ftp = Net::FTP->new($NetConfig{ftp_testhost}) - or (print("not ok 1\n"), exit); + or (print("not ok 1\n"), exit); printf "ok %d\n",$t++; diff --git a/gnu/usr.bin/perl/cpan/libnet/t/hostname.t b/gnu/usr.bin/perl/cpan/libnet/t/hostname.t index 4013d74aab0..f486bb47024 100755 --- a/gnu/usr.bin/perl/cpan/libnet/t/hostname.t +++ b/gnu/usr.bin/perl/cpan/libnet/t/hostname.t @@ -2,11 +2,11 @@ BEGIN { unless (-d 'blib') { - chdir 't' if -d 't'; - @INC = '../lib'; + chdir 't' if -d 't'; + @INC = '../lib'; } if (!eval "require Socket") { - print "1..0 # no Socket\n"; exit 0; + print "1..0 # no Socket\n"; exit 0; } if (ord('A') == 193 && !eval "require Convert::EBCDIC") { print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0; diff --git a/gnu/usr.bin/perl/cpan/libnet/t/libnet_t.pl b/gnu/usr.bin/perl/cpan/libnet/t/libnet_t.pl index ed245e6502a..9337dd1dc78 100644 --- a/gnu/usr.bin/perl/cpan/libnet/t/libnet_t.pl +++ b/gnu/usr.bin/perl/cpan/libnet/t/libnet_t.pl @@ -1,36 +1,36 @@ my $number = 0; sub ok { - my ($condition, $name) = @_; + my ($condition, $name) = @_; - my $message = $condition ? "ok " : "not ok "; - $message .= ++$number; - $message .= " # $name" if defined $name; - print $message, "\n"; - return $condition; + my $message = $condition ? "ok " : "not ok "; + $message .= ++$number; + $message .= " # $name" if defined $name; + print $message, "\n"; + return $condition; } sub is { - my ($got, $expected, $name) = @_; + my ($got, $expected, $name) = @_; - for ($got, $expected) { - $_ = 'undef' unless defined $_; - } + for ($got, $expected) { + $_ = 'undef' unless defined $_; + } - unless (ok($got eq $expected, $name)) { - warn "Got: '$got'\nExpected: '$expected'\n" . join(' ', caller) . "\n"; - } + unless (ok($got eq $expected, $name)) { + warn "Got: '$got'\nExpected: '$expected'\n" . join(' ', caller) . "\n"; + } } sub skip { - my ($reason, $num) = @_; - $reason ||= ''; - $number ||= 1; - - for (1 .. $num) { - $number++; - print "ok $number # skip $reason\n"; - } + my ($reason, $num) = @_; + $reason ||= ''; + $number ||= 1; + + for (1 .. $num) { + $number++; + print "ok $number # skip $reason\n"; + } } 1; diff --git a/gnu/usr.bin/perl/cpan/libnet/t/netrc.t b/gnu/usr.bin/perl/cpan/libnet/t/netrc.t index cb5c35d9078..bb97244f7ca 100755 --- a/gnu/usr.bin/perl/cpan/libnet/t/netrc.t +++ b/gnu/usr.bin/perl/cpan/libnet/t/netrc.t @@ -2,11 +2,11 @@ BEGIN { if ($ENV{PERL_CORE}) { - chdir 't' if -d 't'; - @INC = '../lib'; + chdir 't' if -d 't'; + @INC = '../lib'; } if (!eval "require Socket") { - print "1..0 # no Socket\n"; exit 0; + print "1..0 # no Socket\n"; exit 0; } if (ord('A') == 193 && !eval "require Convert::EBCDIC") { print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0; @@ -25,13 +25,13 @@ $ENV{HOME} = Cwd::cwd(); local (*CORE::GLOBAL::getpwuid, *CORE::GLOBAL::stat); *CORE::GLOBAL::getpwuid = sub ($) { - ((undef) x 7, Cwd::cwd()); + ((undef) x 7, Cwd::cwd()); }; # for testing _readrc my @stat; *CORE::GLOBAL::stat = sub (*) { - return @stat; + return @stat; }; # for testing _readrc @@ -44,31 +44,32 @@ require $libnet_t; eval { require Net::Netrc; }; ok( !$@, 'should be able to require() Net::Netrc safely' ); ok( exists $INC{'Net/Netrc.pm'}, 'should be able to use Net::Netrc' ); +$Net::Netrc::TESTING=$Net::Netrc::TESTING=1; SKIP: { - skip('incompatible stat() handling for OS', 4), next SKIP - if ($^O =~ /os2|win32|macos|cygwin/i or $] < 5.005); - - my $warn; - local $SIG{__WARN__} = sub { - $warn = shift; - }; - - # add write access for group/other - $stat[2] = 077; - ok( !defined(Net::Netrc::_readrc()), - '_readrc() should not read world-writable file' ); - ok( scalar($warn =~ /^Bad permissions:/), - '... and should warn about it' ); - - # the owner field should still not match - $stat[2] = 0; + skip('incompatible stat() handling for OS', 4), next SKIP + if ($^O =~ /os2|win32|macos|cygwin/i or $] < 5.005); + + my $warn; + local $SIG{__WARN__} = sub { + $warn = shift; + }; + + # add write access for group/other + $stat[2] = 077; + ok( !defined(Net::Netrc::_readrc()), + '_readrc() should not read world-writable file' ); + ok( scalar($warn =~ /^Bad permissions:/), + '... and should warn about it' ); + + # the owner field should still not match + $stat[2] = 0; if ($<) { ok( !defined(Net::Netrc::_readrc()), '_readrc() should not read file owned by someone else' ); ok( scalar($warn =~ /^Not owner:/), - '... and should warn about it' ); + '... and should warn about it' ); } else { skip("testing as root",2); } @@ -79,15 +80,15 @@ $stat[4] = $<; # this curious mix of spaces and quotes tests a regex at line 79 (version 2.11) FileHandle::set_lines(split(/\n/, <<LINES)); -macdef bar -login baz - machine "foo" -login nigol "password" drowssap -machine foo "login" l2 - password p2 -account tnuocca -default login "baz" password p2 -default "login" baz password p3 +macdef bar +login baz +machine "foo" +login nigol "password" drowssap +machine foo "login" l2 +password p2 +account tnuocca +default login "baz" password p2 +default "login" baz password p3 macdef LINES @@ -96,59 +97,59 @@ is( Net::Netrc::_readrc(), 1, '_readrc() should succeed now' ); # on 'foo', the login is 'nigol' is( Net::Netrc->lookup('foo')->{login}, 'nigol', - 'lookup() should find value by host name' ); + 'lookup() should find value by host name' ); # on 'foo' with login 'l2', the password is 'p2' is( Net::Netrc->lookup('foo', 'l2')->{password}, 'p2', - 'lookup() should find value by hostname and login name' ); + 'lookup() should find value by hostname and login name' ); # the default password is 'p3', as later declarations have priority is( Net::Netrc->lookup()->{password}, 'p3', - 'lookup() should find default value' ); + 'lookup() should find default value' ); # lookup() ignores the login parameter when using default data is( Net::Netrc->lookup('default', 'baz')->{password}, 'p3', - 'lookup() should ignore passed login when searching default' ); + 'lookup() should ignore passed login when searching default' ); # lookup() goes to default data if hostname cannot be found in config data is( Net::Netrc->lookup('abadname')->{login}, 'baz', - 'lookup() should use default for unknown machine name' ); + 'lookup() should use default for unknown machine name' ); # now test these accessors my $instance = bless({}, 'Net::Netrc'); for my $accessor (qw( login account password )) { - is( $instance->$accessor(), undef, - "$accessor() should return undef if $accessor is not set" ); - $instance->{$accessor} = $accessor; - is( $instance->$accessor(), $accessor, - "$accessor() should return value when $accessor is set" ); + is( $instance->$accessor(), undef, + "$accessor() should return undef if $accessor is not set" ); + $instance->{$accessor} = $accessor; + is( $instance->$accessor(), $accessor, + "$accessor() should return value when $accessor is set" ); } # and the three-for-one accessor is( scalar( () = $instance->lpa()), 3, - 'lpa() should return login, password, account'); + 'lpa() should return login, password, account'); is( join(' ', $instance->lpa), 'login password account', - 'lpa() should return appropriate values for l, p, and a' ); + 'lpa() should return appropriate values for l, p, and a' ); package FileHandle; sub new { - tie *FH, 'FileHandle', @_; - bless \*FH, $_[0]; + tie *FH, 'FileHandle', @_; + bless \*FH, $_[0]; } sub TIEHANDLE { - my ($class, $file, $mode) = @_[0,2,3]; - bless({ file => $file, mode => $mode }, $class); + my ($class, $file, $mode) = @_[0,2,3]; + bless({ file => $file, mode => $mode }, $class); } my @lines; sub set_lines { - @lines = @_; + @lines = @_; } sub READLINE { - shift @lines; + shift @lines; } sub close { 1 } diff --git a/gnu/usr.bin/perl/cpan/libnet/t/nntp.t b/gnu/usr.bin/perl/cpan/libnet/t/nntp.t index 7fb99de62ce..643cfc8bc56 100755 --- a/gnu/usr.bin/perl/cpan/libnet/t/nntp.t +++ b/gnu/usr.bin/perl/cpan/libnet/t/nntp.t @@ -2,11 +2,11 @@ BEGIN { unless (-d 'blib') { - chdir 't' if -d 't'; - @INC = '../lib'; + chdir 't' if -d 't'; + @INC = '../lib'; } if (!eval "require Socket") { - print "1..0 # no Socket\n"; exit 0; + print "1..0 # no Socket\n"; exit 0; } if (ord('A') == 193 && !eval "require Convert::EBCDIC") { print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0; @@ -27,7 +27,7 @@ print "1..4\n"; my $i = 1; $nntp = Net::NNTP->new(Debug => 0) - or (print("not ok 1\n"), exit); + or (print("not ok 1\n"), exit); print "ok 1\n"; diff --git a/gnu/usr.bin/perl/cpan/libnet/t/require.t b/gnu/usr.bin/perl/cpan/libnet/t/require.t index 163c8bd801e..973ed41d7c6 100755 --- a/gnu/usr.bin/perl/cpan/libnet/t/require.t +++ b/gnu/usr.bin/perl/cpan/libnet/t/require.t @@ -2,11 +2,11 @@ BEGIN { unless (-d 'blib') { - chdir 't' if -d 't'; - @INC = '../lib'; + chdir 't' if -d 't'; + @INC = '../lib'; } if (!eval "require Socket") { - print "1..0 # no Socket\n"; exit 0; + print "1..0 # no Socket\n"; exit 0; } if (ord('A') == 193 && !eval "require Convert::EBCDIC") { print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0; diff --git a/gnu/usr.bin/perl/cpan/libnet/t/smtp.t b/gnu/usr.bin/perl/cpan/libnet/t/smtp.t index ac2df6c8b9d..6daef3123c8 100755 --- a/gnu/usr.bin/perl/cpan/libnet/t/smtp.t +++ b/gnu/usr.bin/perl/cpan/libnet/t/smtp.t @@ -2,11 +2,11 @@ BEGIN { unless (-d 'blib') { - chdir 't' if -d 't'; - @INC = '../lib'; + chdir 't' if -d 't'; + @INC = '../lib'; } if (!eval "require Socket") { - print "1..0 # no Socket\n"; exit 0; + print "1..0 # no Socket\n"; exit 0; } if (ord('A') == 193 && !eval "require Convert::EBCDIC") { print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0; @@ -26,7 +26,7 @@ print "1..3\n"; my $i = 1; $smtp = Net::SMTP->new(Debug => 0) - or (print("not ok 1\n"), exit); + or (print("not ok 1\n"), exit); print "ok 1\n"; diff --git a/gnu/usr.bin/perl/cpan/libnet/t/time.t b/gnu/usr.bin/perl/cpan/libnet/t/time.t index a8d416eea24..224b640cede 100755 --- a/gnu/usr.bin/perl/cpan/libnet/t/time.t +++ b/gnu/usr.bin/perl/cpan/libnet/t/time.t @@ -2,14 +2,14 @@ BEGIN { if ($ENV{PERL_CORE}) { - chdir 't' if -d 't'; - @INC = '../lib'; + chdir 't' if -d 't'; + @INC = '../lib'; } if (!eval "require Socket") { - print "1..0 # no Socket\n"; exit 0; + print "1..0 # no Socket\n"; exit 0; } if (ord('A') == 193 && !eval "require Convert::EBCDIC") { - print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0; + print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0; } $INC{'IO/Socket.pm'} = 1; $INC{'IO/Select.pm'} = 1; @@ -50,84 +50,84 @@ is( Net::Time::inet_daytime('bob'), 'z', 'inet_daytime() should receive data' ); # magic numbers defined in Net::Time my $offset = $^O eq 'MacOS' ? - (4 * 31536000) : (70 * 31536000 + 17 * 86400); + (4 * 31536000) : (70 * 31536000 + 17 * 86400); # check for correct args (time, 13) # pretend it is only six seconds since the offset, create a fake message # inet_time IO::Socket::INET::set_message(pack("N", $offset + 6)); is( Net::Time::inet_time('foo'), 6, - 'inet_time() should calculate time since offset for time()' ); + 'inet_time() should calculate time since offset for time()' ); my %fail; sub make_fail { - my ($pack, $func, $num) = @_; - $num = 1 unless defined $num; + my ($pack, $func, $num) = @_; + $num = 1 unless defined $num; - $fail{$pack}{$func} = $num; + $fail{$pack}{$func} = $num; } package IO::Socket::INET; $fail{'IO::Socket::INET'} = { - new => 0, - 'send' => 0, + new => 0, + 'send' => 0, }; sub new { - my $class = shift; - return if $fail{$class}{new} and $fail{$class}{new}--; - bless( { @_ }, $class ); + my $class = shift; + return if $fail{$class}{new} and $fail{$class}{new}--; + bless( { @_ }, $class ); } sub send { - my $self = shift; - my $class = ref($self); - return if $fail{$class}{'send'} and $fail{$class}{'send'}--; - $self->{sent} .= shift; + my $self = shift; + my $class = ref($self); + return if $fail{$class}{'send'} and $fail{$class}{'send'}--; + $self->{sent} .= shift; } my $msg; sub set_message { - if (ref($_[0])) { - $_[0]->{msg} = $_[1]; - } else { - $msg = shift; - } + if (ref($_[0])) { + $_[0]->{msg} = $_[1]; + } else { + $msg = shift; + } } sub do_recv { - my ($len, $msg) = @_[1,2]; - $_[0] .= substr($msg, 0, $len); + my ($len, $msg) = @_[1,2]; + $_[0] .= substr($msg, 0, $len); } sub recv { - my ($self, $buf, $length, $flags) = @_; - my $message = exists $self->{msg} ? - $self->{msg} : $msg; - - if (defined($message)) { - do_recv($_[1], $length, $message); - } - 1; + my ($self, $buf, $length, $flags) = @_; + my $message = exists $self->{msg} ? + $self->{msg} : $msg; + + if (defined($message)) { + do_recv($_[1], $length, $message); + } + 1; } package IO::Select; sub new { - my $class = shift; - return if defined $fail{$class}{new} and $fail{$class}{new}--; - bless({sock => shift}, $class); + my $class = shift; + return if defined $fail{$class}{new} and $fail{$class}{new}--; + bless({sock => shift}, $class); } sub can_read { - my ($self, $timeout) = @_; - my $class = ref($self); - return if defined $fail{$class}{can_read} and $fail{class}{can_read}--; - $self->{sock}{timeout} = $timeout; - 1; + my ($self, $timeout) = @_; + my $class = ref($self); + return if defined $fail{$class}{can_read} and $fail{class}{can_read}--; + $self->{sock}{timeout} = $timeout; + 1; } 1; diff --git a/gnu/usr.bin/perl/patchlevel.h b/gnu/usr.bin/perl/patchlevel.h index 0e04a27c043..d51767c573f 100644 --- a/gnu/usr.bin/perl/patchlevel.h +++ b/gnu/usr.bin/perl/patchlevel.h @@ -133,7 +133,7 @@ hunk. # endif static const char * const local_patches[] = { NULL - ,"Fix for RT 37700" + ,"Update libnet to 1.27" #ifdef PERL_GIT_UNCOMMITTED_CHANGES ,"uncommitted-changes" #endif |