Skip Menu |

This queue is for tickets about the Mail-IMAPClient CPAN distribution.

Report information
The Basics
Id: 20703
Status: resolved
Priority: 0/
Queue: Mail-IMAPClient

People
Owner: Nobody in particular
Requestors: hjp [...] hjp.at
Cc:
AdminCc:

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



Subject: migrate double-encodes target mailbox
Date: Thu, 27 Jul 2006 00:42:11 +0200
To: bug-Mail-IMAPClient [...] rt.cpan.org
From: "Peter J. Holzer" <hjp [...] hjp.at>
Version-Information: $Mail::IMAPClient::VERSION = 2.2.9 perl 5.8.4. The problem surfaced when migrating folders from a Courier Imapd to a Lotus Domino (7.0) server. In Mail::IMAPClient::migrate, if a message is less than the buffer size (4k by default), $peer->append_string is used to store the message on the target server. Before the call, the folder name is passed through $peer->Massage, but append_string calls Massage on the foldername, too, resulting in encoded mailbox names like "{26}\r\n{20}\r\nmailing-lists\\backup" (Lotus Domino used "\\" as hierarchy separator). The attached patch removes the call to Massage from migrate and leaves the call to Massage in append_string, where I think it belongs. As a consequence of the error above, migrate and the IMAP server where getting out of sync, which triggered a in the parsing of IMAP error messages in the case of long messages. The error condition wasn't detected and migrate started to allocate memory in an endless loop. The second chunk in the patch fixes this - this hasn't been tested thoroughly, because this problem vanished after fixing the other bug. hp -- _ | Peter J. Holzer | > Wieso sollte man etwas erfinden was nicht |_|_) | Sysadmin WSR | > ist? | | | hjp@hjp.at | Was sonst wäre der Sinn des Erfindens? __/ | http://www.hjp.at/ | -- P. Einstein u. V. Gringmuth in desd --- /usr/share/perl5/Mail/IMAPClient.pm.2006-07-26T15:16:35 2005-01-31 23:30:23.000000000 +0100 +++ /usr/share/perl5/Mail/IMAPClient.pm 2006-07-26 15:54:12.000000000 +0200 @@ -752,7 +752,7 @@ # If msg size is less than buffersize then do whole msg in one # transaction: if ( $size <= $bufferSize ) { - my $new_mid = $peer->append_string($peer->Massage($folder), + my $new_mid = $peer->append_string($folder, $self->message_string($mid) ,$flags, $intDate) ; $self->_debug("Copied message $mid in folder $folder to " . @@ -825,6 +825,14 @@ #$peer->_debug("migrate: response from target server: " . # "$fromBuffer<END>\n") if $peer->Debug; + if ($fromBuffer =~ /^(\+)/) { + $code = $1; + } elsif ($fromBuffer =~ /^(?:\d+\s(BAD|NO|OK))/) { + $code = $1; + } else { + $code = 0; + } + ($code)= $fromBuffer =~ /^(\+)|^(?:\d+\s(?:BAD|NO))/ ; $code ||=0; @@ -3168,6 +3176,10 @@ sub selectable {my($s,$f)=@_;return grep(/NoSelect/i,$s->list("",$f))?0:1;} +# $self->append_string($folder, $string) appends message $string to +# folder $folder. +# +# $folder must be given unmassaged! sub append_string { my $self = shift;
New maintainer Both accounts were correct. Changed your second suggestion into $code = $fromBuffer =~ /^(\+)/ ? $1 : $fromBuffer =~ /^(?:\d+\s(BAD|NO|OK))/ ? $1 : 0; Will be in 2.99_02