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

dovecot at dovecot.org dovecot at dovecot.org
Fri Aug 10 05:24:42 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/6a0954d0ce09
changeset: 14840:6a0954d0ce09
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Aug 10 05:24:07 2012 +0300
description:
Merged changes from v2.1 tree.

diffstat:

 .hgsigs                                            |    2 +
 .hgtags                                            |    2 +
 NEWS                                               |   39 +
 configure.in                                       |    6 +
 doc/Makefile.am                                    |    8 +-
 doc/example-config/conf.d/10-director.conf         |    5 +
 doc/example-config/conf.d/auth-dict.conf.ext       |   16 +
 doc/example-config/dovecot-dict-auth.conf.ext      |   22 +
 src/auth/Makefile.am                               |    5 +
 src/auth/auth-cache.c                              |  228 +++++-
 src/auth/auth-cache.h                              |    7 +-
 src/auth/auth-master-connection.c                  |   27 +
 src/auth/auth-request.h                            |    4 +
 src/auth/auth.c                                    |    9 +
 src/auth/db-dict.c                                 |  177 +++++
 src/auth/db-dict.h                                 |   37 +
 src/auth/db-ldap.c                                 |    3 +-
 src/auth/db-passwd-file.c                          |   18 +-
 src/auth/db-passwd-file.h                          |    1 +
 src/auth/main.c                                    |    3 +
 src/auth/mech-gssapi.c                             |   62 +-
 src/auth/mech-winbind.c                            |    2 +-
 src/auth/passdb-dict.c                             |  197 ++++++
 src/auth/passdb.c                                  |    2 +
 src/auth/test-auth-cache.c                         |   18 +-
 src/auth/userdb-dict.c                             |  207 ++++++
 src/auth/userdb.c                                  |    2 +
 src/config/config-connection.c                     |    2 +-
 src/config/doveconf.c                              |    7 +-
 src/config/old-set-parser.c                        |    2 +-
 src/director/director-settings.c                   |    2 +-
 src/doveadm/client-connection.c                    |    8 +
 src/doveadm/doveadm-auth.c                         |   82 ++-
 src/doveadm/doveadm-mail-mailbox-status.c          |    1 +
 src/doveadm/doveadm.c                              |    3 +-
 src/doveadm/doveadm.h                              |    3 +-
 src/doveadm/main.c                                 |    5 +-
 src/imap-login/client.c                            |    2 +-
 src/imap/cmd-delete.c                              |    7 +
 src/imap/cmd-list.c                                |   38 +-
 src/imap/cmd-status.c                              |    5 +-
 src/imap/imap-status.c                             |    4 +-
 src/imap/imap-status.h                             |    2 +-
 src/lib-auth/auth-master.c                         |   43 +
 src/lib-auth/auth-master.h                         |    4 +
 src/lib-charset/charset-iconv.c                    |   13 +-
 src/lib-dict/Makefile.am                           |    4 +-
 src/lib-dict/dict-memcached.c                      |  376 +++++++++++
 src/lib-dict/dict-private.h                        |    4 +-
 src/lib-dict/dict-redis.c                          |  666 +++++++++++++++++++++
 src/lib-dict/dict.c                                |   16 +-
 src/lib-dict/test-dict.c                           |    2 +
 src/lib-imap-client/imapc-client.c                 |    2 +-
 src/lib-imap-client/imapc-connection.c             |   29 +-
 src/lib-imap-client/imapc-connection.h             |    3 +-
 src/lib-mail/mail-user-hash.c                      |    6 +
 src/lib-master/master-service-settings-cache.c     |   36 +-
 src/lib-master/mountpoint-list.c                   |    2 +
 src/lib-settings/settings-parser.c                 |    2 +
 src/lib-sql/sql-db-cache.c                         |    1 +
 src/lib-ssl-iostream/iostream-openssl.c            |    6 +-
 src/lib-storage/index/imapc/imapc-save.c           |    6 +-
 src/lib-storage/index/index-mail.c                 |    3 +-
 src/lib-storage/index/index-storage.c              |   13 +-
 src/lib-storage/index/pop3c/pop3c-client.c         |   11 +-
 src/lib-storage/index/pop3c/pop3c-mail.c           |    9 +-
 src/lib-storage/index/pop3c/pop3c-settings.c       |    2 +
 src/lib-storage/index/pop3c/pop3c-settings.h       |    1 +
 src/lib-storage/index/pop3c/pop3c-storage.c        |    1 +
 src/lib-storage/index/shared/shared-list.c         |    3 +-
 src/lib-storage/list/mailbox-list-delete.c         |    5 +-
 src/lib-storage/list/mailbox-list-fs-iter.c        |   16 +-
 src/lib-storage/mail-namespace.c                   |    6 +-
 src/lib-storage/mail-storage.c                     |   10 +-
 src/lib-storage/mail-user.c                        |    4 +-
 src/lib/Makefile.am                                |    2 +
 src/lib/file-set-size.c                            |    2 +-
 src/lib/json-parser.c                              |  272 ++++++++
 src/lib/json-parser.h                              |   22 +
 src/lmtp/commands.c                                |   68 ++
 src/lmtp/lmtp-proxy.c                              |    4 +
 src/lmtp/lmtp-settings.c                           |    2 +
 src/lmtp/lmtp-settings.h                           |    1 +
 src/login-common/client-common.c                   |    8 +-
 src/login-common/client-common.h                   |    1 +
 src/login-common/ssl-proxy-openssl.c               |   34 +-
 src/master/main.c                                  |    3 +-
 src/plugins/fts-lucene/Makefile.am                 |    4 +
 src/plugins/fts-lucene/lucene-wrapper.cc           |    8 +-
 src/plugins/fts-solr/fts-backend-solr.c            |   39 +-
 src/plugins/fts-solr/solr-connection.c             |    8 +-
 src/plugins/fts/fts-api.c                          |   23 +-
 src/plugins/fts/fts-search.c                       |   14 +-
 src/plugins/imap-acl/imap-acl-plugin.c             |    5 +-
 src/plugins/imap-quota/imap-quota-plugin.c         |    5 +-
 src/plugins/mail-log/mail-log-plugin.c             |   10 +-
 src/plugins/pop3-migration/pop3-migration-plugin.c |    7 +-
 src/plugins/quota/quota-private.h                  |    6 +-
 src/plugins/quota/quota-storage.c                  |    5 +-
 src/plugins/quota/quota.c                          |    4 +-
 src/pop3-login/client-authenticate.c               |    2 +-
 src/pop3/pop3-commands.c                           |    2 +-
 src/util/script.c                                  |    6 +-
 103 files changed, 2882 insertions(+), 272 deletions(-)

