dovecot-2.1: Merged changes from v2.0.15.

dovecot at dovecot.org dovecot at dovecot.org
Fri Sep 16 16:59:33 EEST 2011


details:   http://hg.dovecot.org/dovecot-2.1/rev/490a85b869e0
changeset: 13509:490a85b869e0
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Sep 16 16:59:10 2011 +0300
description:
Merged changes from v2.0.15.

diffstat:

 .hgsigs                                       |   1 +
 .hgtags                                       |   1 +
 NEWS                                          |  13 +++++++
 doc/man/doveadm-altmove.1.in                  |  20 ++++++++--
 doc/man/dsync.1.in                            |   2 +-
 src/auth/auth-request-handler.c               |   3 +
 src/auth/passdb-ldap.c                        |   4 ++
 src/config/config-parser.c                    |  25 ++++++++++----
 src/doveadm/doveadm-mail-altmove.c            |  47 ++++++++++++++++++++------
 src/doveadm/doveadm-mail-iter.c               |   2 +-
 src/dsync/dsync.c                             |   2 +
 src/lib-index/mail-cache.h                    |   5 ++
 src/lib-index/mail-index-transaction-update.c |   2 +-
 src/lib-index/mail-index-view.c               |   2 +-
 src/lib-index/mail-index.h                    |   2 +-
 src/lib-sql/driver-mysql.c                    |  11 +++++-
 src/lib-sql/driver-sqlpool.c                  |  43 ++++++++++++++++++------
 src/lib-sql/sql-api-private.h                 |   2 +-
 src/lib-storage/index/index-transaction.c     |   3 +
 src/lib-storage/index/mbox/mbox-storage.c     |  14 ++++++-
 src/lib-storage/index/shared/shared-storage.c |   6 +++
 src/lib-storage/mail-storage-service.c        |   2 -
 src/lib-storage/mail-storage.c                |  46 +++++++++++++++++++++-----
 src/lib-storage/mailbox-list.c                |   5 +-
 src/lib/ioloop.c                              |   7 ++++
 src/lib/ioloop.h                              |   3 +
 src/lmtp/lmtp-proxy.c                         |  12 +++++-
 27 files changed, 226 insertions(+), 59 deletions(-)

diffs (truncated from 733 to 300 lines):

diff -r 6a918d40d6f7 -r 490a85b869e0 .hgsigs
--- a/.hgsigs	Fri Sep 16 16:14:14 2011 +0300
+++ b/.hgsigs	Fri Sep 16 16:59:10 2011 +0300
@@ -29,3 +29,4 @@
 aa8dfa085a99b5c6e1bb6d304adc67b8a199c63a 0 iEYEABECAAYFAk3KpGwACgkQyUhSUUBVismbmQCfTKfNrQnIy2cIQCYUE7zFrRl6nvgAnAu5W0iAfzKwFEAGtnGj1h+D+tY0
 aa68f38c04f080fe4d3142fb3f73425b78ef98bd 0 iEYEABECAAYFAk5bEKIACgkQyUhSUUBVislRhwCePWvqh3c+EitvNe1XlMqxpwWvDDgAoJKjDnmLwk0U62IhIQ+x90DEIgl6
 8ae243558677b23f2077c3fe9683cc7890f5eb5d 0 iEYEABECAAYFAk5fSWYACgkQyUhSUUBVism47wCeJe0dWWZZLLXgn3r5oBg+jy9UtN0An3qCOCwxFxql7Ik42c/6kUKiCd1V
+11ef524500964054ae8e4e6150f890b1864139eb 0 iEYEABECAAYFAk5zUvIACgkQyUhSUUBVisnDTgCdHVHSwKeZjHV4KrlTmqipFoO26mkAoIMqPTna3Y1ETIGnPq6XRCB90C8p
diff -r 6a918d40d6f7 -r 490a85b869e0 .hgtags
--- a/.hgtags	Fri Sep 16 16:14:14 2011 +0300
+++ b/.hgtags	Fri Sep 16 16:59:10 2011 +0300
@@ -66,3 +66,4 @@
 aa8dfa085a99b5c6e1bb6d304adc67b8a199c63a 2.0.13
 aa68f38c04f080fe4d3142fb3f73425b78ef98bd 2.0.14
 8ae243558677b23f2077c3fe9683cc7890f5eb5d 2.1.alpha1
