diff options
author | Steve Hay <steve.m.hay@googlemail.com> | 2014-06-03 09:15:36 +0100 |
---|---|---|
committer | Steve Hay <steve.m.hay@googlemail.com> | 2014-06-03 09:15:36 +0100 |
commit | f1ca43cf5ff96f057b9c902bacedf0b0099790c2 (patch) | |
tree | f91a3ab83cafa844017b9afb67e7f831f72fb41c | |
parent | 9155076257b16507c87f99829773b5d65fb71bba (diff) | |
download | perl-libnet-f1ca43cf5ff96f057b9c902bacedf0b0099790c2.tar.gz |
Make removal of failed mechanism safer
(Removing a space before and after would join the preceding and following mechanisms together. Also, escape any regexp metacharacters.)
-rw-r--r-- | Net/SMTP.pm | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Net/SMTP.pm b/Net/SMTP.pm index 51e66d3..72ad541 100644 --- a/Net/SMTP.pm +++ b/Net/SMTP.pm @@ -188,10 +188,10 @@ sub auth { do { if ($client) { # $client mechanism failed, so we need to exclude this mechanism from list - my $failed_mech = $client->mechanism; - $self->debug_text ("Auth mechanism failed: $failed_mech") + my $failed_mechanism = $client->mechanism; + $self->debug_text ("Auth mechanism failed: $failed_mechanism") if $self->debug; - $mechanisms =~ s/(?:\s|^)$failed_mech(?:\s|$)//; + $mechanisms =~ s/\b\Q$failed_mechanism\E\b//; } $sasl->mechanism ($mechanisms); |