Could you try the following comparison instead?

        p = buf + strlen(buf) - 1;
        if (p == buf || (p[0] == '\n' && p[-1] != '\r')) {
            /* either a \0 by itself or a \n without a \r */
            p[0] = '\r';
            p[1] = '\n';
            p[2] = '\0';

The test is important to make sure that no bare \n get through.

Larry

--On Tuesday, January 02, 2001 10:27:53 PM +0800 missing wang 
<[EMAIL PROTECTED]> wrote:

> Although the RFC describle that length of each line in a letter is between
> 70-80 ,some mail server send letter in extra long line beyond the number.
> When the length beyond 8k,the cyrus can't store the letter correctly.
> I patched the imap/lmtpengine.c,now she works well.
>
> *** lmtpengine.c.orig   Tue Jan  2 21:57:49 2001
> --- lmtpengine.c        Tue Jan  2 21:58:15 2001
> ***************
> *** 528,534 ****
>
>       while (prot_fgets(buf, sizeof(buf)-1, fin)) {
>         p = buf + strlen(buf) - 1;
> !       if (p == buf || p[-1] != '\r') {
>             p[0] = '\r';
>             p[1] = '\n';
>             p[2] = '\0';
> --- 528,534 ----
>
>       while (prot_fgets(buf, sizeof(buf)-1, fin)) {
>         p = buf + strlen(buf) - 1;
> !       if (p == buf) {
>             p[0] = '\r';
>             p[1] = '\n';
>             p[2] = '\0';
>
>
>




Reply via email to