summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGraham Barr <gbarr@pobox.com>2003-03-03 10:07:44 +0000
committerGraham Barr <gbarr@pobox.com>2003-03-03 10:07:44 +0000
commitedd55068839c345dfb2c25887f70d5c69e05b5d3 (patch)
treec6d6a620f0546163eb1a7ba36aaf83486ccd287a /lib
parent6c941e0cc3f0f3bcc43af75928ecabd63f9b41f6 (diff)
downloadperl-edd55068839c345dfb2c25887f70d5c69e05b5d3.tar.gz
Sync with libnet-1.13
p4raw-id: //depot/perl@18818
Diffstat (limited to 'lib')
-rw-r--r--lib/Net/ChangeLog.libnet44
-rw-r--r--lib/Net/Cmd.pm27
-rw-r--r--lib/Net/FTP.pm14
-rw-r--r--lib/Net/POP3.pm8
-rw-r--r--lib/Net/SMTP.pm9
5 files changed, 76 insertions, 26 deletions
diff --git a/lib/Net/ChangeLog.libnet b/lib/Net/ChangeLog.libnet
index a00a527edc..7b8c73ff6a 100644
--- a/lib/Net/ChangeLog.libnet
+++ b/lib/Net/ChangeLog.libnet
@@ -1,3 +1,47 @@
+Change 772 on 2003/03/03 by <gbarr@pobox.com> (Graham Barr)
+
+ Release 1.13
+
+Change 755 on 2002/11/03 by <gbarr@pobox.com> (Graham Barr)
+
+ Fix typo
+
+Change 749 on 2002/09/23 by <gbarr@pobox.com> (Graham Barr)
+
+ Net::POP3
+ - Make more compilant. +OK and -ERR responses do not have to be followed
+ by a space.
+
+Change 748 on 2002/09/23 by <gbarr@pobox.com> (Graham Barr)
+
+ Net::FTP
+ - Fix unique name extraction to pick up name on initial
+ response, not just the final response
+
+Change 737 on 2002/07/18 by <gbarr@pobox.com> (Graham Barr)
+
+ Net::Cmd
+ - Compatability fix for 5.004
+
+Change 736 on 2002/07/16 by <gbarr@pobox.com> (Graham Barr)
+
+ Net::Cmd
+ - Ensure all debug output is via ->debug_print
+
+Change 735 on 2002/07/15 by <gbarr@pobox.com> (Graham Barr)
+
+ Net::FTP
+ - Allow the user to specify a local address to use for sockets
+
+Change 734 on 2002/07/15 by <gbarr@pobox.com> (Graham Barr)
+
+ Net::SMTP
+ - Avoid extra spaces on the end of the AUTH command
+
+Change 728 on 2002/05/28 by <gbarr@pobox.com> (Graham Barr)
+
+ Release 1.12
+
Change 727 on 2002/05/28 by <gbarr@pobox.com> (Graham Barr)
Net::SMTP
diff --git a/lib/Net/Cmd.pm b/lib/Net/Cmd.pm
index 9093fcd3a2..f89914ebd7 100644
--- a/lib/Net/Cmd.pm
+++ b/lib/Net/Cmd.pm
@@ -1,4 +1,4 @@
-# Net::Cmd.pm $Id: //depot/libnet/Net/Cmd.pm#28 $
+# Net::Cmd.pm $Id: //depot/libnet/Net/Cmd.pm#30 $
#
# Copyright (c) 1995-1997 Graham Barr <gbarr@pobox.com>. All rights reserved.
# This program is free software; you can redistribute it and/or
@@ -21,7 +21,7 @@ BEGIN {
}
}
-$VERSION = "2.21";
+$VERSION = "2.23";
@ISA = qw(Exporter);
@EXPORT = qw(CMD_INFO CMD_OK CMD_MORE CMD_REJECT CMD_ERROR CMD_PENDING);
@@ -73,7 +73,6 @@ sub _print_isa
my @do = ($pkg);
my %spc = ( $pkg , "");
- print STDERR "\n";
while ($pkg = shift @do)
{
next if defined $done{$pkg};
@@ -85,7 +84,7 @@ sub _print_isa
: "";
my $spc = $spc{$pkg};
- print STDERR "$cmd: ${spc}${pkg}${v}\n";
+ $cmd->debug_print(1,"${spc}${pkg}${v}\n");
if(@{"${pkg}::ISA"})
{
@@ -93,8 +92,6 @@ sub _print_isa
unshift(@do, @{"${pkg}::ISA"});
}
}
-
- print STDERR "\n";
}
sub debug
@@ -398,10 +395,10 @@ sub datasend
return 1
unless length($line);
- if($cmd->debug)
- {
- my $b = "$cmd>>> ";
- print STDERR $b,join("\n$b",split(/\n/,$line)),"\n";
+ if($cmd->debug) {
+ foreach my $b (split(/\n/,$line)) {
+ $cmd->debug_print(1, "$b\n");
+ }
}
# Translate LF => CRLF, but not if the LF is
@@ -457,17 +454,13 @@ sub dataend
if(${*$cmd}{'net_cmd_lastch'} eq "\015")
{
syswrite($cmd,"\012",1);
- print STDERR "\n"
- if($cmd->debug);
}
elsif(${*$cmd}{'net_cmd_lastch'} ne "\012")
{
syswrite($cmd,"\015\012",2);
- print STDERR "\n"
- if($cmd->debug);
}
- print STDERR "$cmd>>> .\n"
+ $cmd->debug_print(1, ".\n")
if($cmd->debug);
syswrite($cmd,".\015\012",3);
@@ -497,7 +490,7 @@ sub TIEHANDLE {
# end-of-file when the dot is encountered.
sub READ {
my $cmd = shift;
- my (undef,$len,$offset) = @_;
+ my ($len,$offset) = @_[1,2];
return unless exists ${*$cmd}{'net_cmd_readbuf'};
my $done = 0;
while (!$done and length(${*$cmd}{'net_cmd_readbuf'}) < $len) {
@@ -714,6 +707,6 @@ it under the same terms as Perl itself.
=for html <hr>
-I<$Id: //depot/libnet/Net/Cmd.pm#28 $>
+I<$Id: //depot/libnet/Net/Cmd.pm#30 $>
=cut
diff --git a/lib/Net/FTP.pm b/lib/Net/FTP.pm
index 999889772d..4e09b59d02 100644
--- a/lib/Net/FTP.pm
+++ b/lib/Net/FTP.pm
@@ -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.65"; # $Id: //depot/libnet/Net/FTP.pm#68 $
+$VERSION = "2.67"; # $Id: //depot/libnet/Net/FTP.pm#70 $
@ISA = qw(Exporter Net::Cmd IO::Socket::INET);
# Someday I will "use constant", when I am not bothered to much about
@@ -76,6 +76,7 @@ sub new
my $ftp = $pkg->SUPER::new(PeerAddr => $peer,
PeerPort => $arg{Port} || 'ftp(21)',
+ LocalAddr => $arg{'LocalAddr'},
Proto => 'tcp',
Timeout => defined $arg{Timeout}
? $arg{Timeout}
@@ -86,6 +87,8 @@ sub new
${*$ftp}{'net_ftp_type'} = 'A'; # ASCII/binary/etc mode
${*$ftp}{'net_ftp_blksize'} = abs($arg{'BlockSize'} || 10240);
+ ${*$ftp}{'net_ftp_localaddr'} = $arg{'LocalAddr'};
+
${*$ftp}{'net_ftp_firewall'} = $fire
if(defined $fire);
${*$ftp}{'net_ftp_firewall_type'} = $fire_type
@@ -714,6 +717,9 @@ sub _store_cmd
$sock = $ftp->_data_cmd($cmd, $remote) or
return undef;
+ $remote = ($ftp->message =~ /FILE:\s*(.*)/)[0]
+ if 'STOU' eq uc $cmd;
+
my $blksize = ${*$ftp}{'net_ftp_blksize'};
my($count,$hashh,$hashb,$ref) = (0);
@@ -908,6 +914,7 @@ sub _dataconn
$data = $pkg->new(PeerAddr => join(".",@port[0..3]),
PeerPort => $port[4] * 256 + $port[5],
+ LocalAddr => ${*$ftp}{'net_ftp_localaddr'},
Proto => 'tcp'
);
}
@@ -1277,6 +1284,9 @@ simply invokes the C<hash()> method for you, so that hash marks
are displayed for all transfers. You can, of course, call C<hash()>
explicitly whenever you'd like.
+B<LocalAddr> - Local address to use for all socket connections, this
+argument will be passed to L<IO::Socket::INET>
+
If the constructor fails undef will be returned and an error message will
be in $@
@@ -1710,6 +1720,6 @@ under the same terms as Perl itself.
=for html <hr>
-I<$Id: //depot/libnet/Net/FTP.pm#68 $>
+I<$Id: //depot/libnet/Net/FTP.pm#70 $>
=cut
diff --git a/lib/Net/POP3.pm b/lib/Net/POP3.pm
index 146041624e..3263f47dc0 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.23"; # $Id: //depot/libnet/Net/POP3.pm#22 $
+$VERSION = "2.24"; # $Id: //depot/libnet/Net/POP3.pm#23 $
@ISA = qw(Net::Cmd IO::Socket::INET);
@@ -342,13 +342,13 @@ sub response
$cmd->debug_print(0,$str)
if ($cmd->debug);
- if($str =~ s/^\+OK\s+//io)
+ if($str =~ s/^\+OK\s*//io)
{
$code = "200"
}
else
{
- $str =~ s/^-ERR\s+//io;
+ $str =~ s/^-ERR\s*//io;
}
${*$cmd}{'net_cmd_resp'} = [ $str ];
@@ -540,6 +540,6 @@ it under the same terms as Perl itself.
=for html <hr>
-I<$Id: //depot/libnet/Net/POP3.pm#22 $>
+I<$Id: //depot/libnet/Net/POP3.pm#23 $>
=cut
diff --git a/lib/Net/SMTP.pm b/lib/Net/SMTP.pm
index 4da0d7878e..613d1dbb94 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.24"; # $Id: //depot/libnet/Net/SMTP.pm#25 $
+$VERSION = "2.25"; # $Id: //depot/libnet/Net/SMTP.pm#26 $
@ISA = qw(Net::Cmd IO::Socket::INET);
@@ -126,9 +126,12 @@ sub auth {
# 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
- my @cmd = ("AUTH", $client->mechanism, MIME::Base64::encode_base64($str,''));
+ my @cmd = ("AUTH", $client->mechanism);
my $code;
+ push @cmd, MIME::Base64::encode_base64($str,'')
+ if defined $str and length $str;
+
while (($code = $self->command(@cmd)->response()) == CMD_MORE) {
@cmd = (MIME::Base64::encode_base64(
$client->client_step(
@@ -670,6 +673,6 @@ it under the same terms as Perl itself.
=for html <hr>
-I<$Id: //depot/libnet/Net/SMTP.pm#25 $>
+I<$Id: //depot/libnet/Net/SMTP.pm#26 $>
=cut