@ -1153,28 +1153,29 @@ maildir_scan( maildir_store_t *ctx, msg_t_array_alloc_t *msglist )
goto retry ;
goto retry ;
}
}
int off , in_msgid = 0 ;
int off , in_msgid = 0 ;
while ( ( want_tuid | | want_msgid ) & & fgets ( nbuf , sizeof ( nbuf ) , f ) ) {
char lnbuf [ 1000 ] ; // Says RFC2822
int bufl = strlen ( nbuf ) ;
while ( ( want_tuid | | want_msgid ) & & fgets ( lnbuf , sizeof ( lnbuf ) , f ) ) {
if ( bufl & & nbuf [ bufl - 1 ] = = ' \n ' )
int bufl = strlen ( lnbuf ) ;
if ( bufl & & lnbuf [ bufl - 1 ] = = ' \n ' )
- - bufl ;
- - bufl ;
if ( bufl & & nbuf [ bufl - 1 ] = = ' \r ' )
if ( bufl & & l nbuf[ bufl - 1 ] = = ' \r ' )
- - bufl ;
- - bufl ;
if ( ! bufl )
if ( ! bufl )
break ;
break ;
if ( want_tuid & & starts_with ( nbuf , bufl , " X-TUID: " , 8 ) ) {
if ( want_tuid & & starts_with ( l nbuf, bufl , " X-TUID: " , 8 ) ) {
if ( bufl < 8 + TUIDL ) {
if ( bufl < 8 + TUIDL ) {
error ( " Maildir error: malformed X-TUID header (UID %u) \n " , uid ) ;
error ( " Maildir error: malformed X-TUID header (UID %u) \n " , uid ) ;
continue ;
continue ;
}
}
memcpy ( entry - > tuid , nbuf + 8 , TUIDL ) ;
memcpy ( entry - > tuid , l nbuf + 8 , TUIDL ) ;
want_tuid = 0 ;
want_tuid = 0 ;
in_msgid = 0 ;
in_msgid = 0 ;
continue ;
continue ;
}
}
if ( want_msgid & & starts_with_upper ( nbuf , bufl , " MESSAGE-ID: " , 11 ) ) {
if ( want_msgid & & starts_with_upper ( l nbuf, bufl , " MESSAGE-ID: " , 11 ) ) {
off = 11 ;
off = 11 ;
} else if ( in_msgid ) {
} else if ( in_msgid ) {
if ( ! isspace ( nbuf [ 0 ] ) ) {
if ( ! isspace ( l nbuf[ 0 ] ) ) {
in_msgid = 0 ;
in_msgid = 0 ;
continue ;
continue ;
}
}
@ -1182,13 +1183,13 @@ maildir_scan( maildir_store_t *ctx, msg_t_array_alloc_t *msglist )
} else {
} else {
continue ;
continue ;
}
}
while ( off < bufl & & isspace ( nbuf [ off ] ) )
while ( off < bufl & & isspace ( l nbuf[ off ] ) )
off + + ;
off + + ;
if ( off = = bufl ) {
if ( off = = bufl ) {
in_msgid = 1 ;
in_msgid = 1 ;
continue ;
continue ;
}
}
entry - > msgid = nfstrndup ( nbuf + off , bufl - off ) ;
entry - > msgid = nfstrndup ( l nbuf + off , bufl - off ) ;
want_msgid = 0 ;
want_msgid = 0 ;
in_msgid = 0 ;
in_msgid = 0 ;
}
}