about summary refs log tree commit
diff options
context:
space:
mode:
authorSteve Hay <steve.m.hay@googlemail.com>2014-06-03 09:15:36 +0100
committerSteve Hay <steve.m.hay@googlemail.com>2014-06-03 09:15:36 +0100
commitf1ca43cf5ff96f057b9c902bacedf0b0099790c2 (patch)
treef91a3ab83cafa844017b9afb67e7f831f72fb41c
parent9155076257b16507c87f99829773b5d65fb71bba (diff)
downloadperl-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.pm6
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);