diffs (truncated from 4961 to 300 lines):

diff -r 53139f2f2284 -r 6a0954d0ce09 .hgsigs
--- a/.hgsigs	Fri Aug 10 04:56:56 2012 +0300
+++ b/.hgsigs	Fri Aug 10 05:24:07 2012 +0300
@@ -47,3 +47,5 @@
 469cee314d9c54d2d7101ec9e38579fdc9610eaf 0 iEYEABECAAYFAk+VWqkACgkQyUhSUUBVislnXACfVjPqMmPUvYtXQXwqff0h7N76mZUAn02lPeUCyuyr1TF9e1hGM/sKgmko
 7c249e2a82a9cd33ae15ead6443c3499e16da623 0 iEYEABECAAYFAk+nX2sACgkQyUhSUUBVisn7uwCbBD3boxBOGEJ8OYsIJ57n5Cr09FAAoIvhxL6EHRB15AMOw4sPaALJ3/bB
 c92fb8b928f69ca01681a2c2976304b7e4bc3afc 0 iEYEABECAAYFAk/FIeIACgkQyUhSUUBVisk4IgCfUiXVXntqzPjJcALYRpqw4Zc7a/0An3HKWwgb6PBCbmvxBfTezNkqjqVK
+7e5f36fd989d27a2fb48250adbab8fa54ddb6083 0 iEYEABECAAYFAk/yVakACgkQyUhSUUBVismekwCfSEVQjd6fwdChjd53LSt03b4UWKoAoIxd/IjLatTISlHm44iiQwzRKByo
+bc86680293d256d5a8009690caeb73ab2e34e359 0 iEYEABECAAYFAlAZaTUACgkQyUhSUUBVisnTAACfU1pB34RrXEyLnpnL4Ee/oeNBYcoAnRWxTqx870Efjwf+eBPzafO0C/NU
diff -r 53139f2f2284 -r 6a0954d0ce09 .hgtags
--- a/.hgtags	Fri Aug 10 04:56:56 2012 +0300
+++ b/.hgtags	Fri Aug 10 05:24:07 2012 +0300
@@ -84,3 +84,5 @@
 469cee314d9c54d2d7101ec9e38579fdc9610eaf 2.1.5
 7c249e2a82a9cd33ae15ead6443c3499e16da623 2.1.6
 c92fb8b928f69ca01681a2c2976304b7e4bc3afc 2.1.7
