about summary refs log tree commit
diff options
context:
space:
mode:
authorGraham Barr <gbarr@pobox.com>1997-11-30 17:33:43 +0000
committerGraham Barr <gbarr@pobox.com>1997-11-30 17:33:43 +0000
commit4241d829b69eb4b782747c76b4f90cf3178305fe (patch)
tree7ba63794fdd346eeb5bdc34d8e5a4b6d0b1bbc1d
parent9d75234483b2b04f80fc0e3ea67d4189236136f1 (diff)
downloadperl-libnet-4241d829b69eb4b782747c76b4f90cf3178305fe.tar.gz
Net::Cmd
- Fix for read_until_dot entering an endless loop, now returns undef

Net::POP3
- Fix ->list() and ->uidl() to handle undef being returned from
  ->read_until_dot()

-rw-r--r--Net/Cmd.pm4
-rw-r--r--Net/POP3.pm9
2 files changed, 8 insertions, 5 deletions
diff --git a/Net/Cmd.pm b/Net/Cmd.pm
index 38ff3a7..2167508 100644
--- a/Net/Cmd.pm
+++ b/Net/Cmd.pm
@@ -13,7 +13,7 @@ use strict;
 use vars qw(@ISA @EXPORT $VERSION);
 use Carp;
 
-$VERSION = "2.10";
+$VERSION = "2.11";
 @ISA     = qw(Exporter);
 @EXPORT  = qw(CMD_INFO CMD_OK CMD_MORE CMD_REJECT CMD_ERROR CMD_PENDING);
 
@@ -314,7 +314,7 @@ sub read_until_dot
 
  while(1)
   {
-   my $str = $cmd->getline();
+   my $str = $cmd->getline() or return undef;
 
    $cmd->debug_print(0,$str)
      if ($cmd->debug & 4);
diff --git a/Net/POP3.pm b/Net/POP3.pm
index 41c9f94..8d7c055 100644
--- a/Net/POP3.pm
+++ b/Net/POP3.pm
@@ -13,7 +13,7 @@ use Net::Cmd;
 use Carp;
 use Net::Config;
 
-$VERSION = "2.11"; # $Id: //depot/libnet/Net/POP3.pm#4 $
+$VERSION = "2.12"; # $Id: //depot/libnet/Net/POP3.pm#5 $
 
 @ISA = qw(Net::Cmd IO::Socket::INET);
 
@@ -212,7 +212,9 @@ sub list
    return $1 || undef;
   }
 
- my $info = $me->read_until_dot;
+ my $info = $me->read_until_dot
+        or return undef;
+
  my %hash = ();
  map { /(\d+)\D+(\d+)/; $hash{$1} = $2; } @$info;
 
@@ -250,7 +252,8 @@ sub uidl
   }
  else
   {
-   my $ref = $me->read_until_dot;
+   my $ref = $me->read_until_dot
+        or return undef;
    my $ln;
    $uidl = {};
    foreach $ln (@$ref) {