dovecot-2.2: Merged changes from v2.1 tree.

dovecot at dovecot.org dovecot at dovecot.org
Wed Sep 26 18:01:30 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/e3175ee39483
changeset: 15162:e3175ee39483
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Sep 26 18:01:01 2012 +0300
description:
Merged changes from v2.1 tree.

diffstat:

 .hgsigs                                              |    1 +
 .hgtags                                              |    1 +
 NEWS                                                 |   26 +
 configure.in                                         |    1 +
 doc/example-config/conf.d/20-lmtp.conf               |    4 +
 src/auth/auth-request.c                              |   33 +-
 src/auth/auth-request.h                              |    4 +
 src/auth/db-ldap.c                                   |   38 +-
 src/auth/passdb-imap.c                               |    1 +
 src/auth/userdb-static.c                             |    6 +
 src/config/config-parser.c                           |    8 +-
 src/director/director-connection.c                   |  137 +++++--
 src/director/director-connection.h                   |    3 +-
 src/director/director-request.c                      |    9 +
 src/director/director.c                              |    9 +-
 src/director/director.h                              |    4 +-
 src/doveadm/Makefile.am                              |    1 +
 src/doveadm/doveadm-settings.c                       |    2 +
 src/doveadm/doveadm-settings.h                       |    1 +
 src/doveadm/doveadm.c                                |   16 +
 src/lib-imap-client/imapc-client.h                   |    3 +
 src/lib-imap-client/imapc-connection.c               |   18 +-
 src/lib-imap/imap-parser.c                           |   80 ++++-
 src/lib-imap/imap-parser.h                           |    6 +-
 src/lib-master/master-service-settings-cache.c       |    3 +-
 src/lib-settings/settings-parser.c                   |    4 +-
 src/lib-storage/index/dbox-common/dbox-storage.c     |    3 +-
 src/lib-storage/index/dbox-multi/mdbox-file.c        |   17 +-
 src/lib-storage/index/dbox-multi/mdbox-map-private.h |    1 -
 src/lib-storage/index/dbox-multi/mdbox-map.c         |   11 +-
 src/lib-storage/index/dbox-multi/mdbox-storage.c     |    3 +-
 src/lib-storage/index/dbox-single/sdbox-storage.c    |    3 +-
 src/lib-storage/index/imapc/imapc-settings.c         |    4 +
 src/lib-storage/index/index-status.c                 |    1 +
 src/lib-storage/index/maildir/maildir-storage.c      |    3 +-
 src/lib-storage/index/mbox/mbox-storage.c            |    3 +-
 src/lib-storage/index/pop3c/pop3c-mail.c             |    2 +-
 src/lib-storage/list/mailbox-list-fs-iter.c          |   13 +
 src/lib-storage/list/mailbox-list-maildir-iter.c     |    5 +
 src/lib-storage/mail-storage-service.c               |    2 +-
 src/lib-storage/mail-storage.h                       |    3 +-
 src/lib-storage/mailbox-guid-cache.c                 |    1 +
 src/lib-storage/mailbox-list-iter.h                  |    4 +-
 src/lib-storage/mailbox-list-private.h               |    3 +
 src/lib-storage/mailbox-list.c                       |   40 ++-
 src/lib-storage/mailbox-list.h                       |    2 +
 src/lib/hash.c                                       |    2 +-
 src/lmtp/client.c                                    |    3 +
 src/lmtp/commands.c                                  |   67 +++-
 src/lmtp/lmtp-settings.c                             |    2 +
 src/lmtp/lmtp-settings.h                             |    1 +
 src/plugins/Makefile.am                              |    1 +
 src/plugins/acl/acl-lookup-dict.c                    |   12 +-
 src/plugins/fts-lucene/lucene-wrapper.cc             |    2 +-
 src/plugins/fts-solr/fts-backend-solr.c              |    1 +
 src/plugins/mailbox-alias/Makefile.am                |   18 +
 src/plugins/mailbox-alias/mailbox-alias-plugin.c     |  334 +++++++++++++++++++
 src/plugins/mailbox-alias/mailbox-alias-plugin.h     |    7 +
 src/plugins/quota/quota-count.c                      |    1 +
 src/plugins/quota/quota-maildir.c                    |    1 +
 src/plugins/quota/quota-private.h                    |    2 +-
 src/plugins/quota/quota-storage.c                    |   31 +
 src/plugins/quota/quota.c                            |    6 +-
 63 files changed, 908 insertions(+), 126 deletions(-)