+7e5f36fd989d27a2fb48250adbab8fa54ddb6083 2.1.8
+bc86680293d256d5a8009690caeb73ab2e34e359 2.1.9
diff -r 53139f2f2284 -r 6a0954d0ce09 NEWS
--- a/NEWS	Fri Aug 10 04:56:56 2012 +0300
+++ b/NEWS	Fri Aug 10 05:24:07 2012 +0300
@@ -1,3 +1,42 @@
+v2.1.9 2012-08-01  Timo Sirainen <tss at iki.fi>
+
+	* mail-log plugin: Log mailbox names with UTF-8 everywhere 
+	  (instead of mUTF-7 in some places and UTF-8 in other places)
+	* director: Changed director_username_hash setting's default from %u
+	  to %Lu (= lowercase usernames). This doesn't break any existing
+	  installations, but might fix some of them.
+
+	+ doveadm: Added "auth cache flush [<username>]" command.
+	+ Implemented dict passdb/userdb
+	+ Implemented Redis and memcached dict backends, which can be used as
+	  auth backends. Redis can also be used as dict-quota backend.
+	+ Added plugin { quota_ignore_save_errors=yes } setting to allow saving
+	  a mail when quota lookup fails with temporary failure.
+	- Full text search indexing might have failed for some messages,
+	  always causing indexer-worker process to run out of memory.
+	- fts-lucene: Fixed handling SEARCH HEADER FROM/TO/SUBJECT/CC/BCC when
+	  the header wasn't lowercased.
+	- fts-squat: Fixed crash when searching a virtual mailbox.
+	- pop3: Fixed assert crash when doing UIDL on empty mailbox on some
+	  setups. 
+	- auth: GSSAPI RFC compliancy and error handling fixes.
+	- Various fixes related to handling shared namespaces
+
+v2.1.8 2012-07-03  Timo Sirainen <tss at iki.fi>
+
+	+ pop3c: Added pop3c_master_user setting.
+	- imap: Mailbox names were accidentally sent as UTF-8 instead of mUTF-7
+	  in previous v2.1.x releases for STATUS, MYRIGHTS and GETQUOTAROOT
+	  commands.
+	- lmtp proxy: Don't timeout connections too early when mail has a lot
+	  of RCPT TOs.
+	- director: Don't crash if the director is working alone.
+	- shared mailboxes: Avoid doing "@domain" userdb lookups.
+	- doveadm: Fixed crash with proxying some commands.
+	- fts-squat: Fixed handling multiple SEARCH parameters.
+	- imapc: Fixed a crash when message had more than 8 keywords.
+	- imapc: Don't crash on APPEND/COPY if server doesn't support UIDPLUS.
+
 v2.1.7 2012-05-29  Timo Sirainen <tss at iki.fi>
 
 	* LDAP: Compatibility fix for v2.0: ldap: If attributes contain
