[dovecot-cvs] dovecot/src/lib-storage/index index-mail-headers.c,
1.40, 1.41
cras at dovecot.org
cras at dovecot.org
Thu Jan 6 23:12:22 EET 2005
Update of /var/lib/cvs/dovecot/src/lib-storage/index
In directory talvi:/tmp/cvs-serv2866/lib-storage/index
Modified Files:
index-mail-headers.c
Log Message:
mail->get_header() was pretty broken. This affected SORT/THREAD.
Index: index-mail-headers.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/index-mail-headers.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- index-mail-headers.c 8 Oct 2004 17:51:49 -0000 1.40
+++ index-mail-headers.c 6 Jan 2005 21:12:19 -0000 1.41
@@ -179,6 +179,8 @@
enum mail_cache_decision_type decision;
const char *cache_field_name;
unsigned int field_idx;
+ uint8_t *match;
+ size_t size;
int timezone, first_hdr = FALSE;
data->parse_line_num++;
@@ -260,21 +262,16 @@
}
}
- if (!data->parse_line.cache) {
- uint8_t *match;
- size_t size;
-
- match = buffer_get_modifyable_data(mail->header_match, &size);
- if (field_idx >= size ||
- (match[field_idx] & ~1) != mail->header_match_value) {
- /* we don't need to do anything with this header */
- return TRUE;
- }
- if (match[field_idx] == mail->header_match_value) {
- /* first header */
- first_hdr = TRUE;
- match[field_idx]++;
- }
+ match = buffer_get_modifyable_data(mail->header_match, &size);
+ if (field_idx < size && match[field_idx] == mail->header_match_value) {
+ /* first header */
+ first_hdr = TRUE;
+ match[field_idx]++;
+ } else if (!data->parse_line.cache &&
+ (field_idx >= size ||
+ (match[field_idx] & ~1) != mail->header_match_value)) {
+ /* we don't need to do anything with this header */
+ return TRUE;
}
if (!hdr->continued) {
@@ -435,7 +432,7 @@
size_t size;
offsets = buffer_get_data(mail->header_offsets, &size);
- i_assert(field_idx * sizeof(*offsets) >= size &&
+ i_assert(field_idx * sizeof(*offsets) <= size &&
offsets[field_idx] != 0);
data = buffer_get_data(mail->header_data, &size);
@@ -485,6 +482,11 @@
index_mail_get_parsed_header(mail, field_idx);
}
+ if (str_len(dest) == 0) {
+ /* cached as non-existing. */
+ return NULL;
+ }
+
/* cached. skip "header name: " in dest. */
data = str_data(dest);
len = str_len(dest);
More information about the dovecot-cvs
mailing list