diffs (truncated from 2086 to 300 lines):

diff -r 981e0bc71742 -r e3175ee39483 .hgsigs
--- a/.hgsigs	Wed Sep 26 17:17:08 2012 +0300
+++ b/.hgsigs	Wed Sep 26 18:01:01 2012 +0300
@@ -49,3 +49,4 @@
 c92fb8b928f69ca01681a2c2976304b7e4bc3afc 0 iEYEABECAAYFAk/FIeIACgkQyUhSUUBVisk4IgCfUiXVXntqzPjJcALYRpqw4Zc7a/0An3HKWwgb6PBCbmvxBfTezNkqjqVK
 7e5f36fd989d27a2fb48250adbab8fa54ddb6083 0 iEYEABECAAYFAk/yVakACgkQyUhSUUBVismekwCfSEVQjd6fwdChjd53LSt03b4UWKoAoIxd/IjLatTISlHm44iiQwzRKByo
 bc86680293d256d5a8009690caeb73ab2e34e359 0 iEYEABECAAYFAlAZaTUACgkQyUhSUUBVisnTAACfU1pB34RrXEyLnpnL4Ee/oeNBYcoAnRWxTqx870Efjwf+eBPzafO0C/NU
+1a6c3b4e92e4174d3b1eb0a7c841f97e8fb9e590 0 iEYEABECAAYFAlBYwJMACgkQyUhSUUBVisn2PwCeIJxfB5ebXlAbtMcjrZBCmB8Kg1sAn39BC9rQoR/wjD2/ix1JaxH7gHOT
diff -r 981e0bc71742 -r e3175ee39483 .hgtags
--- a/.hgtags	Wed Sep 26 17:17:08 2012 +0300
+++ b/.hgtags	Wed Sep 26 18:01:01 2012 +0300
@@ -86,3 +86,4 @@
 c92fb8b928f69ca01681a2c2976304b7e4bc3afc 2.1.7
 7e5f36fd989d27a2fb48250adbab8fa54ddb6083 2.1.8
 bc86680293d256d5a8009690caeb73ab2e34e359 2.1.9
+1a6c3b4e92e4174d3b1eb0a7c841f97e8fb9e590 2.1.10
diff -r 981e0bc71742 -r e3175ee39483 NEWS
--- a/NEWS	Wed Sep 26 17:17:08 2012 +0300
+++ b/NEWS	Wed Sep 26 18:01:01 2012 +0300
@@ -19,6 +19,32 @@
 	+ LMTP proxy: Implemented XCLIENT extension for passing remote IP
 	  address through proxy.
 
+v2.1.10 2012-09-18  Timo Sirainen <tss at iki.fi>
+
+	+ imap: Implemented THREAD=ORDEREDSUBJECT extension.
+	+ Added "doveadm exec" command to easily execute commands from
+	  libexec_dir, e.g. "doveadm exec imap -u user at domain"
+	+ Added "doveadm copy" command.
+	+ doveadm copy/move: Added optional user parameter to specify the
+	  source username. This allows easily copying mails between different
+	  users.
+	+ Added namespace { disabled } setting to quickly enable/disable
+	  namespaces. This is especially useful when its value is returned by
+	  userdb.
+	+ Added mailbox_alias plugin. It allows creating mailbox aliases using
+	  symlinks.
+	+ imapc storage: Added imapc_max_idle_time setting to force activity
+	  on connection.
+	+ fts-solr: Expunging multiple messages is now faster.
+	- director: In some conditions director may have disconnected from
+	  another director (without logging about it), thinking it was sending
+	  invalid data.
+	- imap: Various fixes to listing mailboxes.
+	- pop3-migration plugin: Avoid disconnection from POP3 server due
+	  to idling.
+	- login processes crashed if there were a lot of local {} or remote {}
+	  settings blocks.
+
 v2.1.9 2012-08-01  Timo Sirainen <tss at iki.fi>
 
 	* mail-log plugin: Log mailbox names with UTF-8 everywhere 
