# what was picked by SELECT
my $selected;
+# Any IMAP parameter can come in escaped and in double quotes.
+# This function is dumb (so far) and just removes the quotes if present.
+sub fix_imap_params {
+ foreach (@_) {
+ $_ = $1 if /^"(.*)"$/;
+ }
+}
+
sub CAPABILITY_imap {
my ($testno) = @_;
my $data;
sub SELECT_imap {
my ($testno) = @_;
+ fix_imap_params($testno);
logmsg "SELECT_imap got test $testno\n";
my ($uid, $how) = split(/ /, $args, 2);
my @data;
my $size;
+ fix_imap_params($uid, $how);
logmsg "FETCH_imap got $args\n";
- if($selected =~ /^verifiedserver$/) {
+ if($selected eq "verifiedserver") {
# this is the secret command that verifies that this actually is
# the curl test server
my $response = "WE ROOLZ: $$\r\n";
$args =~ /^([^ ]+) [^{]*\{(\d+)\}$/;
my ($folder, $size) = ($1, $2);
+ fix_imap_params($folder);
sendcontrol "+ Ready for literal data\r\n";
sub STORE_imap {
my ($args) = @_;
my ($uid, $what) = split(/ /, $args, 2);
+ fix_imap_params($uid);
logmsg "STORE_imap got $args\n";
my ($args) = @_;
my ($reference, $mailbox) = split(/ /, $args, 2);
my @data;
+ fix_imap_params($reference, $mailbox);
logmsg "LIST_imap got $args\n";
- if ($reference eq '"verifiedserver"') {
+ if ($reference eq "verifiedserver") {
# this is the secret command that verifies that this actually is
# the curl test server
@data = ("* LIST () \"/\" \"WE ROOLZ: $$\"\r\n");