From 9714c66736b4a0b2235cb81bc9b77bbb7dd528fd Mon Sep 17 00:00:00 2001 From: Graham Barr Date: Wed, 30 Jun 2004 13:47:36 +0000 Subject: [PATCH] Sync to libnet-1.19 p4raw-id: //depot/perl@23016 --- lib/Net/Changes.libnet | 7 +++++++ lib/Net/Cmd.pm | 4 ++-- lib/Net/FTP.pm | 9 +++++---- lib/Net/POP3.pm | 4 ++-- lib/Net/SMTP.pm | 8 +++++--- lib/Net/t/datasend.t | 13 ++++++++----- 6 files changed, 29 insertions(+), 16 deletions(-) diff --git a/lib/Net/Changes.libnet b/lib/Net/Changes.libnet index 9e5f0a1..724135c 100644 --- a/lib/Net/Changes.libnet +++ b/lib/Net/Changes.libnet @@ -1,3 +1,10 @@ +libnet 1.19 -- Wed Jun 30 14:53:48 BST 2004 + +Bug Fixes + * Fixed datasend test to work on Win32 platform + * Fixed Authen::SASL checking in SMTP.pm and POP3.pm + * Fixed bug that a restarted get with Net::FTP did not append to local file + libnet 1.18 -- Mon Mar 22 16:19:01 GMT 2004 Bug Fixes diff --git a/lib/Net/Cmd.pm b/lib/Net/Cmd.pm index 0324a9b..a84b4da 100644 --- a/lib/Net/Cmd.pm +++ b/lib/Net/Cmd.pm @@ -21,7 +21,7 @@ BEGIN { } } -$VERSION = "2.25"; +$VERSION = "2.26"; @ISA = qw(Exporter); @EXPORT = qw(CMD_INFO CMD_OK CMD_MORE CMD_REJECT CMD_ERROR CMD_PENDING); @@ -431,7 +431,7 @@ sub datasend while($len) { my $wout; - if (select(undef,$wout=$win, undef, $timeout) > 0) + if (select(undef,$wout=$win, undef, $timeout) > 0 or -f $cmd) # -f for testing on win32 { my $w = syswrite($cmd, $line, $len, $offset); unless (defined($w)) diff --git a/lib/Net/FTP.pm b/lib/Net/FTP.pm index 7aad1a6..aac72b2 100644 --- a/lib/Net/FTP.pm +++ b/lib/Net/FTP.pm @@ -1,6 +1,6 @@ # Net::FTP.pm # -# Copyright (c) 1995-2003 Graham Barr . All rights reserved. +# Copyright (c) 1995-2004 Graham Barr . All rights reserved. # This program is free software; you can redistribute it and/or # modify it under the same terms as Perl itself. # @@ -22,7 +22,7 @@ use Net::Config; use Fcntl qw(O_WRONLY O_RDONLY O_APPEND O_CREAT O_TRUNC); # use AutoLoader qw(AUTOLOAD); -$VERSION = "2.74"; # $Id: //depot/libnet/Net/FTP.pm#84 $ +$VERSION = "2.75"; @ISA = qw(Exporter Net::Cmd IO::Socket::INET); # Someday I will "use constant", when I am not bothered to much about @@ -457,6 +457,7 @@ sub get if $remote =~ /[\r\n]/s; ${*$ftp}{'net_ftp_rest'} = $where if defined $where; + my $rest = ${*$ftp}{'net_ftp_rest'}; delete ${*$ftp}{'net_ftp_port'}; delete ${*$ftp}{'net_ftp_pasv'}; @@ -472,7 +473,7 @@ sub get { $loc = \*FD; - unless(sysopen($loc, $local, O_CREAT | O_WRONLY | (${*$ftp}{'net_ftp_rest'} ? O_APPEND : O_TRUNC))) + unless(sysopen($loc, $local, O_CREAT | O_WRONLY | ($rest ? O_APPEND : O_TRUNC))) { carp "Cannot open Local file $local: $!\n"; $data->abort; @@ -1782,7 +1783,7 @@ Roderick Schertler - for various inputs =head1 COPYRIGHT -Copyright (c) 1995-2003 Graham Barr. All rights reserved. +Copyright (c) 1995-2004 Graham Barr. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Net/POP3.pm b/lib/Net/POP3.pm index 3a5aec0..a04e12a 100644 --- a/lib/Net/POP3.pm +++ b/lib/Net/POP3.pm @@ -13,7 +13,7 @@ use Net::Cmd; use Carp; use Net::Config; -$VERSION = "2.27"; +$VERSION = "2.28"; @ISA = qw(Net::Cmd IO::Socket::INET); @@ -401,7 +401,7 @@ sub auth { eval { require MIME::Base64; require Authen::SASL; - } or return $self->set_error(500,["Need MIME::Base64 and Authen::SASL todo auth"]); + } or $self->set_status(500,["Need MIME::Base64 and Authen::SASL todo auth"]), return 0; my $capa = $self->capa; my $mechanisms = $capa->{SASL} || 'CRAM-MD5'; diff --git a/lib/Net/SMTP.pm b/lib/Net/SMTP.pm index e7276de..44a955a 100644 --- a/lib/Net/SMTP.pm +++ b/lib/Net/SMTP.pm @@ -16,7 +16,7 @@ use IO::Socket; use Net::Cmd; use Net::Config; -$VERSION = "2.28"; +$VERSION = "2.29"; @ISA = qw(Net::Cmd IO::Socket::INET); @@ -109,8 +109,10 @@ sub etrn { sub auth { my ($self, $username, $password) = @_; - require MIME::Base64; - require Authen::SASL; + eval { + require MIME::Base64; + require Authen::SASL; + } or $self->set_status(500,["Need MIME::Base64 and Authen::SASL todo auth"]), return 0; my $mechanisms = $self->supports('AUTH',500,["Command unknown: 'AUTH'"]); return unless defined $mechanisms; diff --git a/lib/Net/t/datasend.t b/lib/Net/t/datasend.t index 48655fa..0786709 100644 --- a/lib/Net/t/datasend.t +++ b/lib/Net/t/datasend.t @@ -30,17 +30,20 @@ BEGIN { (my $libnet_t = __FILE__) =~ s/datasend.t/libnet_t.pl/; require $libnet_t or die; -print "1..15\n"; +print "1..51\n"; sub check { my $expect = pop; my $cmd = Foo->new; - $cmd->datasend unless @_; + ok($cmd->datasend, 'datasend') unless @_; foreach my $line (@_) { - $cmd->datasend($line); + ok($cmd->datasend($line), 'datasend'); } - $cmd->dataend; - is($cmd->output, $expect); + ok($cmd->dataend, 'dataend'); + is( + unpack("H*",$cmd->output), + unpack("H*",$expect) + ); } my $cmd; -- 2.7.4