about summary refs log tree commit
diff options
context:
space:
mode:
authorGraham Barr <gbarr@pobox.com>1997-09-27 03:43:41 +0000
committerGraham Barr <gbarr@pobox.com>1997-09-27 03:43:41 +0000
commit0f1b70bcbc8fb10e9ad18eb517a2ce743706c73e (patch)
tree848fcc7c8e9bc3d673b1bb79f210dda834dd7ab4
parent4050a15e5a5d82fca52f76f65b02dda1b77329e2 (diff)
downloadperl-libnet-0f1b70bcbc8fb10e9ad18eb517a2ce743706c73e.tar.gz
Net::FTP
- Added account method so ACCT command can be sent independantly
  of ->login()
- Fixed a bug which caused an infinite loop if EOF happend on the
  command channel while executing code to work around MS FTP
    servers

Net::Cmd
- Fixed undefined warning when an unexpected EOF is encountered

Net::NNTP
- Added a call to ->reader() from within ->new(), just in case we are
  talking to an INN server, but we have transfer rights. This will
  ensure we are talking to nnrpd.

Net::SNPP
- Fixed a bug in ->new() while locating default host

-rw-r--r--Net/Cmd.pm6
-rw-r--r--Net/FTP.pm10
-rw-r--r--Net/NNTP.pm16
3 files changed, 29 insertions, 3 deletions
diff --git a/Net/Cmd.pm b/Net/Cmd.pm
index e21ddf7..09fc518 100644
--- a/Net/Cmd.pm
+++ b/Net/Cmd.pm
@@ -205,9 +205,13 @@ sub getline
     if scalar(@{${*$cmd}{'net_cmd_lines'}});
 
  my $partial = ${*$cmd}{'net_cmd_partial'} || "";
+ my $fd = fileno($cmd);
+
+ return undef
+        unless defined $fd;
 
  my $rin = "";
- vec($rin,fileno($cmd),1) = 1;
+ vec($rin,$fd,1) = 1;
 
  my $buf;
 
diff --git a/Net/FTP.pm b/Net/FTP.pm
index 4a78f9f..a2edee7 100644
--- a/Net/FTP.pm
+++ b/Net/FTP.pm
@@ -213,6 +213,14 @@ sub login
  $ok == CMD_OK;
 }
 
+sub account
+{
+ @_ == 2 or croak 'usage: $ftp->account( ACCT )';
+ my $ftp = shift;
+ my $acct = shift;
+ $ftp->_ACCT($acct) == CMD_OK;
+}
+
 sub authorize
 {
  @_ >= 1 || @_ <= 3 or croak 'usage: $ftp->authorize( [AUTH [, RESP]])';
@@ -763,7 +771,7 @@ sub parse_response
 
  # Darn MS FTP server is a load of CRAP !!!!
  return ()
-        unless ${*$ftp}{'net_cmd_code'};
+        unless ${*$ftp}{'net_cmd_code'} + 0;
 
  (${*$ftp}{'net_cmd_code'},1);
 }
diff --git a/Net/NNTP.pm b/Net/NNTP.pm
index af15ad6..c924ed9 100644
--- a/Net/NNTP.pm
+++ b/Net/NNTP.pm
@@ -14,7 +14,7 @@ use Carp;
 use Time::Local;
 use Net::Config;
 
-$VERSION = do { my @r=(q$Revision: 2.14.1 $=~/\d+/g); sprintf "%d."."%02d"x$#r,@r};
+$VERSION = "2.15";
 @ISA     = qw(Net::Cmd IO::Socket::INET);
 
 sub new
@@ -59,6 +59,20 @@ sub new
   }
 
  my $c = $obj->code;
+ my @m = $obj->message;
+
+ # if server is INN and we have transfer rights the we are currently
+ # talking to innd not nnrpd
+ if($obj->reader)
+  {
+   # If reader suceeds the we need to consider this code to determine postok
+   $c = $obj->code;
+  }
+ else
+  {
+   # I want to ignore this failure, so restore the previous status.
+   $obj->set_status($c,\@m);
+  }
  ${*$obj}{'net_nntp_post'} = $c >= 200 && $c <= 209 ? 1 : 0;
 
  $obj;