Ticket #1483855 (closed Bugs: fixed)

Opened 3 years ago

Last modified 2 years ago

Search fails when BincIMAP is used as a server

Reported by: jpingle Owned by:
Priority: 5 Milestone:
Component: IMAP connection Version: 0.1-beta
Severity: minor Keywords:
Cc:

Description

I am unable to comlpete a search when I use BincIMAP as the backend. This appears to be a character encoding issue with BincIMAP.

A tcpdump of the action revealed that Binc doesn't like UTF-8 in searches. Would it be possible for the search function to nicely failover to US-ASCII or another charset (depending on location, or returned by the server as seen below) if a UTF-8 search fails?

>>> srch1 SEARCH CHARSET UTF-8 SUBJECT "foo"
<<< srch1 NO [BADCHARSET ("US-ASCII")] SEARCH failed:
>>> srch1 SEARCH CHARSET UTF-8 FROM "foo"
<<< srch1 NO [BADCHARSET ("US-ASCII")] SEARCH failed:

Attachments

bincimap_search_fix.diff (1.1 kB) - added by jpingle 3 years ago.
Possible BincIMAP search fix - If UTF-8 search fails, try w/o charset.
bincimap_search_fix.2.diff (1.1 kB) - added by jpingle 2 years ago.
Better patch than the previous fix that wasn't really complete.

Change History

Changed 3 years ago by jpingle

  • severity changed from normal to minor

I was able to get the search function to work by changing line 860 of program/include/rcube_imap.inc

From:

$criteria = 'CHARSET UTF-8 '.$criteria.' "'.UTF7EncodeString($str).'"';

To:

$criteria = 'CHARSET US-ASCII '.$criteria.' "'.$str.'"';

Obviously not a very elegant solution (or possible in some environments, I'm sure), but one that does allow us to Search messages for now.

Changed 3 years ago by jpingle

Possible BincIMAP search fix - If UTF-8 search fails, try w/o charset.

Changed 3 years ago by jpingle

See the attached diff. I changed the search function to check if the search initially fails, and if it does, re-try the search without a specified charset.

It's working for me, but could use more testing.

Changed 2 years ago by jpingle

Better patch than the previous fix that wasn't really complete.

Changed 2 years ago by jpingle

I noticed a pretty bad problem with the previous patch, it ignored one of the original test cases.

I attached a new copy of the patch, which as previously mentioned will resend an imap search without a specifid charset if the search fails (returns false) which should only happen if the server generates an error on the search attempt -- not just an empty set of messages.

Changed 2 years ago by thomasb

  • status changed from new to closed
  • resolution set to fixed

Added fallback to search without charset. Charset search could be something to configure (like Squirrelmail does).

Note: See TracTickets for help on using tickets.