Bug 674263

Summary: message search with non-ascii or non-UTF8 string fails
Product: Red Hat Enterprise Linux 4 Reporter: Takashi Sato <tsato>
Component: dovecotAssignee: Michal Hlavinka <mhlavink>
Status: CLOSED WONTFIX QA Contact: qe-baseos-daemons
Severity: medium Docs Contact:
Priority: medium    
Version: 4.8   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-02-08 14:56:58 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
patch for dovecot-0.99.11-9 (RHEL 4.8) none

Description Takashi Sato 2011-02-01 08:53:02 UTC
Created attachment 476333 [details]
patch for dovecot-0.99.11-9 (RHEL 4.8)

Description of problem:

searching message for dovecot with non-ascii or non-UTF8 string fails.

Version-Release number of selected component (if applicable):

- Red Hat Enterprise Linux 4
- dovecot-0.99.11

How reproducible:

Always with iso-2022-jp

Steps to Reproduce:

# telnet localhost 143
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
* OK dovecot ready.
01 login testuser redhat
01 OK Logged in.
02 examine inbox
* FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
* OK [PERMANENTFLAGS ()] Read-only mailbox.
* 3 EXISTS
* 2 RECENT
* OK [UIDVALIDITY 1296113318] UIDs valid
* OK [UIDNEXT 11] Predicted next UID
02 OK [READ-ONLY] Select completed.
03 fetch 1:3 (uid)
* 1 FETCH (UID 8)
* 2 FETCH (UID 9)
* 3 FETCH (UID 10)
03 OK Fetch completed.
04 uid search charset iso-2022-jp uid 8:10 (text "^[$B$F$9$H^[(B")

Connection closed by foreign host.

Actual results:

imap aborted with segfault.
Or, no search results return.

Expected results:

Search succeeds as follows.

04 uid search charset iso-2022-jp uid 8:10 (text "^[$B$F$9$H^[(B")
* SEARCH 10
04 OK Search completed.


Additional info:

The reason why iconv fails is that UTF-8 encoded string is treated as iso-2022-jp string.

While searching messages, charset_to_ucase_utf8_string() is called twice.
At first time, passed character string is encoded with iso-2022-jp. 
At second time, it's encoded with UTF-8.

I attached patch for dovecot-0.99.11-9 (RHEL 4.8).

Comment 1 Michal Hlavinka 2011-02-08 14:56:58 UTC
I'm sorry for not addressing the issue in RHEL-4. As dovecot was not scheduled for update in RHEL-4.9, which is last regular update release,  I'm closing this bugzilla WONTFIX. If you are still experiencing the issue with RHEL-5 or RHEL-6, feel free to reopen it against RHEL-5 or RHEL-6 respectively.