diff -r 53139f2f2284 -r 6a0954d0ce09 configure.in
--- a/configure.in	Fri Aug 10 04:56:56 2012 +0300
+++ b/configure.in	Fri Aug 10 05:24:07 2012 +0300
@@ -2675,6 +2675,11 @@
       AC_CHECK_LIB(textcat, special_textcat_Init, [
 	have_lucene_textcat=yes
 	AC_DEFINE(HAVE_LUCENE_TEXTCAT,, Define if you want textcat support for CLucene)
+      ], [
+        AC_CHECK_LIB(exttextcat, special_textcat_Init, [
+          have_lucene_exttextcat=yes
+          AC_DEFINE(HAVE_LUCENE_EXTTEXTCAT,, Define if you want textcat (Debian version) support for CLucene)
+        ])
       ])
     ], [
       if test $want_stemmer = yes; then
@@ -2687,6 +2692,7 @@
 fi
 AM_CONDITIONAL(BUILD_LUCENE_STEMMER, test "$have_lucene_stemmer" = "yes")
 AM_CONDITIONAL(BUILD_LUCENE_TEXTCAT, test "$have_lucene_textcat" = "yes")
+AM_CONDITIONAL(BUILD_LUCENE_EXTTEXTCAT, test "$have_lucene_exttextcat" = "yes")
 
 if test $have_lucene = no; then
   not_fts="$not_fts lucene"
diff -r 53139f2f2284 -r 6a0954d0ce09 doc/Makefile.am
--- a/doc/Makefile.am	Fri Aug 10 04:56:56 2012 +0300
+++ b/doc/Makefile.am	Fri Aug 10 05:24:07 2012 +0300
@@ -7,7 +7,10 @@
 docfiles = \
 	documentation.txt \
 	securecoding.txt \
-	thread-refs.txt
+	thread-refs.txt \
+	mkcert.sh \
+	dovecot-openssl.cnf \
+	solr-schema.xml
 
 if BUILD_DOCS
 doc_DATA = $(docfiles)
@@ -15,7 +18,4 @@
 
 EXTRA_DIST = \
 	dovecot-initd.sh \
-	mkcert.sh \
-	dovecot-openssl.cnf \
-	solr-schema.xml \
 	$(docfiles)
diff -r 53139f2f2284 -r 6a0954d0ce09 doc/example-config/conf.d/10-director.conf
--- a/doc/example-config/conf.d/10-director.conf	Fri Aug 10 04:56:56 2012 +0300
+++ b/doc/example-config/conf.d/10-director.conf	Fri Aug 10 05:24:07 2012 +0300
@@ -25,6 +25,11 @@
 # If you enable this, you'll also need to add inet_listener for the port.
 #director_doveadm_port = 0
 
+# How the username is translated before being hashed. Useful values include
+# %Ln if user can log in with or without @domain, %Ld if mailboxes are shared
+# within domain.
+#director_username_hash = %Lu
+
 # To enable director service, uncomment the modes and assign a port.
 service director {
   unix_listener login/director {
diff -r 53139f2f2284 -r 6a0954d0ce09 doc/example-config/conf.d/auth-dict.conf.ext
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/example-config/conf.d/auth-dict.conf.ext	Fri Aug 10 05:24:07 2012 +0300
@@ -0,0 +1,16 @@
+# Authentication via dict backend. Included from auth.conf.
+#
+# <doc/wiki/AuthDatabase.Dict.txt>
+
+passdb {
+  driver = dict
+
+  # Path for dict configuration file, see
+  # example-config/dovecot-dict-auth.conf.ext
+  args = /etc/dovecot/dovecot-dict-auth.conf.ext
+}
+
+userdb {
+  driver = dict
+  args = /etc/dovecot/dovecot-dict-auth.conf.ext
+}
diff -r 53139f2f2284 -r 6a0954d0ce09 doc/example-config/dovecot-dict-auth.conf.ext
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/example-config/dovecot-dict-auth.conf.ext	Fri Aug 10 05:24:07 2012 +0300
@@ -0,0 +1,22 @@
+# Dictionary URI
+#uri = 
+
+# Key for passdb lookups
+password_key = dovecot/passdb/%u
+
+# Key for userdb lookups
+user_key = dovecot/userdb/%u
+
+# How to parse the value for key=value pairs. Currently we support only JSON
+# format with { "key": "value", ... } object.
+#value_format = json
+
+# Username iteration prefix. Keys under this are assumed to contain usernames.
+iterate_prefix = dovecot/userdb/
+
+# Should iteration be disabled for this userdb? If this userdb acts only as a
+# cache there's no reason to try to iterate the (partial & duplicate) users.
+#iterate_disable = no
+
+# Default password scheme
+default_pass_scheme = MD5
diff -r 53139f2f2284 -r 6a0954d0ce09 src/auth/Makefile.am
--- a/src/auth/Makefile.am	Fri Aug 10 04:56:56 2012 +0300
+++ b/src/auth/Makefile.am	Fri Aug 10 05:24:07 2012 +0300
@@ -25,6 +25,7 @@
 	-I$(top_srcdir)/src/lib \
 	-I$(top_srcdir)/src/lib-auth \
 	-I$(top_srcdir)/src/lib-test \
+	-I$(top_srcdir)/src/lib-dict \
 	-I$(top_srcdir)/src/lib-dns \
 	-I$(top_srcdir)/src/lib-sql \
 	-I$(top_srcdir)/src/lib-settings \
@@ -73,6 +74,7 @@
 	auth-worker-client.c \
 	auth-worker-server.c \
 	db-checkpassword.c \
+	db-dict.c \
 	db-sql.c \
 	db-passwd-file.c \
 	main.c \
@@ -96,6 +98,7 @@
 	passdb-bsdauth.c \
 	passdb-cache.c \
 	passdb-checkpassword.c \
+	passdb-dict.c \
 	passdb-passwd.c \
 	passdb-passwd-file.c \
 	passdb-pam.c \
@@ -108,6 +111,7 @@
 	userdb.c \
 	userdb-blocking.c \
 	userdb-checkpassword.c \
+	userdb-dict.c \
 	userdb-nss.c \
 	userdb-passwd.c \
 	userdb-passwd-file.c \
@@ -134,6 +138,7 @@
 	auth-stream.h \
 	auth-worker-client.h \
 	auth-worker-server.h \
+	db-dict.h \
 	db-ldap.h \
 	db-sql.h \
 	db-passwd-file.h \
diff -r 53139f2f2284 -r 6a0954d0ce09 src/auth/auth-cache.c
--- a/src/auth/auth-cache.c	Fri Aug 10 04:56:56 2012 +0300
+++ b/src/auth/auth-cache.c	Fri Aug 10 05:24:07 2012 +0300
@@ -23,36 +23,72 @@
 	unsigned long long pos_size, neg_size;
 };
 
-static const struct var_expand_table *
-auth_request_var_expand_tab_find(const char *key, unsigned int size)
+static bool
+auth_request_var_expand_tab_find(const char *key, unsigned int size,
+				 unsigned int *idx_r)
 {
 	const struct var_expand_table *tab = auth_request_var_expand_static_tab;
 	unsigned int i;
 
 	for (i = 0; tab[i].key != '\0' || tab[i].long_key != NULL; i++) {
 		if (size == 1) {
-			if (key[0] == tab[i].key)
-				return &tab[i];
+			if (key[0] == tab[i].key) {
+				*idx_r = i;
+				return TRUE;
+			}
 		} else if (tab[i].long_key != NULL) {
 			if (strncmp(key, tab[i].long_key, size) == 0 &&
-			    tab[i].long_key[size] == '\0')
-				return &tab[i];
+			    tab[i].long_key[size] == '\0') {
+				*idx_r = i;
+				return TRUE;
+			}
 		}
 	}
-	return NULL;
+	return FALSE;
+}
+
+static void
+auth_cache_key_add_var(string_t *str, const char *data, unsigned int len)
+{
+	if (str_len(str) > 0)
+		str_append_c(str, '\t');
+	str_append_c(str, '%');
+	if (len == 1)
+		str_append_c(str, data[0]);
+	else {
+		str_append_c(str, '{');
+		str_append_n(str, data, len);
+		str_append_c(str, '}');
+	}
+}
+
+static void auth_cache_key_add_tab_idx(string_t *str, unsigned int i)
+{
+	const struct var_expand_table *tab =
+		&auth_request_var_expand_static_tab[i];
+
+	if (str_len(str) > 0)
+		str_append_c(str, '\t');
+	str_append_c(str, '%');
+	if (tab->key != '\0')
+		str_append_c(str, tab->key);
+	else {
+		str_append_c(str, '{');
+		str_append(str, tab->long_key);
+		str_append_c(str, '}');
+	}
 }
 
 char *auth_cache_parse_key(pool_t pool, const char *query)
 {
-	const struct var_expand_table *tab;
 	string_t *str;
-	bool key_seen[100];
-	unsigned int idx, size, tab_idx;
-	bool add_key;
+	bool key_seen[AUTH_REQUEST_VAR_TAB_COUNT];
+	const char *extra_vars;
+	unsigned int i, idx, size, tab_idx;
 
 	memset(key_seen, 0, sizeof(key_seen));
 
-	str = str_new(pool, 32);
+	str = t_str_new(32);
 	for (; *query != '\0'; ) {


More information about the dovecot-cvs mailing list