Skip Menu |

This queue is for tickets about the IMAP-Client CPAN distribution.

Report information
The Basics
Id: 39212
Status: new
Priority: 0/
Queue: IMAP-Client

People
Owner: Nobody in particular
Requestors: perlrt [...] nslm.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.13
Fixed in: (no value)



Subject: Unquoted special characters passed into regexes.
Unquoted special characters in mailbox names are being passed directly into regexes, they need to be unquoted for passing to the IMAP server, but need to be quoted for the regexes. This means that when a user does things like use "++" in the name of a mailbox errors are thrown. Fix attached.
Subject: quotameta.diff
Index: IMAP/Client.pm =================================================================== --- IMAP/Client.pm (revision 39) +++ IMAP/Client.pm (revision 57) @@ -599,7 +599,8 @@ my %quota; foreach my $line (@resp) { - if (my @resources = ($line =~ /^\* QUOTA $localroot ($parens+)\r\n$/)) { + my $localrootQuot = quotemeta $localroot; + if (my @resources = ($line =~ /^\* QUOTA ${localrootQuot} ($parens+)\r\n$/)) { foreach my $resource (@resources) { my ($topic, $values) = ($resource =~ /^\((\w+) (\d+ \d+)\)$/); if (defined $topic) { @@ -607,7 +608,7 @@ $quota{$topic} = \@numbers; } } - } elsif (my ($ref) = ($line =~ /^\* QUOTAROOT $localroot (.*)\r\n$/)) { + } elsif (my ($ref) = ($line =~ /^\* QUOTAROOT ${localrootQuot} (.*)\r\n$/)) { $quota{'ROOT'} = $ref; $localroot = $ref; } @@ -1927,7 +1928,8 @@ my %permissions; foreach my $line (@resp) { - if (my ($set) = ($line =~ /^\* ACL \"?$mailbox\"? (.*)\r\n$/i)) { #" + my $mailboxQuot = quotemeta $mailbox; + if (my ($set) = ($line =~ /^\* ACL \"?${mailboxQuot}\"? (.*)\r\n$/i)) { #" my %_hash = split(/ /,$set); # split out user/perms set foreach my $user (keys %_hash) { my %_perms = map {$_ => 1} split(//,$_hash{$user}); @@ -1997,7 +1999,9 @@ my %permissions; foreach my $line (@resp) { - if (my ($permissionstring) = ($line =~ /^\* LISTRIGHTS $mailbox $user (.*)\r\n$/i)) { + my $mailboxQuot = quotemeta $mailbox; + my $userQuot = quotemeta $user; + if (my ($permissionstring) = ($line =~ /^\* LISTRIGHTS ${mailboxQuot} ${userQuot} (.*)\r\n$/i)) { %permissions = map{ $_ => 1 } split(/ /,$permissionstring); } } @@ -2021,7 +2025,8 @@ my %permissions; foreach my $line (@resp) { - if (my ($permissionstring) = ($line =~ /^\* MYRIGHTS \"?$mailbox\"? (.*)\r\n$/i)) { #" + my $mailboxQuot = quotemeta $mailbox; + if (my ($permissionstring) = ($line =~ /^\* MYRIGHTS \"?${mailboxQuot}\"? (.*)\r\n$/i)) { #" %permissions = map {$_ => 1} split(//,$permissionstring); } } @@ -2324,7 +2329,8 @@ my %results = ($mailbox => undef); foreach my $line (@{$resp}) { $line =~ s/[\r\n]//gs; # Remove newlines - my ($more) = $line =~ /\s*\*\s+ANNOTATION\s+\"?$mailbox\"?\s+(.*)$/; #" + my $mailboxQuot = quotemeta $mailbox; + my ($more) = $line =~ /\s*\*\s+ANNOTATION\s+\"?${mailboxQuot}\"?\s+(.*)$/; #" while ($more) { $self->dprint(0x04, "getannotation processing with [$more]\n"); my ($entry, $attrset, $less) = $more =~ /\"?([^\"\s]+)\"?\s+($parens)(.*)/; #"