[dovecot-cvs]
dovecot/src/lib-storage/index/mbox istream-raw-mbox.c, 1.38,
1.39 mbox-file.c, 1.14, 1.15 mbox-list.c, 1.33,
1.34 mbox-mail.c, 1.31, 1.32 mbox-save.c, 1.90,
1.91 mbox-storage.c, 1.133, 1.134 mbox-sync-parse.c, 1.48,
1.49 mbox-sync-rewrite.c, 1.60, 1.61 mbox-sync.c, 1.179, 1.180
cras at dovecot.org
cras at dovecot.org
Sat Jan 14 20:47:58 EET 2006
- Previous message: [dovecot-cvs] dovecot/src/lib-storage/index/maildir
maildir-keywords.c, 1.2, 1.3 maildir-save.c, 1.63,
1.64 maildir-sync.c, 1.71, 1.72 maildir-uidlist.c, 1.42, 1.43
- Next message: [dovecot-cvs] dovecot/src/lib-storage/subscription-file
subscription-file.c, 1.27, 1.28
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /var/lib/cvs/dovecot/src/lib-storage/index/mbox
In directory talvi:/tmp/cvs-serv16037/lib-storage/index/mbox
Modified Files:
istream-raw-mbox.c mbox-file.c mbox-list.c mbox-mail.c
mbox-save.c mbox-storage.c mbox-sync-parse.c
mbox-sync-rewrite.c mbox-sync.c
Log Message:
deinit, unref, destroy, close, free, etc. functions now take a pointer to
their data pointer, and set it to NULL. This makes double-frees less likely
to cause security holes.
Index: istream-raw-mbox.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/istream-raw-mbox.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- istream-raw-mbox.c 13 Jan 2006 20:26:36 -0000 1.38
+++ istream-raw-mbox.c 14 Jan 2006 18:47:52 -0000 1.39
@@ -32,7 +32,7 @@
i_free(rstream->next_sender);
i_stream_seek(rstream->input, rstream->istream.istream.v_offset);
- i_stream_unref(rstream->input);
+ i_stream_unref(&rstream->input);
}
static void _set_max_buffer_size(struct _iostream *stream, size_t max_size)
Index: mbox-file.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-file.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- mbox-file.c 13 Jan 2006 20:26:37 -0000 1.14
+++ mbox-file.c 14 Jan 2006 18:47:52 -0000 1.15
@@ -126,10 +126,8 @@
/* if we read anything, fix the atime if needed */
mbox_file_fix_atime(mbox);
- if (mbox->mbox_stream != NULL) {
- i_stream_unref(mbox->mbox_stream);
- mbox->mbox_stream = NULL;
- }
+ if (mbox->mbox_stream != NULL)
+ i_stream_unref(&mbox->mbox_stream);
if (mbox->mbox_file_stream != NULL) {
if (mbox->mbox_fd == -1) {
@@ -137,8 +135,7 @@
i_assert(mbox->mbox_readonly);
} else {
i_stream_close(mbox->mbox_file_stream);
- i_stream_unref(mbox->mbox_file_stream);
- mbox->mbox_file_stream = NULL;
+ i_stream_unref(&mbox->mbox_file_stream);
}
}
}
Index: mbox-list.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-list.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- mbox-list.c 13 Jan 2006 20:26:37 -0000 1.33
+++ mbox-list.c 14 Jan 2006 18:47:52 -0000 1.34
@@ -201,7 +201,7 @@
if (ctx->list_pool != NULL)
pool_unref(ctx->list_pool);
if (ctx->glob != NULL)
- imap_match_deinit(ctx->glob);
+ imap_match_deinit(&ctx->glob);
i_free(ctx);
return ret;
Index: mbox-mail.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-mail.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- mbox-mail.c 13 Jan 2006 20:26:37 -0000 1.31
+++ mbox-mail.c 14 Jan 2006 18:47:52 -0000 1.32
@@ -194,7 +194,7 @@
mbox_hide_headers,
mbox_hide_headers_count,
NULL, NULL);
- i_stream_unref(raw_stream);
+ i_stream_unref(&raw_stream);
}
return index_mail_init_stream(mail, hdr_size, body_size);
Index: mbox-save.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-save.c,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -d -r1.90 -r1.91
--- mbox-save.c 13 Jan 2006 20:26:37 -0000 1.90
+++ mbox-save.c 14 Jan 2006 18:47:52 -0000 1.91
@@ -201,7 +201,7 @@
ctx->synced = TRUE;
t->mbox_modified = TRUE;
- mail_index_view_close(view);
+ mail_index_view_close(&view);
}
static void status_flags_append(string_t *str, enum mail_flags flags,
@@ -524,14 +524,10 @@
ctx->failed = TRUE;
}
- if (ctx->input != NULL) {
- i_stream_unref(ctx->input);
- ctx->input = NULL;
- }
- if (ctx->body_output != NULL) {
- o_stream_unref(ctx->body_output);
- ctx->body_output = NULL;
- }
+ if (ctx->input != NULL)
+ i_stream_unref(&ctx->input);
+ if (ctx->body_output != NULL)
+ o_stream_unref(&ctx->body_output);
if (ctx->failed && ctx->mail_offset != (uoff_t)-1) {
/* saving this mail failed - truncate back to beginning of it */
@@ -566,10 +562,10 @@
i_assert(ctx->body_output == NULL);
if (ctx->output != NULL)
- o_stream_unref(ctx->output);
+ o_stream_unref(&ctx->output);
if (ctx->mail != NULL)
index_mail_free(ctx->mail);
- str_free(ctx->headers);
+ str_free(&ctx->headers);
i_free(ctx);
}
Index: mbox-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-storage.c,v
retrieving revision 1.133
retrieving revision 1.134
diff -u -d -r1.133 -r1.134
--- mbox-storage.c 13 Jan 2006 20:26:37 -0000 1.133
+++ mbox-storage.c 14 Jan 2006 18:47:52 -0000 1.134
@@ -972,10 +972,8 @@
}
mbox_file_close(mbox);
- if (mbox->mbox_file_stream != NULL) {
- i_stream_unref(mbox->mbox_file_stream);
- mbox->mbox_file_stream = NULL;
- }
+ if (mbox->mbox_file_stream != NULL)
+ i_stream_unref(&mbox->mbox_file_stream);
index_storage_mailbox_free(box);
return ret;
Index: mbox-sync-parse.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync-parse.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- mbox-sync-parse.c 13 Jan 2006 20:26:37 -0000 1.48
+++ mbox-sync-parse.c 14 Jan 2006 18:47:52 -0000 1.49
@@ -512,7 +512,7 @@
str_append_c(ctx->header, '\n');
}
i_assert(ret != 0);
- message_parse_header_deinit(hdr_ctx);
+ message_parse_header_deinit(&hdr_ctx);
mbox_md5_finish(mbox_md5_ctx, ctx->hdr_md5_sum);
@@ -575,7 +575,7 @@
}
}
i_assert(ret != 0);
- message_parse_header_deinit(hdr_ctx);
+ message_parse_header_deinit(&hdr_ctx);
mbox_md5_finish(mbox_md5_ctx, ctx.hdr_md5_sum);
Index: mbox-sync-rewrite.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync-rewrite.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- mbox-sync-rewrite.c 13 Jan 2006 20:26:37 -0000 1.60
+++ mbox-sync-rewrite.c 14 Jan 2006 18:47:52 -0000 1.61
@@ -34,7 +34,7 @@
input = i_stream_create_limit(default_pool, sync_ctx->file_input,
source, size);
ret = o_stream_send_istream(output, input);
- i_stream_unref(input);
+ i_stream_unref(&input);
if (ret == (off_t)size)
ret = 0;
@@ -51,7 +51,7 @@
}
i_stream_sync(sync_ctx->input);
- o_stream_unref(output);
+ o_stream_unref(&output);
return (int)ret;
}
Index: mbox-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync.c,v
retrieving revision 1.179
retrieving revision 1.180
diff -u -d -r1.179 -r1.180
--- mbox-sync.c 14 Jan 2006 15:19:56 -0000 1.179
+++ mbox-sync.c 14 Jan 2006 18:47:52 -0000 1.180
@@ -401,7 +401,7 @@
&mail_ctx->mail.keywords);
mail_index_update_keywords(sync_ctx->t, sync_ctx->idx_seq,
MODIFY_REPLACE, keywords);
- mail_index_keywords_free(keywords);
+ mail_index_keywords_free(&keywords);
}
static int
@@ -1457,7 +1457,7 @@
i_assert(sync_ctx->mbox->mbox_sync_dirty);
mbox_sync_restart(sync_ctx);
- mail_index_transaction_rollback(sync_ctx->t);
+ mail_index_transaction_rollback(&sync_ctx->t);
sync_ctx->t = mail_index_transaction_begin(sync_ctx->sync_view,
FALSE, TRUE);
@@ -1525,12 +1525,12 @@
static void mbox_sync_context_free(struct mbox_sync_context *sync_ctx)
{
if (sync_ctx->t != NULL)
- mail_index_transaction_rollback(sync_ctx->t);
+ mail_index_transaction_rollback(&sync_ctx->t);
if (sync_ctx->index_sync_ctx != NULL)
- mail_index_sync_rollback(sync_ctx->index_sync_ctx);
+ mail_index_sync_rollback(&sync_ctx->index_sync_ctx);
pool_unref(sync_ctx->mail_keyword_pool);
- str_free(sync_ctx->header);
- str_free(sync_ctx->from_line);
+ str_free(&sync_ctx->header);
+ str_free(&sync_ctx->from_line);
array_free(&sync_ctx->mails);
array_free(&sync_ctx->syncs);
}
@@ -1625,7 +1625,7 @@
/* index may need to do internal syncing though, so commit
instead of rollbacking. */
- if (mail_index_sync_commit(index_sync_ctx) < 0) {
+ if (mail_index_sync_commit(&index_sync_ctx) < 0) {
mail_storage_set_index_error(&mbox->ibox);
return -1;
}
@@ -1663,7 +1663,7 @@
if (mbox_sync_read_index_syncs(&sync_ctx, 1, &expunged) < 0)
return -1;
if (sync_ctx.sync_rec.uid1 == 0) {
- if (mail_index_transaction_commit(sync_ctx.t,
+ if (mail_index_transaction_commit(&sync_ctx.t,
&seq, &offset) < 0) {
mail_storage_set_index_error(&mbox->ibox);
mbox_sync_context_free(&sync_ctx);
@@ -1701,8 +1701,9 @@
ret = mbox_sync_do(&sync_ctx, flags);
if (ret < 0)
- mail_index_transaction_rollback(sync_ctx.t);
- else if (mail_index_transaction_commit(sync_ctx.t, &seq, &offset) < 0) {
+ mail_index_transaction_rollback(&sync_ctx.t);
+ else if (mail_index_transaction_commit(&sync_ctx.t,
+ &seq, &offset) < 0) {
mail_storage_set_index_error(&mbox->ibox);
ret = -1;
} else {
@@ -1712,8 +1713,8 @@
sync_ctx.t = NULL;
if (ret < 0)
- mail_index_sync_rollback(index_sync_ctx);
- else if (mail_index_sync_commit(index_sync_ctx) < 0) {
+ mail_index_sync_rollback(&index_sync_ctx);
+ else if (mail_index_sync_commit(&index_sync_ctx) < 0) {
mail_storage_set_index_error(&mbox->ibox);
ret = -1;
}
- Previous message: [dovecot-cvs] dovecot/src/lib-storage/index/maildir
maildir-keywords.c, 1.2, 1.3 maildir-save.c, 1.63,
1.64 maildir-sync.c, 1.71, 1.72 maildir-uidlist.c, 1.42, 1.43
- Next message: [dovecot-cvs] dovecot/src/lib-storage/subscription-file
subscription-file.c, 1.27, 1.28
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list