diff -r 981e0bc71742 -r e3175ee39483 configure.in
--- a/configure.in	Wed Sep 26 17:17:08 2012 +0300
+++ b/configure.in	Wed Sep 26 18:01:01 2012 +0300
@@ -2820,6 +2820,7 @@
 src/plugins/lazy-expunge/Makefile
 src/plugins/listescape/Makefile
 src/plugins/mail-log/Makefile
+src/plugins/mailbox-alias/Makefile
 src/plugins/notify/Makefile
 src/plugins/pop3-migration/Makefile
 src/plugins/quota/Makefile
diff -r 981e0bc71742 -r e3175ee39483 doc/example-config/conf.d/20-lmtp.conf
--- a/doc/example-config/conf.d/20-lmtp.conf	Wed Sep 26 17:17:08 2012 +0300
+++ b/doc/example-config/conf.d/20-lmtp.conf	Wed Sep 26 18:01:01 2012 +0300
@@ -10,7 +10,11 @@
 # lda_mailbox_autocreate settings.
 #lmtp_save_to_detail_mailbox = no
 
+# Verify quota before replying to RCPT TO. This adds a small overhead.
+#lmtp_rcpt_check_quota = no
+
 protocol lmtp {
   # Space separated list of plugins to load (default is global mail_plugins).
   #mail_plugins = $mail_plugins
 }
+			  
\ No newline at end of file
diff -r 981e0bc71742 -r e3175ee39483 src/auth/auth-request.c
--- a/src/auth/auth-request.c	Wed Sep 26 17:17:08 2012 +0300
+++ b/src/auth/auth-request.c	Wed Sep 26 18:01:01 2012 +0300
@@ -1820,18 +1820,27 @@
 	{ '\0', NULL, NULL }
 };
 
-const struct var_expand_table *
-auth_request_get_var_expand_table(const struct auth_request *auth_request,
-				  auth_request_escape_func_t *escape_func)
+struct var_expand_table *
+auth_request_get_var_expand_table_full(const struct auth_request *auth_request,
+				       auth_request_escape_func_t *escape_func,
+				       unsigned int *count)
 {
-	struct var_expand_table *tab;
+	const unsigned int auth_count =
+		N_ELEMENTS(auth_request_var_expand_static_tab);
+	struct var_expand_table *tab, *ret_tab;
 
 	if (escape_func == NULL)
 		escape_func = escape_none;
 
-	tab = t_malloc(sizeof(auth_request_var_expand_static_tab));
+	/* keep the extra fields at the beginning. the last static_tab field
+	   contains the ending NULL-fields. */
+	tab = ret_tab = t_malloc((*count + auth_count) * sizeof(*tab));
+	memset(tab, 0, *count * sizeof(*tab));
+	tab += *count;
+	*count += auth_count;
+
 	memcpy(tab, auth_request_var_expand_static_tab,
-	       sizeof(auth_request_var_expand_static_tab));
+	       auth_count * sizeof(*tab));
 
 	tab[0].value = escape_func(auth_request->user, auth_request);
 	tab[1].value = escape_func(t_strcut(auth_request->user, '@'),
@@ -1878,7 +1887,17 @@
 	}
 	tab[18].value = auth_request->session_id == NULL ? NULL :
 		escape_func(auth_request->session_id, auth_request);
