Subject: Crash problem with maill_search_full function

From: "Guillaume Vaillant" <[email-masked]>
Date: Tue, 23 Dec 2003 18:01:39 +0100

I try use the c-client API to build a IMAP proxy.
I have a serious problem with the search. 
I try to perform a search on a mailbox with the mail_search_full but when I perform some stressing tests this function crashed.

I use it in a multi-threaded program like below :
    SEARCHPGM *sPgm;
    long lFlags;
    sPgm = mail_criteria("UNDELETED SUBJECT VoiceMail);
    lFlags = SE_FREE;
    mail_search_full(TabUser[localId].UserStream,NIL,sPgm,lFlags);

When i look the generated core file, the crash is often in the "imap_parse_unsolicited" function.
This function parse the reply. The parsing seems to be based on the reply->key value.
When the function crashed, the reply looks like :
{line = 0x8916638 " INTERNALDATE", tag = 0x89183b0 "", key = 0x89183b2 "", text = 0x89183b4 ""}

Is it normal that the key is empty ?

Thank's for your help
Guyom.

---

From: Mark Crispin <[email-masked]>
Date: Tue, 23 Dec 2003 14:59:35 -0800 (Pacific Standard Time)

On Tue, 23 Dec 2003, Guillaume Vaillant wrote:
> I use it in a multi-threaded program

If you are using c-client in a multi-threaded program, have you verified
that your C library's implementation of such routines as strtok() is
thread-safe?

If not, you'll have to change the c-client calls to such functions to
whatever thread-safe versions there are in your system's C library.

-- Mark --

http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.