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

dovecot at dovecot.org dovecot at dovecot.org
Sun Jun 24 20:57:40 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/efd276ab2577
changeset: 14674:efd276ab2577
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Jun 24 20:57:06 2012 +0300
description:
Merged changes from v2.1 tree.

diffstat:

 .hgsigs                                                  |   1 +
 .hgtags                                                  |   1 +
 NEWS                                                     |  19 ++++
 doc/example-config/conf.d/20-imap.conf                   |   2 +-
 src/auth/auth-request.c                                  |   2 +
 src/auth/db-ldap.c                                       |   1 +
 src/auth/password-scheme.c                               |   2 +-
 src/director/director-connection.c                       |   2 +-
 src/director/director.c                                  |   5 +
 src/director/mail-host.c                                 |   2 +-
 src/doveadm/doveadm-instance.c                           |  38 ++++++++-
 src/doveadm/doveadm-log.c                                |  34 ++++++--
 src/doveadm/doveadm-print.c                              |  17 +++-
 src/doveadm/doveadm.c                                    |   4 +-
 src/imap/cmd-delete.c                                    |  16 +++-
 src/lib-charset/charset-iconv.c                          |  58 ++++++--------
 src/lib-dict/dict-file.c                                 |  18 +++-
 src/lib-index/mail-transaction-log-file.c                |   7 +-
 src/lib-index/mail-transaction-log.c                     |   1 +
 src/lib-master/master-instance.c                         |  62 ++++++++++++++-
 src/lib-master/master-instance.h                         |   1 +
 src/lib-master/master-service.c                          |   1 -
 src/lib-ssl-iostream/iostream-openssl.c                  |  19 +++-
 src/lib-ssl-iostream/istream-openssl.c                   |   2 +
 src/lib-ssl-iostream/ostream-openssl.c                   |   3 +-
 src/lib-storage/index/dbox-multi/mdbox-map-private.h     |   1 +
 src/lib-storage/index/dbox-multi/mdbox-map.c             |  23 +++++-
 src/lib-storage/index/dbox-multi/mdbox-map.h             |   2 +
 src/lib-storage/index/dbox-multi/mdbox-save.c            |   6 +
 src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c |   3 +-
 src/lib-storage/index/imapc/imapc-mailbox.c              |   4 +-
 src/lib-storage/index/imapc/imapc-storage.c              |  15 +++-
 src/lib-storage/index/mbox/mbox-mail.c                   |   4 +-
 src/lib-storage/index/mbox/mbox-save.c                   |   1 +
 src/lib-storage/index/shared/shared-list.c               |   8 +-
 src/lib-storage/mail-search-register-imap.c              |   2 +
 src/lib/primes.c                                         |   2 +-
 src/lib/restrict-access.c                                |   2 +-
 src/lib/utc-mktime.c                                     |   2 +-
 src/master/service-monitor.c                             |  18 +++-
 src/plugins/fts-squat/fts-backend-squat.c                |   5 +-
 src/plugins/fts-squat/squat-uidlist.c                    |   2 +
 src/plugins/quota/quota-maildir.c                        |  23 ++++-
 src/plugins/quota/quota.c                                |   2 +-
 44 files changed, 337 insertions(+), 106 deletions(-)

diffs (truncated from 1250 to 300 lines):

diff -r a77ad2346cf0 -r efd276ab2577 .hgsigs
--- a/.hgsigs	Sun Jun 24 20:48:38 2012 +0300
+++ b/.hgsigs	Sun Jun 24 20:57:06 2012 +0300
@@ -46,3 +46,4 @@
 2c21c940e19d97a772128a7f281cea302e157d73 0 iEYEABECAAYFAk+CtkYACgkQyUhSUUBVisknxgCfTJw2YPGJ17HbHRGmbwmCyLqepbMAn17j7IYzUfEU0xkXhCgwEAmk7XO4
 469cee314d9c54d2d7101ec9e38579fdc9610eaf 0 iEYEABECAAYFAk+VWqkACgkQyUhSUUBVislnXACfVjPqMmPUvYtXQXwqff0h7N76mZUAn02lPeUCyuyr1TF9e1hGM/sKgmko
 7c249e2a82a9cd33ae15ead6443c3499e16da623 0 iEYEABECAAYFAk+nX2sACgkQyUhSUUBVisn7uwCbBD3boxBOGEJ8OYsIJ57n5Cr09FAAoIvhxL6EHRB15AMOw4sPaALJ3/bB