+11ef524500964054ae8e4e6150f890b1864139eb 2.0.15
diff -r 6a918d40d6f7 -r 490a85b869e0 NEWS
--- a/NEWS	Fri Sep 16 16:14:14 2011 +0300
+++ b/NEWS	Fri Sep 16 16:59:10 2011 +0300
@@ -27,6 +27,19 @@
 	  override_fields settings to specify template defaults/overrides.
 	- listescape plugin works perfectly now
 
+v2.0.15 2011-09-16  Timo Sirainen <tss at iki.fi>
+
+	+ doveadm altmove: Added -r parameter to move mails back to primary
+	  storage.
+	- v2.0.14: Index reading could have eaten a lot of memory in some
+	  situations
+	- doveadm index no longer affects future caching decisions
+	- mbox: Fixed crash during mail delivery when mailbox didn't yet have
+	  GUID assigned to it.
+	- zlib+mbox: Fetching last message from compressed mailboxes crashed.
+	- lib-sql: Fixed load balancing and error handling when multiple hosts
+	  are used.
+
 v2.0.14 2011-08-29  Timo Sirainen <tss at iki.fi>
 
 	+ doveadm: Added support for running mail commands by proxying to
diff -r 6a918d40d6f7 -r 490a85b869e0 doc/man/doveadm-altmove.1.in
--- a/doc/man/doveadm-altmove.1.in	Fri Sep 16 16:14:14 2011 +0300
+++ b/doc/man/doveadm-altmove.1.in	Fri Sep 16 16:59:10 2011 +0300
@@ -1,19 +1,19 @@
-.\" Copyright (c) 2010 Dovecot authors, see the included COPYING file
-.TH DOVEADM\-ALTMOVE 1 "2010-11-25" "Dovecot v2.0" "Dovecot"
+.\" Copyright (c) 2010-2011 Dovecot authors, see the included COPYING file
+.TH DOVEADM\-ALTMOVE 1 "2011-09-15" "Dovecot v2.0" "Dovecot"
 .SH NAME
 doveadm\-altmove \- Move matching mails to the alternative storage (dbox\-only)
 .\"------------------------------------------------------------------------
 .SH SYNOPSIS
-.BR doveadm " [" \-Dv "] " altmove " [" \-S
+.BR doveadm " [" \-Dv "] " altmove " [" \-r "] ["\-S
 .IR socket_path "] " search_query
 .br
 .\"-------------------------------------
-.BR doveadm " [" \-Dv "] " altmove " [" \-S
+.BR doveadm " [" \-Dv "] " altmove " [" \-r "] ["\-S
 .IR socket_path "] "
 .BI \-A " search_query"
 .br
 .\"-------------------------------------
-.BR doveadm " [" \-Dv "] " altmove " [" \-S
+.BR doveadm " [" \-Dv "] " altmove " [" \-r "] ["\-S
 .IR socket_path "] "
 .BI \-u " user search_query"
 .\"------------------------------------------------------------------------
@@ -42,6 +42,16 @@
 .\"-------------------------------------
 @INCLUDE:option-A@
 .\"-------------------------------------
+.TP
+.B \-r
+When the
+.B \-r
+option is given this
+.I command
+works the other way round.
+Mails will be moved from the alternative storage back to the default mail
+location.
+.\"-------------------------------------
 @INCLUDE:option-S-socket@
 .\"-------------------------------------
 @INCLUDE:option-u-user@
diff -r 6a918d40d6f7 -r 490a85b869e0 doc/man/dsync.1.in
--- a/doc/man/dsync.1.in	Fri Sep 16 16:14:14 2011 +0300
+++ b/doc/man/dsync.1.in	Fri Sep 16 16:59:10 2011 +0300
@@ -167,7 +167,7 @@
 For example:
 .sp
 .nf
-ssh mailuser at host dsync -u user
+ssh mailuser at host dsync \-u user
 .fi
 .\"------------------------------------------------------------------------
 .SH COMMANDS
diff -r 6a918d40d6f7 -r 490a85b869e0 src/auth/auth-request-handler.c
--- a/src/auth/auth-request-handler.c	Fri Sep 16 16:14:14 2011 +0300
+++ b/src/auth/auth-request-handler.c	Fri Sep 16 16:59:10 2011 +0300
@@ -244,6 +244,9 @@
 		   anything but abort this request */
 		request->internal_failure = TRUE;
 		result = AUTH_CLIENT_RESULT_FAILURE;