-	return tab;
+	return ret_tab;
+}
+
+const struct var_expand_table *
+auth_request_get_var_expand_table(const struct auth_request *auth_request,
+				  auth_request_escape_func_t *escape_func)
+{
+	unsigned int count = 0;
+
+	return auth_request_get_var_expand_table_full(auth_request, escape_func,
+						      &count);
 }
 
 static void get_log_prefix(string_t *str, struct auth_request *auth_request,
diff -r 981e0bc71742 -r e3175ee39483 src/auth/auth-request.h
--- a/src/auth/auth-request.h	Wed Sep 26 17:17:08 2012 +0300
+++ b/src/auth/auth-request.h	Wed Sep 26 18:01:01 2012 +0300
@@ -212,6 +212,10 @@
 auth_request_get_var_expand_table(const struct auth_request *auth_request,
 				  auth_request_escape_func_t *escape_func)
 	ATTR_NULL(2);
+struct var_expand_table *
+auth_request_get_var_expand_table_full(const struct auth_request *auth_request,
+				       auth_request_escape_func_t *escape_func,
+				       unsigned int *count) ATTR_NULL(2);
 const char *auth_request_str_escape(const char *string,
 				    const struct auth_request *request);
 
diff -r 981e0bc71742 -r e3175ee39483 src/auth/db-ldap.c
--- a/src/auth/db-ldap.c	Wed Sep 26 17:17:08 2012 +0300
+++ b/src/auth/db-ldap.c	Wed Sep 26 18:01:01 2012 +0300
@@ -63,7 +63,6 @@
 
 	/* attribute name => value */
 	HASH_TABLE(char *, struct db_ldap_value *) ldap_attrs;
-	struct var_expand_table *var_table;
 
 	const char *val_1_arr[2];
 	string_t *var, *debug;
@@ -1068,21 +1067,17 @@
 	*attr_names_r = array_idx_modifiable(&ctx.attr_names, 0);
 }
 
-static struct var_expand_table *
-db_ldap_value_get_var_expand_table(pool_t pool,
-				   struct auth_request *auth_request)
+static const struct var_expand_table *
+db_ldap_value_get_var_expand_table(struct auth_request *auth_request,
+				   const char *ldap_value)
 {
-	const struct var_expand_table *auth_table = NULL;
 	struct var_expand_table *table;
-	unsigned int count;
+	unsigned int count = 1;
 
-	auth_table = auth_request_get_var_expand_table(auth_request, NULL);
-	for (count = 0; auth_table[count].key != '\0'; count++) ;
-	count++;
-
-	table = p_new(pool, struct var_expand_table, count + 2);
+	table = auth_request_get_var_expand_table_full(auth_request, NULL,
+						       &count);
 	table[0].key = '$';
-	memcpy(table + 1, auth_table, sizeof(*table) * count);
+	table[0].value = ldap_value;
 	return table;
 }
 
@@ -1238,6 +1233,7 @@
 		{ "ldap", db_ldap_field_expand },
 		{ NULL, NULL }
 	};
+	const struct var_expand_table *var_table;
 	const char *const *values;
 
 	if (ldap_value != NULL)
@@ -1263,14 +1259,18 @@
 				"using value '%s'",
 				field->name, values[0]);
 		}