+c92fb8b928f69ca01681a2c2976304b7e4bc3afc 0 iEYEABECAAYFAk/FIeIACgkQyUhSUUBVisk4IgCfUiXVXntqzPjJcALYRpqw4Zc7a/0An3HKWwgb6PBCbmvxBfTezNkqjqVK
diff -r a77ad2346cf0 -r efd276ab2577 .hgtags
--- a/.hgtags	Sun Jun 24 20:48:38 2012 +0300
+++ b/.hgtags	Sun Jun 24 20:57:06 2012 +0300
@@ -83,3 +83,4 @@
 2c21c940e19d97a772128a7f281cea302e157d73 2.1.4
 469cee314d9c54d2d7101ec9e38579fdc9610eaf 2.1.5
 7c249e2a82a9cd33ae15ead6443c3499e16da623 2.1.6
+c92fb8b928f69ca01681a2c2976304b7e4bc3afc 2.1.7
diff -r a77ad2346cf0 -r efd276ab2577 NEWS
--- a/NEWS	Sun Jun 24 20:48:38 2012 +0300
+++ b/NEWS	Sun Jun 24 20:57:06 2012 +0300
@@ -1,3 +1,22 @@
+v2.1.7 2012-05-29  Timo Sirainen <tss at iki.fi>
+
+	* LDAP: Compatibility fix for v2.0: ldap: If attributes contain
+	  ldapAttr=key=template%$ and ldapAttr doesn't exist, skip the key
+	  instead of using "template" value with empty %$ part for the key.
+
+	+ pop3: Added pop3_uidl_duplicates setting for changing the behavior
+	  for duplicate UIDLs.
+	+ director: Added "doveadm director ring remove" command.
+	- director: Don't crash with quickly disconnecting incoming director
+	  connections.
+	- mdbox: If mail was originally saved to non-INBOX, and namespace
+	  prefix is non-empty, don't assert-crash when rebuilding indexes.
+	- sdbox: Don't use more fds than necessary when copying mails.
+	- auth: Fixed crash with DIGEST-MD5 when attempting to do master user
+	  login without master passdbs. 
+	- Several fixes to mail_shared_explicit_inbox=no
+	- imapc: Use imapc_list_prefix also for listing subscriptions.
+
 v2.1.6 2012-05-07  Timo Sirainen <tss at iki.fi>
 
 	* Session ID is now included by default in auth and login process
diff -r a77ad2346cf0 -r efd276ab2577 doc/example-config/conf.d/20-imap.conf
--- a/doc/example-config/conf.d/20-imap.conf	Sun Jun 24 20:48:38 2012 +0300
+++ b/doc/example-config/conf.d/20-imap.conf	Sun Jun 24 20:57:06 2012 +0300
@@ -18,7 +18,7 @@
   # IMAP logout format string:
   #  %i - total number of bytes read from client
   #  %o - total number of bytes sent to client
-  #imap_logout_format = bytes=%i/%o
+  #imap_logout_format = in=%i out=%o
 
   # Override the IMAP CAPABILITY response. If the value begins with '+',
   # add the given capabilities on top of the defaults (e.g. +XFOO XBAR).
diff -r a77ad2346cf0 -r efd276ab2577 src/auth/auth-request.c
--- a/src/auth/auth-request.c	Sun Jun 24 20:48:38 2012 +0300
+++ b/src/auth/auth-request.c	Sun Jun 24 20:57:06 2012 +0300
@@ -1258,6 +1258,8 @@
 	i_assert(*name != '\0');
 	i_assert(value != NULL);
 