+		/* make sure this request is set to finished state
+		   (it's not with result=continue) */
+		auth_request_set_state(request, AUTH_REQUEST_STATE_FINISHED);
 	}
 
 	reply = auth_stream_reply_init(pool_datastack_create());
diff -r 6a918d40d6f7 -r 490a85b869e0 src/auth/passdb-ldap.c
--- a/src/auth/passdb-ldap.c	Fri Sep 16 16:14:14 2011 +0300
+++ b/src/auth/passdb-ldap.c	Fri Sep 16 16:59:10 2011 +0300
@@ -157,6 +157,10 @@
 			}
 			auth_request_log_info(auth_request, "ldap", "%s", str);
 			passdb_result = PASSDB_RESULT_PASSWORD_MISMATCH;
+		} else if (ret == LDAP_NO_SUCH_OBJECT) {
+			passdb_result = PASSDB_RESULT_USER_UNKNOWN;
+			auth_request_log_info(auth_request, "ldap",
+					      "unknown user");
 		} else {
 			auth_request_log_error(auth_request, "ldap",
 					       "ldap_bind() failed: %s",
diff -r 6a918d40d6f7 -r 490a85b869e0 src/config/config-parser.c
--- a/src/config/config-parser.c	Fri Sep 16 16:14:14 2011 +0300
+++ b/src/config/config-parser.c	Fri Sep 16 16:59:10 2011 +0300
@@ -52,8 +52,8 @@
 	return NULL;
 }
 
-static void config_add_type(struct setting_parser_context *parser,
-			    const char *line, const char *section_name)
+static int config_add_type(struct setting_parser_context *parser,
+			   const char *line, const char *section_name)
 {
 	const struct setting_parser_info *info;
 	const char *p;
@@ -61,21 +61,28 @@
 	int ret;
 
 	info = settings_parse_get_prev_info(parser);
+	if (info == NULL) {
+		/* section inside strlist */
+		return -1;
+	}
 	if (info->type_offset == (size_t)-1)
-		return;
+		return 0;
 
 	str = t_str_new(256);
 	p = strchr(line, '=');
 	str_append_n(str, line, p-line);
 	str_append_c(str, SETTINGS_SEPARATOR);
 	str_append(str, p+1);
-	str_append_c(str, SETTINGS_SEPARATOR);
-	str_append(str, info_type_name_find(info));
+	if (info != NULL) {
+		str_append_c(str, SETTINGS_SEPARATOR);
+		str_append(str, info_type_name_find(info));
+	}
 	str_append_c(str, '=');
 	str_append(str, section_name);
 
 	ret = settings_parse_line(parser, str_c(str));
 	i_assert(ret > 0);
+	return 0;
 }
 
 static bool
@@ -106,8 +113,12 @@
 					key, NULL);
 				return -1;
 			}
-			if (section_name != NULL)
-				config_add_type(l->parser, line, section_name);
+			if (section_name != NULL) {
+				if (config_add_type(l->parser, line, section_name) < 0) {
+					ctx->error = "Section not allowed here";
+					return -1;
+				}
+			}
 		} else if (ret < 0) {
 			ctx->error = settings_parser_get_error(l->parser);
 			return -1;
diff -r 6a918d40d6f7 -r 490a85b869e0 src/doveadm/doveadm-mail-altmove.c
--- a/src/doveadm/doveadm-mail-altmove.c	Fri Sep 16 16:14:14 2011 +0300
+++ b/src/doveadm/doveadm-mail-altmove.c	Fri Sep 16 16:59:10 2011 +0300
@@ -9,13 +9,20 @@
 #include "doveadm-mail-iter.h"
 #include "doveadm-mail.h"
 
+struct altmove_cmd_context {
+	struct doveadm_mail_cmd_context ctx;
+	bool reverse;
+};
+
 static int
 cmd_altmove_box(const struct mailbox_info *info,
-		struct mail_search_args *search_args)
+		struct mail_search_args *search_args, bool reverse)
 {
 	struct doveadm_mail_iter *iter;
 	struct mailbox_transaction_context *trans;
 	struct mail *mail;
+	enum modify_type modify_type =
+		!reverse ? MODIFY_ADD : MODIFY_REMOVE;
 
 	if (doveadm_mail_iter_init(info, search_args, 0, NULL,
 				   &trans, &iter) < 0)
@@ -26,7 +33,7 @@
 			i_debug("altmove: box=%s uid=%u",
 				info->name, mail->uid);
 		}
