diff options
author | Steve Hay <steve.m.hay@googlemail.com> | 2014-06-03 13:11:03 +0100 |
---|---|---|
committer | Steve Hay <steve.m.hay@googlemail.com> | 2014-06-03 13:11:03 +0100 |
commit | e085102cfdeaa08794a0cd9bb2c6672edfb29336 (patch) | |
tree | 01b7799d4bb912b803748d3bda2a109a2b214829 | |
parent | f1ca43cf5ff96f057b9c902bacedf0b0099790c2 (diff) | |
download | perl-libnet-e085102cfdeaa08794a0cd9bb2c6672edfb29336.tar.gz |
Exit loop over AUTH mechanisms when there are no more left to avoid infinite loop
-rw-r--r-- | Net/SMTP.pm | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Net/SMTP.pm b/Net/SMTP.pm index 72ad541..a889402 100644 --- a/Net/SMTP.pm +++ b/Net/SMTP.pm @@ -189,11 +189,12 @@ sub auth { if ($client) { # $client mechanism failed, so we need to exclude this mechanism from list my $failed_mechanism = $client->mechanism; - $self->debug_text ("Auth mechanism failed: $failed_mechanism") + $self->debug_text("Auth mechanism failed: $failed_mechanism") if $self->debug; $mechanisms =~ s/\b\Q$failed_mechanism\E\b//; + last unless $mechanisms =~ /\S/; } - $sasl->mechanism ($mechanisms); + $sasl->mechanism($mechanisms); # We should probably allow the user to pass the host, but I don't # currently know and SASL mechanisms that are used by smtp that need it |