[Bps-public-commit] r18890 - in Net-IMAP-Server: lib/Net/IMAP/Server/Command
alexmv at bestpractical.com
alexmv at bestpractical.com
Fri Mar 20 14:14:48 EDT 2009
Author: alexmv
Date: Fri Mar 20 14:14:48 2009
New Revision: 18890
Modified:
Net-IMAP-Server/ (props changed)
Net-IMAP-Server/lib/Net/IMAP/Server/Command/Create.pm
Log:
r43094 at kohr-ah: chmrr | 2009-03-10 13:45:15 -0400
Ensure that mailboxes passed to CREATE aren't trying to encode things
they shouldn't be, by round-tripping and comparing.
Modified: Net-IMAP-Server/lib/Net/IMAP/Server/Command/Create.pm
==============================================================================
--- Net-IMAP-Server/lib/Net/IMAP/Server/Command/Create.pm (original)
+++ Net-IMAP-Server/lib/Net/IMAP/Server/Command/Create.pm Fri Mar 20 14:14:48 2009
@@ -17,6 +17,16 @@
my $mailbox = $self->connection->model->lookup( @options );
return $self->no_command("Mailbox already exists") if $mailbox;
+ # This both ensures that the mailbox path is valid UTF-7, and that
+ # there aren't bogusly encoded characters (like '/' -> '&AC8-')
+ my $roundtrip = eval {
+ Encode::encode( 'IMAP-UTF-7',
+ Encode::decode( 'IMAP-UTF-7', $options[0] ) );
+ };
+
+ return $self->bad_command("Invalid UTF-7 encoding")
+ unless $roundtrip eq $options[0];
+
return 1;
}
More information about the Bps-public-commit
mailing list