istream-raw-mbox.c revision 5bfe0d3dd969dfb7e778af7bfab095a9628bee5e
0N/A/* Copyright (c) 2003-2008 Dovecot authors, see the included COPYING file */ 0N/A /* from_offset points to "\nFrom ", so unless we're at the beginning 0N/A of the file, skip the initial \n */ 0N/A /* EOF shouldn't happen */ 0N/A /* beginning of mbox */ 0N/A /* broken From - should happen only at beginning of 0N/A file if this isn't a mbox.. */ 0N/A /* we'll skip over From-line */ 0N/A /* a) Header didn't have ending \n 0N/A b) "headers\n\nFrom ..", the second \n belongs to next 0N/A message which we didn't know at the time yet. 0N/A The +2 check is for CR+LF linefeeds */ 0N/A /* fake our read count. needed because if in the end 0N/A we have only one character in buffer and we skip it 0N/A (as potential CR), we want to get back to this 0N/A i_stream_raw_mbox_read() to read more data. */ 0N/A /* we've read the whole file, final byte should be 0N/A /* haven't seen From-line yet, so this mbox 0N/A stream is now at EOF */ 0N/A /* beginning of message, we haven't yet read our From-line */ 0N/A /* we're at the end of file with CR+LF linefeeds? 0N/A need more data to verify it. */ 0N/A /* got it. we don't want to return it however, 0N/A so start again from headers */ 0N/A /* See if we have From-line here - note that it works right only 0N/A because all characters are different in mbox_from. */ 229N/A /* potential From-line, see if we have the 229N/A rest of the line buffered. 229N/A FIXME: if From-line is longer than input 0N/A buffer, we break. probably irrelevant.. */ /* CR also belongs to it. */ /* we have the whole From-line here now. See if it's a valid one. */ /* we want to go at least one byte further next time */ /* we're waiting for the \n at the end of From-line */ /* leave out the beginnings of potential From-line + CR */ /* istream_raw_mbox_set_next_offset() used invalid i_error(
"Next message unexpectedly lost from mbox file " static const struct stat *
const unsigned char *
data;
/* minimal: "From x Thu Nov 29 22:33:52 2001" = 31 chars */ i_error(
"Unexpectedly lost From-line from mbox file %s at " i_error(
"Unexpectedly lost From-line from mbox file " const unsigned char *
data;
/* if we already have the existing body size, use it as long as it's >= expected body_size. otherwise the previous parsing may have stopped at a From_-line that belongs to the body. */ /* invalid expected_body_size */ /* have to read through the message body */ /* back to beginning of current message */