dovecot-2.2: pop3c: Return error instead of crashing when trying...

dovecot at dovecot.org dovecot at dovecot.org
Wed Jun 26 15:44:22 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/230f111056b4
changeset: 16557:230f111056b4
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Jun 26 15:44:08 2013 +0300
description:
pop3c: Return error instead of crashing when trying to save a mail.

diffstat:

 src/lib-storage/index/pop3c/pop3c-storage.c |  44 +++++++++++++++++++++++++---
 1 files changed, 39 insertions(+), 5 deletions(-)

diffs (61 lines):

diff -r af8ce0a84bb5 -r 230f111056b4 src/lib-storage/index/pop3c/pop3c-storage.c
--- a/src/lib-storage/index/pop3c/pop3c-storage.c	Wed Jun 26 15:29:43 2013 +0300
+++ b/src/lib-storage/index/pop3c/pop3c-storage.c	Wed Jun 26 15:44:08 2013 +0300
@@ -234,6 +234,40 @@
 {
 }
 
+static struct mail_save_context *
+pop3c_save_alloc(struct mailbox_transaction_context *t)
+{
+	struct mail_save_context *ctx;
+
+	ctx = i_new(struct mail_save_context, 1);
+	ctx->transaction = t;
+	return ctx;
+}
+
+static int
+pop3c_save_begin(struct mail_save_context *ctx ATTR_UNUSED,
+		 struct istream *input ATTR_UNUSED)
+{
+	mail_storage_set_error(ctx->transaction->box->storage,
+		MAIL_ERROR_NOTPOSSIBLE, "POP3 doesn't support saving mails");
+	return -1;
+}
+
+static int pop3c_save_continue(struct mail_save_context *ctx ATTR_UNUSED)
+{
+	return -1;
+}
+
+static int pop3c_save_finish(struct mail_save_context *ctx ATTR_UNUSED)
+{
+	return -1;
+}
+
+static void
+pop3c_save_cancel(struct mail_save_context *ctx ATTR_UNUSED)
+{
+}
+
 static bool pop3c_storage_is_inconsistent(struct mailbox *box)
 {
 	struct pop3c_mailbox *mbox = (struct pop3c_mailbox *)box;
@@ -295,11 +329,11 @@
 		index_storage_search_deinit,
 		index_storage_search_next_nonblock,
 		index_storage_search_next_update_seq,
-		NULL,
-		NULL,
-		NULL,
-		NULL,
-		NULL,
+		pop3c_save_alloc,
+		pop3c_save_begin,
+		pop3c_save_continue,
+		pop3c_save_finish,
+		pop3c_save_cancel,
 		mail_storage_copy,
 		NULL,
 		NULL,


More information about the dovecot-cvs mailing list