-		if (ctx->var_table == NULL) {
-			ctx->var_table = db_ldap_value_get_var_expand_table(
-						ctx->pool, ctx->auth_request);
+
+		/* do this lookup separately for each expansion, because:
+		   1) the values are allocated from data stack
+		   2) if "user" field is updated, we want %u/%n/%d updated
+		      (and less importantly the same for other variables) */
+		var_table = db_ldap_value_get_var_expand_table(ctx->auth_request,
+							       values[0]);
+		if (ctx->var == NULL)
 			ctx->var = str_new(ctx->pool, 256);
-		}
-		ctx->var_table[0].value = values[0];
-		str_truncate(ctx->var, 0);
-		var_expand_with_funcs(ctx->var, field->value, ctx->var_table,
+		else
+			str_truncate(ctx->var, 0);
+		var_expand_with_funcs(ctx->var, field->value, var_table,
 				      var_funcs_table, ctx);
 		ctx->val_1_arr[0] = str_c(ctx->var);
 		values = ctx->val_1_arr;
diff -r 981e0bc71742 -r e3175ee39483 src/auth/passdb-imap.c
--- a/src/auth/passdb-imap.c	Wed Sep 26 17:17:08 2012 +0300
+++ b/src/auth/passdb-imap.c	Wed Sep 26 18:01:01 2012 +0300
@@ -85,6 +85,7 @@
 		t_strconcat(auth_request->set->base_dir, "/",
 			    DNS_CLIENT_SOCKET_NAME, NULL);
 	set.password = password;
+	set.max_idle_time = IMAPC_DEFAULT_MAX_IDLE_TIME;
 
 	if (module->set_have_vars) {
 		str = t_str_new(128);
diff -r 981e0bc71742 -r e3175ee39483 src/auth/userdb-static.c
--- a/src/auth/userdb-static.c	Wed Sep 26 17:17:08 2012 +0300
+++ b/src/auth/userdb-static.c	Wed Sep 26 18:01:01 2012 +0300
@@ -42,6 +42,8 @@
 {
 	struct static_context *ctx = auth_request->context;
 
+	auth_request->userdb_lookup = TRUE;
+
 	auth_request->private_callback.userdb = ctx->old_callback;
 	auth_request->context = ctx->old_context;
 	auth_request_set_state(auth_request, AUTH_REQUEST_STATE_USERDB);
@@ -92,6 +94,10 @@
 
 		auth_request->context = ctx;
 		if (auth_request->passdb != NULL) {
+			/* kludge: temporarily work as if we weren't doing
+			   a userdb lookup. this is to get auth cache to use
+			   passdb caching instead of userdb caching. */
+			auth_request->userdb_lookup = FALSE;
 			auth_request_lookup_credentials(auth_request, "",
 				static_credentials_callback);
 		} else {
diff -r 981e0bc71742 -r e3175ee39483 src/config/config-parser.c
--- a/src/config/config-parser.c	Wed Sep 26 17:17:08 2012 +0300
+++ b/src/config/config-parser.c	Wed Sep 26 18:01:01 2012 +0300
@@ -255,10 +255,14 @@
 	}
 
 	max_bits = IPADDR_IS_V4(&ips[0]) ? 32 : 128;
-	if (p == NULL || str_to_uint(p, &bits) < 0 || bits > max_bits)
+	if (p == NULL)
 		*bits_r = max_bits;
-	else
+	else if (str_to_uint(p, &bits) == 0 && bits <= max_bits)
 		*bits_r = bits;
+	else {
+		*error_r = t_strdup_printf("Invalid network mask: %s", p);
+		return -1;
+	}
 	return 0;
 }
 
diff -r 981e0bc71742 -r e3175ee39483 src/director/director-connection.c
--- a/src/director/director-connection.c	Wed Sep 26 17:17:08 2012 +0300
+++ b/src/director/director-connection.c	Wed Sep 26 18:01:01 2012 +0300
@@ -71,6 +71,8 @@
    mark the host as failed so we won't try to reconnect to it immediately */
 #define DIRECTOR_SUCCESS_MIN_CONNECT_SECS 40
 #define DIRECTOR_WAIT_DISCONNECT_SECS 10
+#define DIRECTOR_HANDSHAKE_WARN_SECS 29
+#define DIRECTOR_HANDSHAKE_BYTES_LOG_MIN_SECS (60*30)
 
 #if DIRECTOR_CONNECTION_DONE_TIMEOUT_MSECS <= DIRECTOR_CONNECTION_PING_TIMEOUT_MSECS
 #  error DIRECTOR_CONNECTION_DONE_TIMEOUT_MSECS is too low
@@ -92,6 +94,8 @@
 	/* for incoming connections the director host isn't known until
 	   ME-line is received */
 	struct director_host *host;
+	/* this is set only for wrong connections: */
+	struct director_host *connect_request_to;
 
 	int fd;
 	struct io *io;
@@ -118,7 +122,9 @@
 };


More information about the dovecot-cvs mailing list