+	i_assert(request->passdb != NULL);
+
 	if (strcmp(name, "password") == 0) {
 		auth_request_set_password(request, value,
 					  default_scheme, FALSE);
diff -r a77ad2346cf0 -r efd276ab2577 src/auth/db-ldap.c
--- a/src/auth/db-ldap.c	Sun Jun 24 20:48:38 2012 +0300
+++ b/src/auth/db-ldap.c	Sun Jun 24 20:57:06 2012 +0300
@@ -866,6 +866,7 @@
 		ret = ldap_start_tls_s(conn->ld, NULL, NULL);
 		if (ret != LDAP_SUCCESS) {
 			if (ret == LDAP_OPERATIONS_ERROR &&
+			    conn->set.uris != NULL &&
 			    strncmp(conn->set.uris, "ldaps:", 6) == 0) {
 				i_fatal("LDAP: Don't use both tls=yes "
 					"and ldaps URI");
diff -r a77ad2346cf0 -r efd276ab2577 src/auth/password-scheme.c
--- a/src/auth/password-scheme.c	Sun Jun 24 20:48:38 2012 +0300
+++ b/src/auth/password-scheme.c	Sun Jun 24 20:57:06 2012 +0300
@@ -367,7 +367,7 @@
 		str = password_generate_md5_crypt(plaintext, password);
 		return strcmp(str, password) == 0 ? 1 : 0;
 	} else if (password_decode(password, "PLAIN-MD5",
-				   &md5_password, &md5_size, &error) < 0) {
+				   &md5_password, &md5_size, &error) <= 0) {
 		*error_r = "Not a valid MD5-CRYPT or PLAIN-MD5 password";
 		return -1;
 	} else {
diff -r a77ad2346cf0 -r efd276ab2577 src/director/director-connection.c
--- a/src/director/director-connection.c	Sun Jun 24 20:48:38 2012 +0300
+++ b/src/director/director-connection.c	Sun Jun 24 20:57:06 2012 +0300
@@ -711,7 +711,7 @@
 	bool weak = TRUE;
 	int ret;
 
-	if ((ret = director_cmd_is_seen(conn, &args, &dir_host)) < 0)
+	if ((ret = director_cmd_is_seen(conn, &args, &dir_host)) != 0)
 		return FALSE;
 
 	if (str_array_length(args) != 2 ||
diff -r a77ad2346cf0 -r efd276ab2577 src/director/director.c
--- a/src/director/director.c	Sun Jun 24 20:48:38 2012 +0300
+++ b/src/director/director.c	Sun Jun 24 20:57:06 2012 +0300
@@ -363,6 +363,11 @@
 {
 	/* we're synced again when we receive this SYNC back */
 	dir->sync_seq++;
+	if (dir->right == NULL && dir->left == NULL) {
+		/* we're alone. if we're already synced,
+		   don't become unsynced. */
+		return;
+	}
 	director_set_ring_unsynced(dir);
 
 	if (dir->sync_frozen) {
diff -r a77ad2346cf0 -r efd276ab2577 src/director/mail-host.c
--- a/src/director/mail-host.c	Sun Jun 24 20:48:38 2012 +0300
+++ b/src/director/mail-host.c	Sun Jun 24 20:57:06 2012 +0300
@@ -110,7 +110,7 @@
 	i2 = htonl(ip2_arr[i]);
 
 	for (j = last_bits; j < 32; j++) {
-		if ((i1 & (1 << j)) != (i2 & (1 << j))) {
+		if ((i1 & (1U << j)) != (i2 & (1U << j))) {
 			i_error("IP address range too large: %s-%s",
 				net_ip2addr(&ip1), net_ip2addr(&ip2));
 			return -1;
diff -r a77ad2346cf0 -r efd276ab2577 src/doveadm/doveadm-instance.c
--- a/src/doveadm/doveadm-instance.c	Sun Jun 24 20:48:38 2012 +0300
+++ b/src/doveadm/doveadm-instance.c	Sun Jun 24 20:57:06 2012 +0300
@@ -5,6 +5,7 @@
 #include "doveadm.h"
 #include "doveadm-print.h"
 
+#include <stdio.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <signal.h>
@@ -42,22 +43,45 @@
 	return found;
 }
 
-static void cmd_instance_list(int argc ATTR_UNUSED, char *argv[] ATTR_UNUSED)
+static void cmd_instance_list(int argc, char *argv[])
 {
 	struct master_instance_list *list;
 	struct master_instance_list_iter *iter;
 	const struct master_instance *inst;
 	const char *pidfile_path;
+	bool show_config = FALSE;
+	int c;
 
-	doveadm_print_init(DOVEADM_PRINT_TYPE_TABLE);
-	doveadm_print_header("path", "path", DOVEADM_PRINT_HEADER_FLAG_EXPAND);
-	doveadm_print_header_simple("name");
-	doveadm_print_header_simple("last used");
-	doveadm_print_header_simple("running");
+	while ((c = getopt(argc, argv, "c")) > 0) {
+		switch (c) {
+		case 'c':
+			show_config = TRUE;
+			break;
+		default:
+			help(&doveadm_cmd_instance[0]);
+		}
+	}
+	argv += optind;
+
+	if (!show_config) {
+		doveadm_print_init(DOVEADM_PRINT_TYPE_TABLE);
+		doveadm_print_header("path", "path", DOVEADM_PRINT_HEADER_FLAG_EXPAND);
+		doveadm_print_header_simple("name");
+		doveadm_print_header_simple("last used");
+		doveadm_print_header_simple("running");
+	}
 
 	list = master_instance_list_init(MASTER_INSTANCE_PATH);
 	iter = master_instance_list_iterate_init(list);
 	while ((inst = master_instance_iterate_list_next(iter)) != NULL) {
+		if (argv[0] != NULL && strcmp(argv[0], inst->name) != 0)
+			continue;
+
+		if (show_config) {
+			printf("%s\n", inst->config_path == NULL ? "" :
+			       inst->config_path);
+			continue;
+		}
 		doveadm_print(inst->base_dir);
 		doveadm_print(inst->name);
 		doveadm_print(unixdate2str(inst->last_used));
@@ -95,7 +119,7 @@
 }
 
 struct doveadm_cmd doveadm_cmd_instance[] = {
-	{ cmd_instance_list, "instance list", "" },
+	{ cmd_instance_list, "instance list", "[-c] [<name>]" },
 	{ cmd_instance_remove, "instance remove", "<name> | <base dir>" }
 };
 
diff -r a77ad2346cf0 -r efd276ab2577 src/doveadm/doveadm-log.c
--- a/src/doveadm/doveadm-log.c	Sun Jun 24 20:48:38 2012 +0300
+++ b/src/doveadm/doveadm-log.c	Sun Jun 24 20:57:06 2012 +0300
@@ -23,6 +23,8 @@
 #define LOG_ERRORS_FNAME "log-errors"
 #define LOG_TIMESTAMP_FORMAT "%b %d %H:%M:%S"
 
+extern struct doveadm_cmd doveadm_cmd_log[];
+
 static void ATTR_NULL(2)
 cmd_log_test(int argc ATTR_UNUSED, char *argv[] ATTR_UNUSED)
 {
@@ -279,7 +281,7 @@
 	}
 }
 
-static void cmd_log_error_write(const char *const *args)
+static void cmd_log_error_write(const char *const *args, time_t min_timestamp)
 {
 	/* <type> <timestamp> <prefix> <text> */
 	const char *type_prefix = "?";
@@ -298,16 +300,32 @@
 		i_error("Invalid timestamp: %s", args[1]);
 		t = 0;
 	}
-
-	printf("%s %s%s%s\n", t_strflocaltime(LOG_TIMESTAMP_FORMAT, t),
-	       args[2], type_prefix, args[3]);
+	if (t >= min_timestamp) {
+		printf("%s %s%s%s\n", t_strflocaltime(LOG_TIMESTAMP_FORMAT, t),
+		       args[2], type_prefix, args[3]);
+	}
 }
 
-static void cmd_log_errors(int argc ATTR_UNUSED, char *argv[] ATTR_UNUSED)
+static void cmd_log_errors(int argc, char *argv[])
 {
 	struct istream *input;
 	const char *path, *line, *const *args;
-	int fd;
+	time_t min_timestamp = 0;
+	int c, fd;
+
+	while ((c = getopt(argc, argv, "s:")) > 0) {
+		switch (c) {
+		case 's':
+			if (str_to_time(optarg, &min_timestamp) < 0)
+				i_fatal("Invalid timestamp: %s", optarg);
+			break;
+		default:
+			help(&doveadm_cmd_log[3]);
+		}
+	}
+	argv += optind - 1;
+	if (argv[1] != NULL)
+		help(&doveadm_cmd_log[3]);
 
 	path = t_strconcat(doveadm_settings->base_dir,
 			   "/"LOG_ERRORS_FNAME, NULL);
@@ -320,7 +338,7 @@
 	while ((line = i_stream_read_next_line(input)) != NULL) T_BEGIN {
 		args = t_strsplit_tabescaped(line);
 		if (str_array_length(args) == 4)
-			cmd_log_error_write(args);
+			cmd_log_error_write(args, min_timestamp);
 		else {
 			i_error("Invalid input from log: %s", line);
 			doveadm_exit_code = EX_PROTOCOL;
@@ -333,7 +351,7 @@
 	{ cmd_log_test, "log test", "" },
 	{ cmd_log_reopen, "log reopen", "" },
 	{ cmd_log_find, "log find", "[<dir>]" },
-	{ cmd_log_errors, "log errors", "" }
+	{ cmd_log_errors, "log errors", "[-s <min_timestamp>]" }
 };
 
 void doveadm_register_log_commands(void)
diff -r a77ad2346cf0 -r efd276ab2577 src/doveadm/doveadm-print.c
--- a/src/doveadm/doveadm-print.c	Sun Jun 24 20:48:38 2012 +0300
+++ b/src/doveadm/doveadm-print.c	Sun Jun 24 20:57:06 2012 +0300
@@ -18,6 +18,7 @@
 	const struct doveadm_print_vfuncs *v;
 
 	unsigned int header_idx;
+	bool print_stream_open;
 };
 
 static struct doveadm_print_context *ctx;
@@ -52,7 +53,7 @@
 	doveadm_print_header(key_title, key_title, 0);
 }
 
-void doveadm_print(const char *value)
+static void doveadm_print_sticky_headers(void)
 {
 	const struct doveadm_print_header_context *headers;
 	unsigned int count;
@@ -68,7 +69,13 @@
 			break;
 		}


More information about the dovecot-cvs mailing list