Mercurial > dovecot > original-hg > dovecot-1.2
annotate src/lib-index/mail-index-fsck.c @ 9458:adee8cb3ff5d HEAD
Minor memory allocation tweaks.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 28 Oct 2009 14:10:04 -0400 |
parents | b9faf4db2a9f |
children | 00cd9aacd03c |
rev | line source |
---|---|
8590
b9faf4db2a9f
Updated copyright notices to include year 2009.
Timo Sirainen <tss@iki.fi>
parents:
8547
diff
changeset
|
1 /* Copyright (c) 2004-2009 Dovecot authors, see the included COPYING file */ |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
2 |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
3 #include "lib.h" |
5754
0096aaf83731
Do a bit better job with fscking.
Timo Sirainen <tss@iki.fi>
parents:
5689
diff
changeset
|
4 #include "ioloop.h" |
6385
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
5 #include "array.h" |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
6 #include "mail-index-private.h" |
8060
4bfe7618743e
Index opening: If there's broken index and no .log, don't crash.
Timo Sirainen <tss@iki.fi>
parents:
7226
diff
changeset
|
7 #include "mail-transaction-log-private.h" |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
8 |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
9 static void mail_index_fsck_error(struct mail_index *index, |
6411
6a64e64fa3a3
Renamed __attr_*__ to ATTR_*. Renamed __attrs_used__ to ATTRS_DEFINED.
Timo Sirainen <tss@iki.fi>
parents:
6386
diff
changeset
|
10 const char *fmt, ...) ATTR_FORMAT(2, 3); |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
11 static void mail_index_fsck_error(struct mail_index *index, |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
12 const char *fmt, ...) |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
13 { |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
14 va_list va; |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
15 |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
16 va_start(va, fmt); |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
17 mail_index_set_error(index, "Fixed index file %s: %s", |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
18 index->filepath, t_strdup_vprintf(fmt, va)); |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
19 va_end(va); |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
20 } |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
21 |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
22 #define CHECK(field, oper) \ |
6382 | 23 if (hdr->field oper map->hdr.field) { \ |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
24 mail_index_fsck_error(index, #field" %u -> %u", \ |
6382 | 25 map->hdr.field, hdr->field); \ |
5019 | 26 } |
27 | |
6381 | 28 static void |
8060
4bfe7618743e
Index opening: If there's broken index and no .log, don't crash.
Timo Sirainen <tss@iki.fi>
parents:
7226
diff
changeset
|
29 mail_index_fsck_log_pos(struct mail_index *index, struct mail_index_map *map, |
4bfe7618743e
Index opening: If there's broken index and no .log, don't crash.
Timo Sirainen <tss@iki.fi>
parents:
7226
diff
changeset
|
30 struct mail_index_header *hdr) |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
31 { |
5754
0096aaf83731
Do a bit better job with fscking.
Timo Sirainen <tss@iki.fi>
parents:
5689
diff
changeset
|
32 uint32_t file_seq; |
0096aaf83731
Do a bit better job with fscking.
Timo Sirainen <tss@iki.fi>
parents:
5689
diff
changeset
|
33 uoff_t file_offset; |
6382 | 34 |
35 mail_transaction_log_get_head(index->log, &file_seq, &file_offset); | |
36 if (hdr->log_file_seq < file_seq) { | |
37 hdr->log_file_head_offset = hdr->log_file_tail_offset = | |
38 sizeof(struct mail_transaction_log_header); | |
39 } else { | |
40 if (hdr->log_file_head_offset > file_offset) | |
41 hdr->log_file_head_offset = file_offset; | |
42 if (hdr->log_file_tail_offset > hdr->log_file_head_offset) | |
43 hdr->log_file_tail_offset = hdr->log_file_head_offset; | |
44 } | |
45 hdr->log_file_seq = file_seq; | |
46 | |
47 CHECK(log_file_seq, !=); | |
48 if (hdr->log_file_seq == map->hdr.log_file_seq) { | |
49 /* don't bother complaining about these if file changed too */ | |
50 CHECK(log_file_head_offset, !=); | |
51 CHECK(log_file_tail_offset, !=); | |
52 } | |
53 } | |
54 | |
8060
4bfe7618743e
Index opening: If there's broken index and no .log, don't crash.
Timo Sirainen <tss@iki.fi>
parents:
7226
diff
changeset
|
55 static void |
4bfe7618743e
Index opening: If there's broken index and no .log, don't crash.
Timo Sirainen <tss@iki.fi>
parents:
7226
diff
changeset
|
56 mail_index_fsck_header(struct mail_index *index, struct mail_index_map *map, |
4bfe7618743e
Index opening: If there's broken index and no .log, don't crash.
Timo Sirainen <tss@iki.fi>
parents:
7226
diff
changeset
|
57 struct mail_index_header *hdr) |
4bfe7618743e
Index opening: If there's broken index and no .log, don't crash.
Timo Sirainen <tss@iki.fi>
parents:
7226
diff
changeset
|
58 { |
4bfe7618743e
Index opening: If there's broken index and no .log, don't crash.
Timo Sirainen <tss@iki.fi>
parents:
7226
diff
changeset
|
59 /* mail_index_map_check_header() has already checked that the index |
4bfe7618743e
Index opening: If there's broken index and no .log, don't crash.
Timo Sirainen <tss@iki.fi>
parents:
7226
diff
changeset
|
60 isn't completely broken. */ |
4bfe7618743e
Index opening: If there's broken index and no .log, don't crash.
Timo Sirainen <tss@iki.fi>
parents:
7226
diff
changeset
|
61 if (hdr->uid_validity == 0 && hdr->next_uid != 1) |
4bfe7618743e
Index opening: If there's broken index and no .log, don't crash.
Timo Sirainen <tss@iki.fi>
parents:
7226
diff
changeset
|
62 hdr->uid_validity = ioloop_time; |
4bfe7618743e
Index opening: If there's broken index and no .log, don't crash.
Timo Sirainen <tss@iki.fi>
parents:
7226
diff
changeset
|
63 |
4bfe7618743e
Index opening: If there's broken index and no .log, don't crash.
Timo Sirainen <tss@iki.fi>
parents:
7226
diff
changeset
|
64 if (index->log->head != NULL) |
4bfe7618743e
Index opening: If there's broken index and no .log, don't crash.
Timo Sirainen <tss@iki.fi>
parents:
7226
diff
changeset
|
65 mail_index_fsck_log_pos(index, map, hdr); |
4bfe7618743e
Index opening: If there's broken index and no .log, don't crash.
Timo Sirainen <tss@iki.fi>
parents:
7226
diff
changeset
|
66 } |
4bfe7618743e
Index opening: If there's broken index and no .log, don't crash.
Timo Sirainen <tss@iki.fi>
parents:
7226
diff
changeset
|
67 |
6385
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
68 static bool |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
69 array_has_name(const ARRAY_TYPE(const_string) *names, const char *name) |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
70 { |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
71 const char *const *str; |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
72 unsigned int i, count; |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
73 |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
74 str = array_get(names, &count); |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
75 for (i = 0; i < count; i++) { |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
76 if (strcmp(str[i], name) == 0) |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
77 return TRUE; |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
78 } |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
79 return FALSE; |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
80 } |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
81 |
6386
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
82 static unsigned int |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
83 mail_index_fsck_find_keyword_count(struct mail_index_map *map, |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
84 const struct mail_index_ext_header *ext_hdr) |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
85 { |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
86 const struct mail_index_record *rec; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
87 const uint8_t *kw; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
88 unsigned int r, i, j, cur, max = 0, kw_pos, kw_size; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
89 |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
90 kw_pos = ext_hdr->record_offset; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
91 kw_size = ext_hdr->record_size; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
92 |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
93 rec = map->rec_map->records; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
94 for (r = 0; r < map->rec_map->records_count; r++) { |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
95 kw = CONST_PTR_OFFSET(rec, kw_pos); |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
96 for (i = cur = 0; i < kw_size; i++) { |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
97 if (kw[i] != 0) { |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
98 for (j = 0; j < 8; j++) { |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
99 if ((kw[i] & (1 << j)) != 0) |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
100 cur = i * 8 + j + 1; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
101 } |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
102 } |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
103 } |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
104 if (cur > max) { |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
105 max = cur; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
106 if (max == kw_size*8) |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
107 return max; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
108 } |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
109 rec = CONST_PTR_OFFSET(rec, map->hdr.record_size); |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
110 } |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
111 return max; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
112 } |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
113 |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
114 static bool |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
115 keyword_name_is_valid(const char *buffer, unsigned int pos, unsigned int size) |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
116 { |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
117 for (; pos < size; pos++) { |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
118 if (buffer[pos] == '\0') |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
119 return TRUE; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
120 if (((unsigned char)buffer[pos] & 0x7f) < 32) { |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
121 /* control characters aren't valid */ |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
122 return FALSE; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
123 } |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
124 } |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
125 return FALSE; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
126 } |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
127 |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
128 static void |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
129 mail_index_fsck_keywords(struct mail_index *index, struct mail_index_map *map, |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
130 struct mail_index_header *hdr, |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
131 const struct mail_index_ext_header *ext_hdr, |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
132 unsigned int ext_offset, unsigned int *offset_p) |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
133 { |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
134 const struct mail_index_keyword_header *kw_hdr; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
135 struct mail_index_keyword_header *new_kw_hdr; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
136 const struct mail_index_keyword_header_rec *kw_rec; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
137 struct mail_index_keyword_header_rec new_kw_rec; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
138 const char *name, *name_buffer, **name_array; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
139 unsigned int i, j, name_pos, name_size, rec_pos, hdr_offset, diff; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
140 unsigned int changed_count, keywords_count, name_base_pos; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
141 ARRAY_TYPE(const_string) names; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
142 buffer_t *dest; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
143 bool changed = FALSE; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
144 |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
145 hdr_offset = ext_offset + |
8547
545cb188f7ab
Replaced literal "keywords" strings with a macro.
Timo Sirainen <tss@iki.fi>
parents:
8134
diff
changeset
|
146 mail_index_map_ext_hdr_offset(sizeof(MAIL_INDEX_EXT_KEYWORDS)-1); |
6386
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
147 kw_hdr = CONST_PTR_OFFSET(map->hdr_base, hdr_offset); |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
148 keywords_count = kw_hdr->keywords_count; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
149 |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
150 kw_rec = (const void *)(kw_hdr + 1); |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
151 name_buffer = (const char *)(kw_rec + keywords_count); |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
152 |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
153 name_pos = (size_t)(name_buffer - (const char *)kw_hdr); |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
154 if (name_pos > ext_hdr->hdr_size) { |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
155 /* the header is completely broken */ |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
156 keywords_count = |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
157 mail_index_fsck_find_keyword_count(map, ext_hdr); |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
158 mail_index_fsck_error(index, "Assuming keywords_count = %u", |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
159 keywords_count); |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
160 kw_rec = NULL; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
161 name_size = 0; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
162 changed = TRUE; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
163 } else { |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
164 name_size = ext_hdr->hdr_size - name_pos; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
165 } |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
166 |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
167 /* create keyword name array. invalid keywords are added as |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
168 empty strings */ |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
169 t_array_init(&names, keywords_count); |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
170 for (i = 0; i < keywords_count; i++) { |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
171 if (name_size == 0 || |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
172 !keyword_name_is_valid(name_buffer, kw_rec[i].name_offset, |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
173 name_size)) |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
174 name = ""; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
175 else |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
176 name = name_buffer + kw_rec[i].name_offset; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
177 |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
178 if (*name != '\0' && array_has_name(&names, name)) { |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
179 /* duplicate */ |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
180 name = ""; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
181 } |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
182 array_append(&names, &name, 1); |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
183 } |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
184 |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
185 /* give new names to invalid keywords */ |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
186 changed_count = 0; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
187 name_array = array_idx_modifiable(&names, 0); |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
188 for (i = j = 0; i < keywords_count; i++) { |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
189 while (name_array[i][0] == '\0') { |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
190 name = t_strdup_printf("unknown-%d", j++); |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
191 if (!array_has_name(&names, name)) { |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
192 name_array[i] = name; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
193 changed = TRUE; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
194 changed_count++; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
195 } |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
196 } |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
197 } |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
198 |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
199 if (!changed) { |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
200 /* nothing was broken */ |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
201 return; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
202 } |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
203 |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
204 mail_index_fsck_error(index, "Renamed %u keywords to unknown-*", |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
205 changed_count); |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
206 |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
207 dest = buffer_create_dynamic(default_pool, |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
208 I_MAX(ext_hdr->hdr_size, 128)); |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
209 new_kw_hdr = buffer_append_space_unsafe(dest, sizeof(*new_kw_hdr)); |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
210 new_kw_hdr->keywords_count = keywords_count; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
211 |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
212 /* add keyword records so we can start appending names directly */ |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
213 rec_pos = dest->used; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
214 memset(&new_kw_rec, 0, sizeof(new_kw_rec)); |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
215 buffer_append_space_unsafe(dest, keywords_count * sizeof(*kw_rec)); |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
216 |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
217 /* write the actual records and names */ |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
218 name_base_pos = dest->used; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
219 for (i = 0; i < keywords_count; i++) { |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
220 new_kw_rec.name_offset = dest->used - name_base_pos; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
221 buffer_write(dest, rec_pos, &new_kw_rec, sizeof(new_kw_rec)); |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
222 rec_pos += sizeof(*kw_rec); |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
223 |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
224 buffer_append(dest, name_array[i], strlen(name_array[i]) + 1); |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
225 } |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
226 |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
227 /* keep the header size at least the same size as before */ |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
228 if (dest->used < ext_hdr->hdr_size) |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
229 buffer_append_zero(dest, ext_hdr->hdr_size - dest->used); |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
230 |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
231 if (dest->used > ext_hdr->hdr_size) { |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
232 /* need to resize the header */ |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
233 struct mail_index_ext_header new_ext_hdr; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
234 |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
235 diff = dest->used - ext_hdr->hdr_size; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
236 buffer_copy(map->hdr_copy_buf, hdr_offset + diff, |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
237 map->hdr_copy_buf, hdr_offset, (size_t)-1); |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
238 map->hdr_base = map->hdr_copy_buf->data; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
239 hdr->header_size += diff; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
240 *offset_p += diff; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
241 |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
242 new_ext_hdr = *ext_hdr; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
243 new_ext_hdr.hdr_size += diff; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
244 buffer_write(map->hdr_copy_buf, ext_offset, |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
245 &new_ext_hdr, sizeof(new_ext_hdr)); |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
246 } |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
247 |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
248 i_assert(hdr_offset + dest->used <= map->hdr_copy_buf->used); |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
249 buffer_write(map->hdr_copy_buf, hdr_offset, dest->data, dest->used); |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
250 |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
251 /* keywords changed unexpectedly, so all views are broken now */ |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
252 index->inconsistency_id++; |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
253 |
6414
a6a49d5efc59
Changed buffer_free() and buffer_free_without_data() APIs to take ** pointer
Timo Sirainen <tss@iki.fi>
parents:
6411
diff
changeset
|
254 buffer_free(&dest); |
6386
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
255 } |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
256 |
6385
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
257 static void |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
258 mail_index_fsck_extensions(struct mail_index *index, struct mail_index_map *map, |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
259 struct mail_index_header *hdr) |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
260 { |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
261 const struct mail_index_ext_header *ext_hdr; |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
262 ARRAY_TYPE(const_string) names; |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
263 const char *name, *error; |
8067 | 264 unsigned int offset, next_offset, i; |
6385
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
265 |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
266 t_array_init(&names, 64); |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
267 offset = MAIL_INDEX_HEADER_SIZE_ALIGN(hdr->base_header_size); |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
268 for (i = 0; offset < hdr->header_size; i++) { |
8067 | 269 /* mail_index_map_ext_get_next() uses map->hdr, so make sure |
270 it's up-to-date */ | |
271 map->hdr = *hdr; | |
272 | |
273 next_offset = offset; | |
274 if (mail_index_map_ext_get_next(map, &next_offset, | |
6385
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
275 &ext_hdr, &name) < 0) { |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
276 /* the extension continued outside header, drop it */ |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
277 mail_index_fsck_error(index, |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
278 "Dropped extension #%d (%s) " |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
279 "with invalid header size", |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
280 i, name); |
8067 | 281 hdr->header_size = offset; |
6385
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
282 break; |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
283 } |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
284 if (mail_index_map_ext_hdr_check(hdr, ext_hdr, name, |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
285 &error) < 0) { |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
286 mail_index_fsck_error(index, |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
287 "Dropped broken extension #%d (%s)", i, name); |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
288 } else if (array_has_name(&names, name)) { |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
289 mail_index_fsck_error(index, |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
290 "Dropped duplicate extension %s", name); |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
291 } else { |
6386
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
292 /* name may change if header buffer is changed */ |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
293 name = t_strdup(name); |
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
294 |
8547
545cb188f7ab
Replaced literal "keywords" strings with a macro.
Timo Sirainen <tss@iki.fi>
parents:
8134
diff
changeset
|
295 if (strcmp(name, MAIL_INDEX_EXT_KEYWORDS) == 0) { |
6386
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
296 mail_index_fsck_keywords(index, map, hdr, |
8067 | 297 ext_hdr, offset, |
298 &next_offset); | |
6386
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
299 } |
6385
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
300 array_append(&names, &name, 1); |
8134
447638ac601a
index fsck: Don't give bogus "duplicate extension" errors and break them.
Timo Sirainen <tss@iki.fi>
parents:
8067
diff
changeset
|
301 offset = next_offset; |
6385
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
302 continue; |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
303 } |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
304 |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
305 /* drop the field */ |
8067 | 306 hdr->header_size -= next_offset - offset; |
307 buffer_copy(map->hdr_copy_buf, offset, | |
308 map->hdr_copy_buf, next_offset, (size_t)-1); | |
6385
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
309 buffer_set_used_size(map->hdr_copy_buf, hdr->header_size); |
6386
1d993d28e12f
fsck fixes now keyword header problems
Timo Sirainen <tss@iki.fi>
parents:
6385
diff
changeset
|
310 map->hdr_base = map->hdr_copy_buf->data; |
6385
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
311 } |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
312 } |
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
313 |
6382 | 314 static void |
315 mail_index_fsck_records(struct mail_index *index, struct mail_index_map *map, | |
316 struct mail_index_header *hdr) | |
317 { | |
318 struct mail_index_record *rec, *next_rec; | |
5019 | 319 uint32_t i, last_uid; |
6377
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
320 bool logged_unordered_uids = FALSE, logged_zero_uids = FALSE; |
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
321 bool records_dropped = FALSE; |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
322 |
6382 | 323 hdr->messages_count = 0; |
324 hdr->seen_messages_count = 0; | |
325 hdr->deleted_messages_count = 0; | |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
326 |
6382 | 327 hdr->first_unseen_uid_lowwater = 0; |
328 hdr->first_deleted_uid_lowwater = 0; | |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
329 |
6165
6418139447fa
Created a new struct mail_index_record_map which can be shared by multiple
Timo Sirainen <tss@iki.fi>
parents:
6037
diff
changeset
|
330 rec = map->rec_map->records; last_uid = 0; |
6377
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
331 for (i = 0; i < map->rec_map->records_count; ) { |
6382 | 332 next_rec = PTR_OFFSET(rec, hdr->record_size); |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
333 if (rec->uid <= last_uid) { |
6377
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
334 /* log an error once, and skip this record */ |
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
335 if (rec->uid == 0) { |
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
336 if (!logged_zero_uids) { |
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
337 mail_index_fsck_error(index, |
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
338 "Record UIDs have zeroes"); |
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
339 logged_zero_uids = TRUE; |
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
340 } |
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
341 } else { |
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
342 if (!logged_unordered_uids) { |
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
343 mail_index_fsck_error(index, |
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
344 "Record UIDs unordered"); |
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
345 logged_unordered_uids = TRUE; |
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
346 } |
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
347 } |
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
348 /* not the fastest way when we're skipping lots of |
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
349 records, but this should happen rarely so don't |
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
350 bother optimizing. */ |
6382 | 351 memmove(rec, next_rec, hdr->record_size * |
6377
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
352 (map->rec_map->records_count - i - 1)); |
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
353 map->rec_map->records_count--; |
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
354 records_dropped = TRUE; |
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
355 continue; |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
356 } |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
357 |
6382 | 358 hdr->messages_count++; |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
359 if ((rec->flags & MAIL_SEEN) != 0) |
6382 | 360 hdr->seen_messages_count++; |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
361 if ((rec->flags & MAIL_DELETED) != 0) |
6382 | 362 hdr->deleted_messages_count++; |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
363 |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
364 if ((rec->flags & MAIL_SEEN) == 0 && |
6382 | 365 hdr->first_unseen_uid_lowwater == 0) |
366 hdr->first_unseen_uid_lowwater = rec->uid; | |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
367 if ((rec->flags & MAIL_DELETED) != 0 && |
6382 | 368 hdr->first_deleted_uid_lowwater == 0) |
369 hdr->first_deleted_uid_lowwater = rec->uid; | |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
370 |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
371 last_uid = rec->uid; |
6377
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
372 rec = next_rec; |
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
373 i++; |
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
374 } |
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
375 |
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
376 if (records_dropped) { |
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
377 /* all existing views are broken now */ |
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
378 index->inconsistency_id++; |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
379 } |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
380 |
6382 | 381 if (hdr->next_uid <= last_uid) { |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
382 mail_index_fsck_error(index, "next_uid %u -> %u", |
6382 | 383 hdr->next_uid, last_uid+1); |
384 hdr->next_uid = last_uid+1; | |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
385 } |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
386 |
6382 | 387 if (hdr->first_unseen_uid_lowwater == 0) |
388 hdr->first_unseen_uid_lowwater = hdr->next_uid; | |
389 if (hdr->first_deleted_uid_lowwater == 0) | |
390 hdr->first_deleted_uid_lowwater = hdr->next_uid; | |
391 if (hdr->first_recent_uid > hdr->next_uid) | |
392 hdr->first_recent_uid = hdr->next_uid; | |
393 if (hdr->first_recent_uid == 0) | |
394 hdr->first_recent_uid = 1; | |
5754
0096aaf83731
Do a bit better job with fscking.
Timo Sirainen <tss@iki.fi>
parents:
5689
diff
changeset
|
395 |
0096aaf83731
Do a bit better job with fscking.
Timo Sirainen <tss@iki.fi>
parents:
5689
diff
changeset
|
396 CHECK(uid_validity, !=); |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
397 CHECK(messages_count, !=); |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
398 CHECK(seen_messages_count, !=); |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
399 CHECK(deleted_messages_count, !=); |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
400 |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
401 CHECK(first_unseen_uid_lowwater, <); |
5754
0096aaf83731
Do a bit better job with fscking.
Timo Sirainen <tss@iki.fi>
parents:
5689
diff
changeset
|
402 CHECK(first_deleted_uid_lowwater, <); |
6037
d911d943438e
Recent flag handling rewrite. Still not perfect with maildir.
Timo Sirainen <tss@iki.fi>
parents:
5853
diff
changeset
|
403 CHECK(first_recent_uid, !=); |
6382 | 404 } |
405 | |
406 static void | |
407 mail_index_fsck_map(struct mail_index *index, struct mail_index_map *map) | |
408 { | |
409 struct mail_index_header hdr; | |
410 | |
8060
4bfe7618743e
Index opening: If there's broken index and no .log, don't crash.
Timo Sirainen <tss@iki.fi>
parents:
7226
diff
changeset
|
411 if (index->log->head != NULL) { |
4bfe7618743e
Index opening: If there's broken index and no .log, don't crash.
Timo Sirainen <tss@iki.fi>
parents:
7226
diff
changeset
|
412 /* Remember the log head position. If we go back in the index's |
4bfe7618743e
Index opening: If there's broken index and no .log, don't crash.
Timo Sirainen <tss@iki.fi>
parents:
7226
diff
changeset
|
413 head offset, ignore errors in the log up to this offset. */ |
4bfe7618743e
Index opening: If there's broken index and no .log, don't crash.
Timo Sirainen <tss@iki.fi>
parents:
7226
diff
changeset
|
414 mail_transaction_log_get_head(index->log, |
4bfe7618743e
Index opening: If there's broken index and no .log, don't crash.
Timo Sirainen <tss@iki.fi>
parents:
7226
diff
changeset
|
415 &index->fsck_log_head_file_seq, |
4bfe7618743e
Index opening: If there's broken index and no .log, don't crash.
Timo Sirainen <tss@iki.fi>
parents:
7226
diff
changeset
|
416 &index->fsck_log_head_file_offset); |
4bfe7618743e
Index opening: If there's broken index and no .log, don't crash.
Timo Sirainen <tss@iki.fi>
parents:
7226
diff
changeset
|
417 } |
6382 | 418 hdr = map->hdr; |
419 | |
420 mail_index_fsck_header(index, map, &hdr); | |
6385
9dde743dfbc1
If extension header is broken, drop it when fscking.
Timo Sirainen <tss@iki.fi>
parents:
6382
diff
changeset
|
421 mail_index_fsck_extensions(index, map, &hdr); |
6382 | 422 mail_index_fsck_records(index, map, &hdr); |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
423 |
5019 | 424 map->hdr = hdr; |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
425 } |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
426 |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
427 int mail_index_fsck(struct mail_index *index) |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
428 { |
6381 | 429 bool orig_locked = index->log_locked; |
5754
0096aaf83731
Do a bit better job with fscking.
Timo Sirainen <tss@iki.fi>
parents:
5689
diff
changeset
|
430 struct mail_index_map *map; |
6381 | 431 uint32_t file_seq; |
432 uoff_t file_offset; | |
2935
0b72e95cd3ae
Don't try to fsck when we're modifying index. It could have happened with
Timo Sirainen <tss@iki.fi>
parents:
2930
diff
changeset
|
433 |
5063
fbcc7ca636d5
Log a warning when we're starting fsck. Log error before calling fsck.
Timo Sirainen <tss@iki.fi>
parents:
5019
diff
changeset
|
434 i_warning("fscking index file %s", index->filepath); |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
435 |
8060
4bfe7618743e
Index opening: If there's broken index and no .log, don't crash.
Timo Sirainen <tss@iki.fi>
parents:
7226
diff
changeset
|
436 if (index->log->head == NULL) { |
4bfe7618743e
Index opening: If there's broken index and no .log, don't crash.
Timo Sirainen <tss@iki.fi>
parents:
7226
diff
changeset
|
437 /* we're trying to open the index files, but there wasn't |
4bfe7618743e
Index opening: If there's broken index and no .log, don't crash.
Timo Sirainen <tss@iki.fi>
parents:
7226
diff
changeset
|
438 any .log file. this should be rare, so just fsck it without |
4bfe7618743e
Index opening: If there's broken index and no .log, don't crash.
Timo Sirainen <tss@iki.fi>
parents:
7226
diff
changeset
|
439 locking. */ |
4bfe7618743e
Index opening: If there's broken index and no .log, don't crash.
Timo Sirainen <tss@iki.fi>
parents:
7226
diff
changeset
|
440 orig_locked = TRUE; |
4bfe7618743e
Index opening: If there's broken index and no .log, don't crash.
Timo Sirainen <tss@iki.fi>
parents:
7226
diff
changeset
|
441 } |
4bfe7618743e
Index opening: If there's broken index and no .log, don't crash.
Timo Sirainen <tss@iki.fi>
parents:
7226
diff
changeset
|
442 |
6381 | 443 if (!orig_locked) { |
444 if (mail_transaction_log_sync_lock(index->log, &file_seq, | |
445 &file_offset) < 0) | |
446 return -1; | |
447 } | |
448 | |
5754
0096aaf83731
Do a bit better job with fscking.
Timo Sirainen <tss@iki.fi>
parents:
5689
diff
changeset
|
449 map = mail_index_map_clone(index->map); |
5853
d9f319a9d6e0
mail_index_map now contains pointer to index, so all functions taking map
Timo Sirainen <tss@iki.fi>
parents:
5820
diff
changeset
|
450 mail_index_unmap(&index->map); |
5754
0096aaf83731
Do a bit better job with fscking.
Timo Sirainen <tss@iki.fi>
parents:
5689
diff
changeset
|
451 index->map = map; |
0096aaf83731
Do a bit better job with fscking.
Timo Sirainen <tss@iki.fi>
parents:
5689
diff
changeset
|
452 |
7226
e6693a0ec8e1
Renamed T_FRAME_BEGIN/END to T_BEGIN/END. Removed T_FRAME() macro and
Timo Sirainen <tss@iki.fi>
parents:
7086
diff
changeset
|
453 T_BEGIN { |
6940
414c9d631a81
Replaced t_push/t_pop calls with T_FRAME*() macros.
Timo Sirainen <tss@iki.fi>
parents:
6429
diff
changeset
|
454 mail_index_fsck_map(index, map); |
7226
e6693a0ec8e1
Renamed T_FRAME_BEGIN/END to T_BEGIN/END. Removed T_FRAME() macro and
Timo Sirainen <tss@iki.fi>
parents:
7086
diff
changeset
|
455 } T_END; |
5754
0096aaf83731
Do a bit better job with fscking.
Timo Sirainen <tss@iki.fi>
parents:
5689
diff
changeset
|
456 |
6381 | 457 map->write_base_header = TRUE; |
458 map->write_atomic = TRUE; | |
459 mail_index_write(index, FALSE); | |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
460 |
6381 | 461 if (!orig_locked) |
5754
0096aaf83731
Do a bit better job with fscking.
Timo Sirainen <tss@iki.fi>
parents:
5689
diff
changeset
|
462 mail_transaction_log_sync_unlock(index->log); |
6381 | 463 return 0; |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
464 } |
6377
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
465 |
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
466 void mail_index_fsck_locked(struct mail_index *index) |
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
467 { |
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
468 int ret; |
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
469 |
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
470 i_assert(index->log_locked); |
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
471 ret = mail_index_fsck(index); |
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
472 i_assert(ret == 0); |
29f427039e00
fsck won't fail anymore with "corrupted index", all problems are fixed.
Timo Sirainen <tss@iki.fi>
parents:
6345
diff
changeset
|
473 } |