Sync to libnet-1.19
authorGraham Barr <gbarr@pobox.com>
Wed, 30 Jun 2004 13:47:36 +0000 (13:47 +0000)
committerGraham Barr <gbarr@pobox.com>
Wed, 30 Jun 2004 13:47:36 +0000 (13:47 +0000)
p4raw-id: //depot/perl@23016

lib/Net/Changes.libnet
lib/Net/Cmd.pm
lib/Net/FTP.pm
lib/Net/POP3.pm
lib/Net/SMTP.pm
lib/Net/t/datasend.t

index 9e5f0a1..724135c 100644 (file)
@@ -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
index 0324a9b..a84b4da 100644 (file)
@@ -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))
index 7aad1a6..aac72b2 100644 (file)
@@ -1,6 +1,6 @@
 # Net::FTP.pm
 #
-# Copyright (c) 1995-2003 Graham Barr <gbarr@pobox.com>. All rights reserved.
+# Copyright (c) 1995-2004 Graham Barr <gbarr@pobox.com>. 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 <roderick@gate.net> - 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.
 
index 3a5aec0..a04e12a 100644 (file)
@@ -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';
index e7276de..44a955a 100644 (file)
@@ -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;
index 48655fa..0786709 100644 (file)
@@ -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;