-		mail_update_flags(mail, MODIFY_ADD,
+		mail_update_flags(mail, modify_type,
 			(enum mail_flags)MAIL_INDEX_MAIL_FLAG_BACKEND);
 	}
 	return doveadm_mail_iter_deinit_sync(&iter);
@@ -41,8 +48,9 @@
 }
 
 static void
-cmd_altmove_run(struct doveadm_mail_cmd_context *ctx, struct mail_user *user)
+cmd_altmove_run(struct doveadm_mail_cmd_context *_ctx, struct mail_user *user)
 {
+	struct altmove_cmd_context *ctx = (struct altmove_cmd_context *)_ctx;
 	const enum mailbox_list_iter_flags iter_flags =
 		MAILBOX_LIST_ITER_RAW_LIST |
 		MAILBOX_LIST_ITER_NO_AUTO_BOXES |
@@ -55,7 +63,7 @@
 	unsigned int i, count;
 
 	t_array_init(&purged_storages, 8);
-	iter = doveadm_mail_list_iter_init(user, ctx->search_args, iter_flags);
+	iter = doveadm_mail_list_iter_init(user, _ctx->search_args, iter_flags);
 	while ((info = doveadm_mail_list_iter_next(iter)) != NULL) T_BEGIN {
 		if (info->ns != prev_ns) {
 			if (prev_ns != NULL) {
@@ -65,7 +73,7 @@
 			}
 			prev_ns = info->ns;
 		}
-		(void)cmd_altmove_box(info, ctx->search_args);
+		(void)cmd_altmove_box(info, _ctx->search_args, ctx->reverse);
 	} T_END;
 	doveadm_mail_list_iter_deinit(&iter);
 
@@ -94,16 +102,33 @@
 	ctx->search_args = doveadm_mail_build_search_args(args);
 }
 
+static bool
+cmd_mailbox_altmove_parse_arg(struct doveadm_mail_cmd_context *_ctx, int c)
+{
+	struct altmove_cmd_context *ctx = (struct altmove_cmd_context *)_ctx;
+
+	switch (c) {
+	case 'r':
+		ctx->reverse = TRUE;
+		break;
+	default:
+		return FALSE;
+	}
+	return TRUE;
+}
+
 static struct doveadm_mail_cmd_context *cmd_altmove_alloc(void)
 {
-	struct doveadm_mail_cmd_context *ctx;
+	struct altmove_cmd_context *ctx;
 
-	ctx = doveadm_mail_cmd_alloc(struct doveadm_mail_cmd_context);
-	ctx->v.init = cmd_altmove_init;
-	ctx->v.run = cmd_altmove_run;
-	return ctx;
+	ctx = doveadm_mail_cmd_alloc(struct altmove_cmd_context);
+	ctx->ctx.getopt_args = "r";
+	ctx->ctx.v.parse_arg = cmd_mailbox_altmove_parse_arg;
+	ctx->ctx.v.init = cmd_altmove_init;
+	ctx->ctx.v.run = cmd_altmove_run;
+	return &ctx->ctx;
 }
 
 struct doveadm_mail_cmd cmd_altmove = {
-	cmd_altmove_alloc, "altmove", "<search query>"
+	cmd_altmove_alloc, "altmove", "[-r] <search query>"
 };
diff -r 6a918d40d6f7 -r 490a85b869e0 src/doveadm/doveadm-mail-iter.c
--- a/src/doveadm/doveadm-mail-iter.c	Fri Sep 16 16:14:14 2011 +0300
+++ b/src/doveadm/doveadm-mail-iter.c	Fri Sep 16 16:59:10 2011 +0300
@@ -64,7 +64,7 @@
 	}
 	if (commit) {
 		if (mailbox_transaction_commit(&iter->t) < 0) {
-			i_error("Commiting mailbox %s failed: %s",
+			i_error("Committing mailbox %s failed: %s",
 				mailbox_get_vname(iter->box),
 			mailbox_get_last_error(iter->box, NULL));
 			ret = -1;
diff -r 6a918d40d6f7 -r 490a85b869e0 src/dsync/dsync.c


More information about the dovecot-cvs mailing list