[dovecot-cvs] dovecot/src/lib-storage/index/mbox istream-raw-mbox.c, 1.39, 1.40

cras at dovecot.org cras at dovecot.org
Thu Jan 26 22:42:51 EET 2006


Update of /var/lib/cvs/dovecot/src/lib-storage/index/mbox
In directory talvi:/tmp/cvs-serv9675/src/lib-storage/index/mbox

Modified Files:
	istream-raw-mbox.c 
Log Message:
Boolean changes broke istream_raw_mbox_is_valid_from() when it hit
unexpected EOF. So broken Content-Length headers at the end of files gave
"file size unexpectedly shrinked in mbox" errors.



Index: istream-raw-mbox.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/istream-raw-mbox.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- istream-raw-mbox.c	14 Jan 2006 18:47:52 -0000	1.39
+++ istream-raw-mbox.c	26 Jan 2006 20:42:49 -0000	1.40
@@ -340,7 +340,7 @@
 				input->real_stream->abs_start_offset);
 }
 
-static bool istream_raw_mbox_is_valid_from(struct raw_mbox_istream *rstream)
+static int istream_raw_mbox_is_valid_from(struct raw_mbox_istream *rstream)
 {
 	const unsigned char *data;
 	size_t size;
@@ -354,7 +354,7 @@
 	if ((size == 1 && data[0] == '\n') ||
 	    (size == 2 && data[0] == '\r' && data[1] == '\n')) {
 		/* EOF */
-		return TRUE;
+		return 1;
 	}
 
 	if (size > 31 && memcmp(data, "\nFrom ", 6) == 0) {
@@ -364,7 +364,7 @@
 		data += 7;
 		size -= 7;
 	} else {
-		return FALSE;
+		return 0;
 	}
 
 	while (memchr(data, '\n', size) == NULL) {
@@ -373,12 +373,12 @@
 	}
 
 	if (mbox_from_parse(data, size, &received_time, &sender) < 0)
-		return FALSE;
+		return 0;
 
 	rstream->next_received_time = received_time;
 	i_free(rstream->next_sender);
 	rstream->next_sender = sender;
-	return TRUE;
+	return 1;
 }
 
 uoff_t istream_raw_mbox_get_start_offset(struct istream *stream)



More information about the dovecot-cvs mailing list