Hello community, here is the log from the commit of package dovecot21 for openSUSE:Factory checked in at 2013-01-14 12:01:33 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/dovecot21 (Old) and /work/SRC/openSUSE:Factory/.dovecot21.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "dovecot21", Maintainer is "" Changes: -------- --- /work/SRC/openSUSE:Factory/dovecot21/dovecot21.changes 2012-12-10 10:07:25.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.dovecot21.new/dovecot21.changes 2013-01-14 12:01:35.000000000 +0100 @@ -1,0 +2,9 @@ +Mon Jan 7 11:29:39 UTC 2013 - [email protected] + +- Update to 2.1.13: + - Some fixes to cache file changes in v2.1.11. + - fts-solr: Overlong UTF8 sequences in mails were rejected by Solr and + caused the mails to not be indexed. + - virtual storage: Sorting mailbox by from/to/cc/bcc didn't work. + +------------------------------------------------------------------- Old: ---- dovecot-2.1.12.tar.bz2 New: ---- dovecot-2.1.13.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ dovecot21.spec ++++++ --- /var/tmp/diff_new_pack.Tnv8Rq/_old 2013-01-14 12:01:37.000000000 +0100 +++ /var/tmp/diff_new_pack.Tnv8Rq/_new 2013-01-14 12:01:37.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package dovecot21 # -# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,11 +17,11 @@ Name: dovecot21 -Version: 2.1.12 +Version: 2.1.13 Release: 0 %define pkg_name dovecot %define sieve_version 2.1 -%define dovecot_version 2.1.12 +%define dovecot_version 2.1.13 %define dovecot_pigeonhole_docdir %{_docdir}/%{pkg_name}/dovecot-pigeonhole %define with_solr 1 %define with_clucene 1 ++++++ dovecot-2.1.12.tar.bz2 -> dovecot-2.1.13.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/ChangeLog new/dovecot-2.1.13/ChangeLog --- old/dovecot-2.1.12/ChangeLog 2012-11-30 07:57:01.000000000 +0100 +++ new/dovecot-2.1.13/ChangeLog 2013-01-07 09:55:41.000000000 +0100 @@ -1,8 +1,187 @@ +2013-01-07 Timo Sirainen <[email protected]> + + * .hgsigs: + Added signature for changeset cf9d62fd0b14 + [36eb80cd02ea] [tip] + + * .hgtags: + Added tag 2.1.13 for changeset cf9d62fd0b14 + [a6ce877f1cd7] + + * NEWS, configure.in: + Released v2.1.13. + [cf9d62fd0b14] [2.1.13] + +2013-01-05 Timo Sirainen <[email protected]> + + * src/auth/auth-request.c, src/auth/auth-stream.c, src/auth/auth- + stream.h: + auth: Fixed handling usernames with the same name as userdb extra + fields. This is a bit kludgy fix, but pretty much guaranteed not to + break anything. v2.2 has a cleaner fix, but it's a bit more + invasive. + [3eeb5270963b] + + * src/plugins/lazy-expunge/lazy-expunge-plugin.c: + lazy_expunge: Allow expunging from lazy_expunge namespace via + virtual mailbox. (Instead of copying the message all over again to + the lazy_expunge namespace.) + [fc521e6378d5] + +2013-01-04 Timo Sirainen <[email protected]> + + * src/plugins/quota/quota-storage.c: + quota: Don't crash if shared namespace's owner doesn't have quota + enabled (but you have). + [c91d142130be] + + * src/lib/Makefile.am, src/lib/test-lib.c, src/lib/test-lib.h, src/lib + /test-unichar.c, src/lib/unichar.c: + uni_utf8_*(): Treat overlong UTF8 sequences as invalid. + [7be4709aab5e] + + * src/plugins/acl/acl-storage.c: + acl: Treat empty plugin { acl } setting the same as if it didn't + exist. This allows using -o plugin/acl= to disable ACLs. + [721aba9128b9] + + * src/lib/str.c: + DEBUG: Call buffer_verify_pool() on str_c*() + [a7a45a56211c] + + * src/lib/buffer.c, src/lib/buffer.h: + Added buffer_verify_pool() + [9fda4feb6e2d] + +2013-01-03 Timo Sirainen <[email protected]> + + * src/plugins/virtual/virtual-mail.c: + virtual storage: get_first_header() always returned "doesn't exist", + breaking SORT/THREAD. + [abcc9959b757] + +2012-12-07 lion <[email protected]> + + * src/lib-index/mail-index-transaction-view.c: + lib-index: Optimized single sequence lookup of newly created mails + in transaction view. + [c9e6ad8a42db] + + * src/lib-index/mail-index-transaction-view.c: + lib-index: Fixed sequence lookup of newly created mails in + transaction view. + [7f4835cff04a] + +2012-12-19 Timo Sirainen <[email protected]> + + * src/lib-index/mail-cache-compress.c, src/lib-index/mail-cache.c: + lib-index: If map_with_read gets disabled, reset the cache buffers + properly. + [32ce915e046a] + +2012-12-18 Timo Sirainen <[email protected]> + + * src/auth/password-scheme.c: + auth: Added CLEAR as yet another alias to PLAIN/CLEARTEXT password + scheme. This apparently is used by Sun LDAP server. + [bde8963a3774] + + * src/lib-index/mail-cache.c: + lib-index: MAIL_INDEX_OPEN_FLAG_SAVEONLY was buggy when reading data + near end of dovecot.index.cache. We assumed that we read as much as + we requested, even if the file was smaller. + [bded819417d9] + + * src/lib-index/mail-cache-fields.c: + lib-index: Make sure a corrupted mail_cache_header_fields.size + doesn't cause crashes. + [2f848393f78e] + + * src/lib-storage/index/raw/raw-mail.c: + raw storage: Make sure "from envelope" isn't returned as NULL. + [579984fdb6e5] + + * src/config/main.c: + config: Notify process creation success to master only after parsing + config file + [bc11033ef035] + + * doc/example-config/Makefile.am: + example-config: Added missing dovecot-dict-auth.conf.ext + [310b3a77a9d1] + + * src/lib-index/mail-index-alloc-cache.c: + lib-index: If sure mail_index_alloc_cache_destroy_unrefed() closes + indexes it alone keeps open. This makes sure that all index files + are closed within process when mailbox is deleted. + [b53ab1c11843] + + * src/indexer/master-connection.c: + indexer-worker: Don't assert-crash with some mailbox names in some + configurations. Virtual mailbox name shouldn't be accessed directly + using mailbox_list_*() functions, since they expect a storage name. + In some configurations this could have caused assert-crashes with + mailbox names that contained invalid characters. + [04704d1eb6c3] + + * src/auth/mech.c: + auth: When auto-loading auth mechanisms from plugins, generate the + name better. + [4ec13ce76f6e] + +2012-12-13 Timo Sirainen <[email protected]> + + * src/lib-dict/dict-file.c: + dict-file: Automatically mkdir missing parent directories if they + don't exist. + [3c6a13c0d525] + + * src/lib-storage/mailbox-list.c: + lib-storage: Use stat_first_parent() instead of doing it ourself. + [c0ad6afa4128] + + * src/lib/mkdir-parents.c, src/lib/mkdir-parents.h: + Added stat_first_parent() helper function. + [40f9e2e339a6] + +2012-12-11 Timo Sirainen <[email protected]> + + * src/plugins/virtual/virtual-config.c: + virtual plugin: Don't fail if mailbox patterns don't match anything. + [f13f2725882e] + +2012-12-08 Timo Sirainen <[email protected]> + + * src/lib-master/mountpoint-list.c: + lib-master: Ignore /Volumes and /private/tmp mountpoints with OSX + (only). + [265adb00eacd] + + * src/lib-master/mountpoint-list.c: + lib-master: Ignore mountpoints under /Volumes by default. + [657cb4c35a0e] + + * src/doveadm/doveadm-print-table.c: + doveadm: table formatter supports now writing by streaming. This + fixes it to work with doveadm server, which sometimes may use + streaming. + [c1e47738e7c3] + + * src/imap/cmd-append.c, src/imap/cmd-copy.c, src/lib-storage/mail- + storage.h, src/plugins/acl/acl-mailbox.c: + imap: If mailbox doesn't have read ACL, hide APPENDUID/COPYUID resp- + codes. + [f74f1b14975d] + + * src/plugins/fts-solr/solr-connection.c: + fts-solr: Fixed memory leak + [cfa6fc9d2856] + 2012-11-30 Timo Sirainen <[email protected]> * .hgsigs: Added signature for changeset 75bfda4a7c6c - [b60872b87d26] [tip] + [b60872b87d26] * .hgtags: Added tag 2.1.12 for changeset 75bfda4a7c6c diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/NEWS new/dovecot-2.1.13/NEWS --- old/dovecot-2.1.12/NEWS 2012-11-30 02:33:18.000000000 +0100 +++ new/dovecot-2.1.13/NEWS 2013-01-07 09:54:12.000000000 +0100 @@ -1,3 +1,10 @@ +v2.1.13 2013-01-06 Timo Sirainen <[email protected]> + + - Some fixes to cache file changes in v2.1.11. + - fts-solr: Overlong UTF8 sequences in mails were rejected by Solr and + caused the mails to not be indexed. + - virtual storage: Sorting mailbox by from/to/cc/bcc didn't work. + v2.1.12 2012-11-30 Timo Sirainen <[email protected]> - dovecot-config in v2.1.11 caused build problems with Pigeonhole diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/configure new/dovecot-2.1.13/configure --- old/dovecot-2.1.12/configure 2012-11-30 02:33:27.000000000 +0100 +++ new/dovecot-2.1.13/configure 2013-01-07 08:52:01.000000000 +0100 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for Dovecot 2.1.12. +# Generated by GNU Autoconf 2.68 for Dovecot 2.1.13. # # Report bugs to <[email protected]>. # @@ -570,8 +570,8 @@ # Identity of this package. PACKAGE_NAME='Dovecot' PACKAGE_TARNAME='dovecot' -PACKAGE_VERSION='2.1.12' -PACKAGE_STRING='Dovecot 2.1.12' +PACKAGE_VERSION='2.1.13' +PACKAGE_STRING='Dovecot 2.1.13' PACKAGE_BUGREPORT='[email protected]' PACKAGE_URL='' @@ -1443,7 +1443,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures Dovecot 2.1.12 to adapt to many kinds of systems. +\`configure' configures Dovecot 2.1.13 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1513,7 +1513,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of Dovecot 2.1.12:";; + short | recursive ) echo "Configuration of Dovecot 2.1.13:";; esac cat <<\_ACEOF @@ -1674,7 +1674,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -Dovecot configure 2.1.12 +Dovecot configure 2.1.13 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -2396,7 +2396,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by Dovecot $as_me 2.1.12, which was +It was created by Dovecot $as_me 2.1.13, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -3213,7 +3213,7 @@ # Define the identity of the package. PACKAGE='dovecot' - VERSION='2.1.12' + VERSION='2.1.13' cat >>confdefs.h <<_ACEOF @@ -25240,7 +25240,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by Dovecot $as_me 2.1.12, which was +This file was extended by Dovecot $as_me 2.1.13, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -25306,7 +25306,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -Dovecot config.status 2.1.12 +Dovecot config.status 2.1.13 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/configure.in new/dovecot-2.1.13/configure.in --- old/dovecot-2.1.12/configure.in 2012-11-30 02:32:42.000000000 +0100 +++ new/dovecot-2.1.13/configure.in 2013-01-07 08:51:52.000000000 +0100 @@ -1,5 +1,5 @@ AC_PREREQ([2.59]) -AC_INIT([Dovecot],[2.1.12],[[email protected]]) +AC_INIT([Dovecot],[2.1.13],[[email protected]]) AC_CONFIG_SRCDIR([src]) AM_INIT_AUTOMAKE([foreign]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/doc/example-config/Makefile.am new/dovecot-2.1.13/doc/example-config/Makefile.am --- old/dovecot-2.1.12/doc/example-config/Makefile.am 2011-12-13 12:35:28.000000000 +0100 +++ new/dovecot-2.1.13/doc/example-config/Makefile.am 2012-12-20 16:31:13.000000000 +0100 @@ -13,6 +13,7 @@ example_DATA = \ dovecot.conf \ dovecot-db.conf.ext \ + dovecot-dict-auth.conf.ext \ dovecot-dict-sql.conf.ext \ dovecot-ldap.conf.ext \ dovecot-sql.conf.ext diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/doc/example-config/Makefile.in new/dovecot-2.1.13/doc/example-config/Makefile.in --- old/dovecot-2.1.12/doc/example-config/Makefile.in 2012-11-30 02:33:28.000000000 +0100 +++ new/dovecot-2.1.13/doc/example-config/Makefile.in 2013-01-07 08:52:02.000000000 +0100 @@ -300,6 +300,7 @@ example_DATA = \ dovecot.conf \ dovecot-db.conf.ext \ + dovecot-dict-auth.conf.ext \ dovecot-dict-sql.conf.ext \ dovecot-ldap.conf.ext \ dovecot-sql.conf.ext diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/doc/example-config/dovecot-dict-auth.conf.ext new/dovecot-2.1.13/doc/example-config/dovecot-dict-auth.conf.ext --- old/dovecot-2.1.12/doc/example-config/dovecot-dict-auth.conf.ext 1970-01-01 01:00:00.000000000 +0100 +++ new/dovecot-2.1.13/doc/example-config/dovecot-dict-auth.conf.ext 2012-07-28 18:14:39.000000000 +0200 @@ -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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/auth/auth-request.c new/dovecot-2.1.13/src/auth/auth-request.c --- old/dovecot-2.1.12/src/auth/auth-request.c 2012-10-02 23:40:21.000000000 +0200 +++ new/dovecot-2.1.13/src/auth/auth-request.c 2013-01-07 08:49:48.000000000 +0100 @@ -863,7 +863,7 @@ } *result_r = USERDB_RESULT_OK; - *reply_r = auth_stream_reply_init(request->pool); + *reply_r = auth_stream_reply_init_userdb(request->pool); auth_stream_reply_import(*reply_r, value); return TRUE; } @@ -1342,7 +1342,7 @@ { struct userdb_module *module = request->userdb->userdb; - request->userdb_reply = auth_stream_reply_init(request->pool); + request->userdb_reply = auth_stream_reply_init_userdb(request->pool); auth_stream_reply_add(request->userdb_reply, NULL, request->user); userdb_template_export(module->default_fields_tmpl, request); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/auth/auth-stream.c new/dovecot-2.1.13/src/auth/auth-stream.c --- old/dovecot-2.1.12/src/auth/auth-stream.c 2012-04-23 14:35:06.000000000 +0200 +++ new/dovecot-2.1.13/src/auth/auth-stream.c 2013-01-07 08:49:48.000000000 +0100 @@ -9,6 +9,7 @@ struct auth_stream_reply { string_t *str; + bool userdb; }; struct auth_stream_reply *auth_stream_reply_init(pool_t pool) @@ -20,6 +21,15 @@ return reply; } +struct auth_stream_reply *auth_stream_reply_init_userdb(pool_t pool) +{ + struct auth_stream_reply *reply; + + reply = auth_stream_reply_init(pool); + reply->userdb = TRUE; + return reply; +} + void auth_stream_reply_add(struct auth_stream_reply *reply, const char *key, const char *value) { @@ -44,10 +54,16 @@ auth_stream_reply_find_area(struct auth_stream_reply *reply, const char *key, unsigned int *idx_r, unsigned int *len_r) { - const char *str = str_c(reply->str); - unsigned int i, start, key_len = strlen(key); + const char *p, *str = str_c(reply->str); + unsigned int i = 0, start, key_len = strlen(key); + + if (reply->userdb) { + p = strchr(str, '\t'); + if (p == NULL) + return FALSE; + i = p-str+1; + } - i = 0; while (str[i] != '\0') { start = i; for (; str[i] != '\0'; i++) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/auth/auth-stream.h new/dovecot-2.1.13/src/auth/auth-stream.h --- old/dovecot-2.1.12/src/auth/auth-stream.h 2012-01-25 23:40:46.000000000 +0100 +++ new/dovecot-2.1.13/src/auth/auth-stream.h 2013-01-07 08:49:48.000000000 +0100 @@ -4,6 +4,7 @@ struct auth_request; struct auth_stream_reply *auth_stream_reply_init(pool_t pool); +struct auth_stream_reply *auth_stream_reply_init_userdb(pool_t pool); void auth_stream_reply_add(struct auth_stream_reply *reply, const char *key, const char *value); void auth_stream_reply_reset(struct auth_stream_reply *reply); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/auth/mech.c new/dovecot-2.1.13/src/auth/mech.c --- old/dovecot-2.1.12/src/auth/mech.c 2012-08-28 12:23:34.000000000 +0200 +++ new/dovecot-2.1.13/src/auth/mech.c 2012-12-20 16:31:13.000000000 +0100 @@ -7,6 +7,7 @@ #include "passdb.h" #include <stdlib.h> +#include <ctype.h> static struct mech_module_list *mech_modules; @@ -112,6 +113,20 @@ reg->modules = list; } +static const char *mech_get_plugin_name(const char *name) +{ + string_t *str = t_str_new(32); + + str_append(str, "mech_"); + for (; *name != '\0'; name++) { + if (*name == '-') + str_append_c(str, '_'); + else + str_append_c(str, i_tolower(*name)); + } + return str_c(str); +} + struct mechanisms_register * mech_register_init(const struct auth_settings *set) { @@ -139,7 +154,7 @@ mech = mech_module_find(name); if (mech == NULL) { /* maybe it's a plugin. try to load it. */ - auth_module_load(t_strconcat("mech_", name, NULL)); + auth_module_load(mech_get_plugin_name(name)); mech = mech_module_find(name); } if (mech == NULL) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/auth/password-scheme.c new/dovecot-2.1.13/src/auth/password-scheme.c --- old/dovecot-2.1.12/src/auth/password-scheme.c 2012-06-27 11:06:05.000000000 +0200 +++ new/dovecot-2.1.13/src/auth/password-scheme.c 2012-12-20 16:31:13.000000000 +0100 @@ -817,6 +817,7 @@ { "SSHA256", PW_ENCODING_BASE64, 0, ssha256_verify, ssha256_generate }, { "SSHA512", PW_ENCODING_BASE64, 0, ssha512_verify, ssha512_generate }, { "PLAIN", PW_ENCODING_NONE, 0, NULL, plain_generate }, + { "CLEAR", PW_ENCODING_NONE, 0, NULL, plain_generate }, { "CLEARTEXT", PW_ENCODING_NONE, 0, NULL, plain_generate }, { "PLAIN-TRUNC", PW_ENCODING_NONE, 0, plain_trunc_verify, plain_generate }, { "CRAM-MD5", PW_ENCODING_HEX, CRAM_MD5_CONTEXTLEN, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/config/main.c new/dovecot-2.1.13/src/config/main.c --- old/dovecot-2.1.12/src/config/main.c 2012-02-12 20:58:17.000000000 +0100 +++ new/dovecot-2.1.13/src/config/main.c 2012-12-20 16:31:13.000000000 +0100 @@ -26,13 +26,17 @@ restrict_access_by_env(NULL, FALSE); restrict_access_allow_coredumps(TRUE); - master_service_init_finish(master_service); config_parse_load_modules(); path = master_service_get_config_path(master_service); if (config_parse_file(path, TRUE, "", &error) <= 0) i_fatal("%s", error); + /* notify about our success only after successfully parsing the + config file, so if the parsing fails, master won't immediately + just recreate this process (and fail again and so on). */ + master_service_init_finish(master_service); + master_service_run(master_service, client_connected); config_connections_destroy_all(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/doveadm/doveadm-print-table.c new/dovecot-2.1.13/src/doveadm/doveadm-print-table.c --- old/dovecot-2.1.12/src/doveadm/doveadm-print-table.c 2012-02-12 20:58:17.000000000 +0100 +++ new/dovecot-2.1.13/src/doveadm/doveadm-print-table.c 2012-12-14 19:13:36.000000000 +0100 @@ -2,6 +2,7 @@ #include "lib.h" #include "array.h" +#include "str.h" #include "doveadm-print-private.h" #include <stdio.h> @@ -24,6 +25,7 @@ pool_t pool; ARRAY_DEFINE(headers, struct doveadm_print_table_header); ARRAY_TYPE(const_string) buffered_values; + string_t *stream; unsigned int hdr_idx; unsigned int columns; @@ -179,10 +181,17 @@ } static void -doveadm_print_table_print_stream(const unsigned char *value ATTR_UNUSED, - size_t size ATTR_UNUSED) +doveadm_print_table_print_stream(const unsigned char *value, size_t size) { - i_fatal("table formatter doesn't support multi-line values"); + if (memchr(value, '\n', size) != NULL) + i_fatal("table formatter doesn't support multi-line values"); + + if (size != 0) + str_append_n(ctx->stream, value, size); + else { + doveadm_print_table_print(str_c(ctx->stream)); + str_truncate(ctx->stream, 0); + } } static void doveadm_print_table_flush(void) @@ -199,6 +208,7 @@ pool = pool_alloconly_create("doveadm print table", 2048); ctx = p_new(pool, struct doveadm_print_table_context, 1); ctx->pool = pool; + ctx->stream = str_new(default_pool, 128); p_array_init(&ctx->headers, pool, 16); i_array_init(&ctx->buffered_values, 64); ctx->columns = DEFAULT_COLUMNS; @@ -211,6 +221,7 @@ static void doveadm_print_table_deinit(void) { + str_free(&ctx->stream); array_free(&ctx->buffered_values); pool_unref(&ctx->pool); ctx = NULL; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/imap/cmd-append.c new/dovecot-2.1.13/src/imap/cmd-append.c --- old/dovecot-2.1.12/src/imap/cmd-append.c 2012-03-07 15:22:49.000000000 +0100 +++ new/dovecot-2.1.13/src/imap/cmd-append.c 2012-12-14 19:13:36.000000000 +0100 @@ -290,7 +290,7 @@ msg = t_str_new(256); save_count = seq_range_count(&changes.saved_uids); - if (save_count == 0) { + if (save_count == 0 || changes.no_read_perm) { /* not supported by backend (virtual) */ str_append(msg, "OK Append completed."); } else { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/imap/cmd-copy.c new/dovecot-2.1.13/src/imap/cmd-copy.c --- old/dovecot-2.1.12/src/imap/cmd-copy.c 2012-02-12 20:58:17.000000000 +0100 +++ new/dovecot-2.1.13/src/imap/cmd-copy.c 2012-12-14 19:13:36.000000000 +0100 @@ -125,8 +125,10 @@ else if (copy_count == 0) { str_append(msg, "OK No messages copied."); pool_unref(&changes.pool); - } else if (seq_range_count(&changes.saved_uids) == 0) { - /* not supported by backend (virtual) */ + } else if (seq_range_count(&changes.saved_uids) == 0 || + changes.no_read_perm) { + /* not supported by backend (virtual) or no read permissions + for mailbox */ str_append(msg, "OK Copy completed."); pool_unref(&changes.pool); } else { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/indexer/master-connection.c new/dovecot-2.1.13/src/indexer/master-connection.c --- old/dovecot-2.1.12/src/indexer/master-connection.c 2012-03-13 15:33:08.000000000 +0100 +++ new/dovecot-2.1.13/src/indexer/master-connection.c 2012-12-20 16:31:13.000000000 +0100 @@ -129,10 +129,10 @@ return -1; } - path = mailbox_list_get_path(ns->list, mailbox, + path = mailbox_list_get_path(ns->list, NULL, MAILBOX_LIST_PATH_TYPE_INDEX); if (*path == '\0') { - i_info("Indexes disabled for Mailbox %s, skipping", mailbox); + i_info("Indexes disabled for mailbox %s, skipping", mailbox); return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/lib/Makefile.am new/dovecot-2.1.13/src/lib/Makefile.am --- old/dovecot-2.1.12/src/lib/Makefile.am 2012-07-28 18:14:39.000000000 +0200 +++ new/dovecot-2.1.13/src/lib/Makefile.am 2013-01-04 23:05:30.000000000 +0100 @@ -273,6 +273,7 @@ test-str-find.c \ test-str-sanitize.c \ test-time-util.c \ + test-unichar.c \ test-utc-mktime.c \ test-var-expand.c diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/lib/Makefile.in new/dovecot-2.1.13/src/lib/Makefile.in --- old/dovecot-2.1.12/src/lib/Makefile.in 2012-11-30 02:33:30.000000000 +0100 +++ new/dovecot-2.1.13/src/lib/Makefile.in 2013-01-07 08:52:04.000000000 +0100 @@ -110,6 +110,7 @@ test_lib-test-str-find.$(OBJEXT) \ test_lib-test-str-sanitize.$(OBJEXT) \ test_lib-test-time-util.$(OBJEXT) \ + test_lib-test-unichar.$(OBJEXT) \ test_lib-test-utc-mktime.$(OBJEXT) \ test_lib-test-var-expand.$(OBJEXT) test_lib_OBJECTS = $(am_test_lib_OBJECTS) @@ -599,6 +600,7 @@ test-str-find.c \ test-str-sanitize.c \ test-time-util.c \ + test-unichar.c \ test-utc-mktime.c \ test-var-expand.c @@ -807,6 +809,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_lib-test-strescape.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_lib-test-strfuncs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_lib-test-time-util.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_lib-test-unichar.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_lib-test-utc-mktime.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_lib-test-var-expand.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/time-util.Plo@am__quote@ @@ -1205,6 +1208,20 @@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_lib_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_lib-test-time-util.obj `if test -f 'test-time-util.c'; then $(CYGPATH_W) 'test-time-util.c'; else $(CYGPATH_W) '$(srcdir)/test-time-util.c'; fi` +test_lib-test-unichar.o: test-unichar.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_lib_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_lib-test-unichar.o -MD -MP -MF $(DEPDIR)/test_lib-test-unichar.Tpo -c -o test_lib-test-unichar.o `test -f 'test-unichar.c' || echo '$(srcdir)/'`test-unichar.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/test_lib-test-unichar.Tpo $(DEPDIR)/test_lib-test-unichar.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test-unichar.c' object='test_lib-test-unichar.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_lib_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_lib-test-unichar.o `test -f 'test-unichar.c' || echo '$(srcdir)/'`test-unichar.c + +test_lib-test-unichar.obj: test-unichar.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_lib_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_lib-test-unichar.obj -MD -MP -MF $(DEPDIR)/test_lib-test-unichar.Tpo -c -o test_lib-test-unichar.obj `if test -f 'test-unichar.c'; then $(CYGPATH_W) 'test-unichar.c'; else $(CYGPATH_W) '$(srcdir)/test-unichar.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/test_lib-test-unichar.Tpo $(DEPDIR)/test_lib-test-unichar.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test-unichar.c' object='test_lib-test-unichar.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_lib_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o test_lib-test-unichar.obj `if test -f 'test-unichar.c'; then $(CYGPATH_W) 'test-unichar.c'; else $(CYGPATH_W) '$(srcdir)/test-unichar.c'; fi` + test_lib-test-utc-mktime.o: test-utc-mktime.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(test_lib_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT test_lib-test-utc-mktime.o -MD -MP -MF $(DEPDIR)/test_lib-test-utc-mktime.Tpo -c -o test_lib-test-utc-mktime.o `test -f 'test-utc-mktime.c' || echo '$(srcdir)/'`test-utc-mktime.c @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/test_lib-test-utc-mktime.Tpo $(DEPDIR)/test_lib-test-utc-mktime.Po diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/lib/buffer.c new/dovecot-2.1.13/src/lib/buffer.c --- old/dovecot-2.1.12/src/lib/buffer.c 2012-07-28 18:20:02.000000000 +0200 +++ new/dovecot-2.1.13/src/lib/buffer.c 2013-01-04 02:48:47.000000000 +0100 @@ -314,3 +314,17 @@ return memcmp(buf1->data, buf2->data, buf1->used) == 0; } + +void buffer_verify_pool(buffer_t *_buf) +{ + const struct real_buffer *buf = (const struct real_buffer *)_buf; + void *ret; + + if (buf->pool->datastack_pool) { + /* this doesn't really do anything except verify the + stack frame */ + ret = p_realloc(buf->pool, buf->w_buffer, + buf->alloc, buf->alloc); + i_assert(ret == buf->w_buffer); + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/lib/buffer.h new/dovecot-2.1.13/src/lib/buffer.h --- old/dovecot-2.1.12/src/lib/buffer.h 2012-07-28 19:32:30.000000000 +0200 +++ new/dovecot-2.1.13/src/lib/buffer.h 2013-01-04 02:45:44.000000000 +0100 @@ -102,4 +102,10 @@ return buf->used; } +/* Crash if buffer was allocated from data stack and stack frame has changed. + This can be used as an assert-like check to verify that it's valid to + increase the buffer size here, instead of crashing only randomly when the + buffer needs to be increased. */ +void buffer_verify_pool(buffer_t *buf); + #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/lib/mkdir-parents.c new/dovecot-2.1.13/src/lib/mkdir-parents.c --- old/dovecot-2.1.12/src/lib/mkdir-parents.c 2012-02-12 20:58:18.000000000 +0100 +++ new/dovecot-2.1.13/src/lib/mkdir-parents.c 2012-12-14 19:13:36.000000000 +0100 @@ -125,3 +125,23 @@ { return mkdir_parents_chown(path, mode, (uid_t)-1, (gid_t)-1); } + +int stat_first_parent(const char *path, const char **root_dir_r, + struct stat *st_r) +{ + const char *p; + + while (stat(path, st_r) < 0) { + if (errno != ENOENT || strcmp(path, "/") == 0) { + *root_dir_r = path; + return -1; + } + p = strrchr(path, '/'); + if (p == NULL) + path = "/"; + else + path = t_strdup_until(path, p); + } + *root_dir_r = path; + return 0; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/lib/mkdir-parents.h new/dovecot-2.1.13/src/lib/mkdir-parents.h --- old/dovecot-2.1.12/src/lib/mkdir-parents.h 2011-12-13 12:35:29.000000000 +0100 +++ new/dovecot-2.1.13/src/lib/mkdir-parents.h 2012-12-14 19:13:36.000000000 +0100 @@ -1,6 +1,8 @@ #ifndef MKDIR_PARENTS_H #define MKDIR_PARENTS_H +#include <sys/stat.h> + /* Create path and all the directories under it if needed. Permissions for existing directories isn't changed. Returns 0 if ok. If directory already exists, returns -1 with errno=EEXIST. */ @@ -20,4 +22,10 @@ int mkdir_chgrp(const char *path, mode_t mode, gid_t gid, const char *gid_origin); +/* stat() the path or its first parent that exists. Returns 0 if ok, -1 if + failed. root_dir is set to the last stat()ed directory (on success and + on failure). */ +int stat_first_parent(const char *path, const char **root_dir_r, + struct stat *st_r); + #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/lib/str.c new/dovecot-2.1.13/src/lib/str.c --- old/dovecot-2.1.12/src/lib/str.c 2012-02-12 20:58:18.000000000 +0100 +++ new/dovecot-2.1.13/src/lib/str.c 2013-01-04 02:42:57.000000000 +0100 @@ -45,6 +45,9 @@ size_t len = str_len(str); size_t alloc = buffer_get_size(str); +#ifdef DEBUG + buffer_verify_pool(str); +#endif if (len == alloc || data[len] != '\0') { buffer_write(str, len, "", 1); /* remove the \0 - we don't want to keep it */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/lib/test-lib.c new/dovecot-2.1.13/src/lib/test-lib.c --- old/dovecot-2.1.12/src/lib/test-lib.c 2012-02-12 20:58:18.000000000 +0100 +++ new/dovecot-2.1.13/src/lib/test-lib.c 2013-01-04 23:05:30.000000000 +0100 @@ -30,6 +30,7 @@ test_str_find, test_str_sanitize, test_time_util, + test_unichar, test_utc_mktime, test_var_expand, NULL diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/lib/test-lib.h new/dovecot-2.1.13/src/lib/test-lib.h --- old/dovecot-2.1.12/src/lib/test-lib.h 2011-12-13 12:35:29.000000000 +0100 +++ new/dovecot-2.1.13/src/lib/test-lib.h 2013-01-04 23:05:30.000000000 +0100 @@ -29,6 +29,7 @@ void test_str_find(void); void test_str_sanitize(void); void test_time_util(void); +void test_unichar(void); void test_utc_mktime(void); void test_var_expand(void); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/lib/test-unichar.c new/dovecot-2.1.13/src/lib/test-unichar.c --- old/dovecot-2.1.12/src/lib/test-unichar.c 1970-01-01 01:00:00.000000000 +0100 +++ new/dovecot-2.1.13/src/lib/test-unichar.c 2013-01-04 23:05:30.000000000 +0100 @@ -0,0 +1,24 @@ +/* Copyright (c) 2007-2012 Dovecot authors, see the included COPYING file */ + +#include "test-lib.h" +#include "str.h" +#include "unichar.h" + +void test_unichar(void) +{ + static const char *overlong_utf8 = "\xf8\x80\x95\x81\xa1"; + unichar_t chr, chr2; + string_t *str = t_str_new(16); + + test_begin("unichars"); + for (chr = 0; chr <= 0x10ffff; chr++) { + str_truncate(str, 0); + uni_ucs4_to_utf8_c(chr, str); + test_assert(uni_utf8_str_is_valid(str_c(str))); + test_assert(uni_utf8_get_char(str_c(str), &chr2) > 0); + test_assert(chr2 == chr); + } + test_assert(!uni_utf8_str_is_valid(overlong_utf8)); + test_assert(uni_utf8_get_char(overlong_utf8, &chr2) < 0); + test_end(); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/lib/unichar.c new/dovecot-2.1.13/src/lib/unichar.c --- old/dovecot-2.1.12/src/lib/unichar.c 2012-11-27 06:49:06.000000000 +0100 +++ new/dovecot-2.1.13/src/lib/unichar.c 2013-01-04 23:05:30.000000000 +0100 @@ -37,8 +37,10 @@ int uni_utf8_get_char_n(const void *_input, size_t max_len, unichar_t *chr_r) { + static unichar_t lowest_valid_chr_table[] = + { 0, 0, 0x80, 0x800, 0x10000, 0x20000, 0x40000 }; const unsigned char *input = _input; - unichar_t chr; + unichar_t chr, lowest_valid_chr; unsigned int i, len; int ret; @@ -75,10 +77,12 @@ return -1; } - if (len <= max_len) + if (len <= max_len) { + lowest_valid_chr = lowest_valid_chr_table[len]; ret = 1; - else { + } else { /* check first if the input is invalid before returning 0 */ + lowest_valid_chr = 0; ret = 0; len = max_len; } @@ -91,6 +95,10 @@ chr <<= 6; chr |= input[i] & 0x3f; } + if (chr < lowest_valid_chr) { + /* overlong encoding */ + return -1; + } *chr_r = chr; return ret; @@ -340,19 +348,11 @@ static inline unsigned int is_valid_utf8_seq(const unsigned char *input, unsigned int size) { - unsigned int i, len; + unichar_t chr; - len = uni_utf8_char_bytes(input[0]); - if (unlikely(len > size || len == 1)) + if (uni_utf8_get_char_n(input, size, &chr) <= 0) return 0; - - /* the rest of the chars should be in 0x80..0xbf range. - anything else is start of a sequence or invalid */ - for (i = 1; i < len; i++) { - if (unlikely(input[i] < 0x80 || input[i] > 0xbf)) - return 0; - } - return len; + return uni_utf8_char_bytes(input[0]); } static int uni_utf8_find_invalid_pos(const unsigned char *input, size_t size, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/lib-dict/dict-file.c new/dovecot-2.1.13/src/lib-dict/dict-file.c --- old/dovecot-2.1.12/src/lib-dict/dict-file.c 2012-08-30 13:22:49.000000000 +0200 +++ new/dovecot-2.1.13/src/lib-dict/dict-file.c 2012-12-14 19:13:36.000000000 +0100 @@ -3,6 +3,7 @@ #include "lib.h" #include "array.h" #include "hash.h" +#include "mkdir-parents.h" #include "file-lock.h" #include "file-dotlock.h" #include "nfs-workarounds.h" @@ -424,6 +425,33 @@ return fd_copy_stat_permissions(&src_st, dest_fd, dest_path); } +static int file_dict_mkdir(struct file_dict *dict) +{ + const char *path, *p, *root; + struct stat st; + mode_t mode = 0700; + + p = strrchr(dict->path, '/'); + if (p == NULL) + return 0; + path = t_strdup_until(dict->path, p); + + if (stat_first_parent(path, &root, &st) < 0) { + i_error("stat(%s) failed: %m", root); + return -1; + } + if ((st.st_mode & S_ISGID) != 0) { + /* preserve parent's permissions when it has setgid bit */ + mode = st.st_mode; + } + + if (mkdir_parents(path, mode) < 0) { + i_error("mkdir_parents(%s) failed: %m", path); + return -1; + } + return 0; +} + static int file_dict_lock(struct file_dict *dict, struct file_lock **lock_r) { @@ -435,6 +463,11 @@ if (dict->fd == -1) { /* quota file doesn't exist yet, we need to create it */ dict->fd = open(dict->path, O_CREAT | O_RDWR, 0600); + if (dict->fd == -1 && errno == ENOENT) { + if (file_dict_mkdir(dict) < 0) + return -1; + dict->fd = open(dict->path, O_CREAT | O_RDWR, 0600); + } if (dict->fd == -1) { i_error("creat(%s) failed: %m", dict->path); return -1; @@ -485,6 +518,12 @@ case FILE_LOCK_METHOD_DOTLOCK: fd = file_dotlock_open(&file_dict_dotlock_settings, dict->path, 0, &dotlock); + if (fd == -1 && errno == ENOENT) { + if (file_dict_mkdir(dict) < 0) + return -1; + fd = file_dotlock_open(&file_dict_dotlock_settings, + dict->path, 0, &dotlock); + } if (fd == -1) { i_error("file dict commit: file_dotlock_open(%s) failed: %m", dict->path); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/lib-index/mail-cache-compress.c new/dovecot-2.1.13/src/lib-index/mail-cache-compress.c --- old/dovecot-2.1.12/src/lib-index/mail-cache-compress.c 2012-10-30 18:57:35.000000000 +0100 +++ new/dovecot-2.1.13/src/lib-index/mail-cache-compress.c 2012-12-20 16:31:13.000000000 +0100 @@ -462,7 +462,13 @@ return 0; /* compression isn't very efficient with small read()s */ - cache->map_with_read = FALSE; + if (cache->map_with_read) { + cache->map_with_read = FALSE; + if (cache->read_buf != NULL) + buffer_set_used_size(cache->read_buf, 0); + cache->hdr = NULL; + cache->mmap_length = 0; + } if (cache->index->lock_method == FILE_LOCK_METHOD_DOTLOCK) { /* we're using dotlocking, cache file creation itself creates diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/lib-index/mail-cache-fields.c new/dovecot-2.1.13/src/lib-index/mail-cache-fields.c --- old/dovecot-2.1.12/src/lib-index/mail-cache-fields.c 2012-10-30 18:57:35.000000000 +0100 +++ new/dovecot-2.1.13/src/lib-index/mail-cache-fields.c 2012-12-20 16:31:13.000000000 +0100 @@ -206,7 +206,7 @@ const struct mail_cache_header_fields *field_hdr; struct mail_cache_header_fields tmp_field_hdr; const void *data; - uint32_t offset = 0, next_offset; + uint32_t offset = 0, next_offset, field_hdr_size; unsigned int next_count = 0; bool invalidate = FALSE; int ret; @@ -276,14 +276,16 @@ cache->need_compress_file_seq = cache->hdr->file_seq; if (field_hdr_r != NULL) { + /* detect corrupted size later */ + field_hdr_size = I_MAX(field_hdr->size, sizeof(*field_hdr)); if (cache->file_cache != NULL && invalidate) { /* if this isn't the first header in file and we hadn't read this before, we can't trust that the cached data is valid */ file_cache_invalidate(cache->file_cache, offset, - field_hdr->size); + field_hdr_size); } - ret = mail_cache_map(cache, offset, field_hdr->size, &data); + ret = mail_cache_map(cache, offset, field_hdr_size, &data); if (ret < 0) return -1; if (ret == 0) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/lib-index/mail-cache.c new/dovecot-2.1.13/src/lib-index/mail-cache.c --- old/dovecot-2.1.12/src/lib-index/mail-cache.c 2012-11-28 02:55:29.000000000 +0100 +++ new/dovecot-2.1.13/src/lib-index/mail-cache.c 2012-12-20 16:31:13.000000000 +0100 @@ -346,11 +346,12 @@ buffer_set_used_size(cache->read_buf, ret); cache->read_offset = offset; - cache->mmap_length = offset + size; + cache->mmap_length = offset + cache->read_buf->used; *data_r = data; hdr_data = offset == 0 ? *data_r : NULL; - return mail_cache_map_finish(cache, offset, size, hdr_data, TRUE); + return mail_cache_map_finish(cache, offset, + cache->read_buf->used, hdr_data, TRUE); } int mail_cache_map(struct mail_cache *cache, size_t offset, size_t size, @@ -393,6 +394,7 @@ if (offset < cache->mmap_length && size <= cache->mmap_length - offset) { /* already mapped */ + i_assert(cache->mmap_base != NULL); *data_r = CONST_PTR_OFFSET(cache->mmap_base, offset); return 1; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/lib-index/mail-index-alloc-cache.c new/dovecot-2.1.13/src/lib-index/mail-index-alloc-cache.c --- old/dovecot-2.1.12/src/lib-index/mail-index-alloc-cache.c 2012-02-12 20:58:17.000000000 +0100 +++ new/dovecot-2.1.13/src/lib-index/mail-index-alloc-cache.c 2012-12-20 16:31:13.000000000 +0100 @@ -22,6 +22,7 @@ struct mail_index *index; char *mailbox_path; int refcount; + bool referenced; dev_t index_dir_dev; ino_t index_dir_ino; @@ -58,7 +59,7 @@ static void mail_index_alloc_cache_list_free(struct mail_index_alloc_cache_list *list) { - if (list->index->open_count > 0) + if (list->referenced) mail_index_close(list->index); mail_index_free(&list->index); i_free(list->mailbox_path); @@ -166,6 +167,15 @@ } else { if (rec->refcount == 0) seen_ref0 = TRUE; + if (all && rec->index->open_count == 1 && + rec->referenced) { + /* we're the only one keeping this index open. + we might be here, because the caller is + deleting this mailbox and wants its indexes + to be closed. so close it. */ + rec->referenced = FALSE; + mail_index_close(rec->index); + } list = &(*list)->next; } } @@ -228,8 +238,9 @@ list->index_dir_dev = st.st_dev; } } - if (list != NULL) { + if (list != NULL && !list->referenced) { /* keep it referenced for ourself */ + list->referenced = TRUE; index->open_count++; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/lib-index/mail-index-transaction-view.c new/dovecot-2.1.13/src/lib-index/mail-index-transaction-view.c --- old/dovecot-2.1.12/src/lib-index/mail-index-transaction-view.c 2012-07-07 13:39:16.000000000 +0200 +++ new/dovecot-2.1.13/src/lib-index/mail-index-transaction-view.c 2012-12-20 16:31:13.000000000 +0100 @@ -203,11 +203,17 @@ if (first_uid <= rec->uid) break; } - if (seq > tview->t->last_new_seq) { + if (seq > tview->t->last_new_seq || rec->uid > last_uid) { /* no messages in range */ return; } *first_seq_r = seq; + + if (rec->uid == last_uid) { + /* one seq in range */ + *last_seq_r = seq; + return; + } } seq = tview->t->last_new_seq; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/lib-master/mountpoint-list.c new/dovecot-2.1.13/src/lib-master/mountpoint-list.c --- old/dovecot-2.1.12/src/lib-master/mountpoint-list.c 2012-07-28 18:14:39.000000000 +0200 +++ new/dovecot-2.1.13/src/lib-master/mountpoint-list.c 2012-12-14 19:13:36.000000000 +0100 @@ -57,6 +57,10 @@ "/proc", "/var/run", "/run", +#ifdef __APPLE__ + "/Volumes", + "/private/tmp", +#endif NULL }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/lib-storage/index/raw/raw-mail.c new/dovecot-2.1.13/src/lib-storage/index/raw/raw-mail.c --- old/dovecot-2.1.12/src/lib-storage/index/raw/raw-mail.c 2012-02-12 20:58:18.000000000 +0100 +++ new/dovecot-2.1.13/src/lib-storage/index/raw/raw-mail.c 2012-12-20 16:31:13.000000000 +0100 @@ -101,7 +101,8 @@ switch (field) { case MAIL_FETCH_FROM_ENVELOPE: - *value_r = mbox->envelope_sender; + *value_r = mbox->envelope_sender != NULL ? + mbox->envelope_sender : ""; return 0; case MAIL_FETCH_UIDL_FILE_NAME: *value_r = mbox->have_filename ? diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/lib-storage/mail-storage.h new/dovecot-2.1.13/src/lib-storage/mail-storage.h --- old/dovecot-2.1.12/src/lib-storage/mail-storage.h 2012-09-24 22:21:29.000000000 +0200 +++ new/dovecot-2.1.13/src/lib-storage/mail-storage.h 2012-12-14 19:13:36.000000000 +0100 @@ -268,6 +268,9 @@ /* TRUE if anything actually changed with this commit */ bool changed; + /* User doesn't have read ACL for the mailbox, so don't show the + uid_validity / saved_uids. */ + bool no_read_perm; }; struct mailbox_sync_rec { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/lib-storage/mailbox-list.c new/dovecot-2.1.13/src/lib-storage/mailbox-list.c --- old/dovecot-2.1.12/src/lib-storage/mailbox-list.c 2012-10-02 22:22:49.000000000 +0200 +++ new/dovecot-2.1.13/src/lib-storage/mailbox-list.c 2012-12-14 19:13:36.000000000 +0100 @@ -765,27 +765,6 @@ } } -static int -mailbox_list_stat_parent(const char *path, const char **root_dir_r, - struct stat *st_r, const char **error_r) -{ - const char *p; - - while (stat(path, st_r) < 0) { - if (errno != ENOENT || strcmp(path, "/") == 0) { - *error_r = t_strdup_printf("stat(%s) failed: %m", path); - return -1; - } - p = strrchr(path, '/'); - if (p == NULL) - path = "/"; - else - path = t_strdup_until(path, p); - } - *root_dir_r = path; - return 0; -} - static const char * get_expanded_path(const char *unexpanded_start, const char *unexpanded_stop, const char *expanded_full) @@ -873,9 +852,10 @@ /* up to this directory get the permissions from the first parent directory that exists, if it has setgid bit enabled. */ - if (mailbox_list_stat_parent(expanded, &root_dir, &st, - error_r) < 0) + if (stat_first_parent(expanded, &root_dir, &st) < 0) { + *error_r = t_strdup_printf("stat(%s) failed: %m", root_dir); return -1; + } if ((st.st_mode & S_ISGID) != 0 && root_dir != expanded) { if (mkdir_parents_chgrp(expanded, st.st_mode, (gid_t)-1, root_dir) < 0 && diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/plugins/acl/acl-mailbox.c new/dovecot-2.1.13/src/plugins/acl/acl-mailbox.c --- old/dovecot-2.1.12/src/plugins/acl/acl-mailbox.c 2012-02-12 20:58:18.000000000 +0100 +++ new/dovecot-2.1.13/src/plugins/acl/acl-mailbox.c 2012-12-14 19:13:36.000000000 +0100 @@ -21,6 +21,7 @@ struct acl_object *aclobj; bool skip_acl_checks; bool acl_enabled; + bool no_read_right; }; struct acl_transaction_context { @@ -408,13 +409,19 @@ { struct acl_mailbox *abox = ACL_CONTEXT(ctx->box); void *at = ACL_CONTEXT(ctx); + int ret; if (at != NULL) { abox->module_ctx.super.transaction_rollback(ctx); return -1; } - return abox->module_ctx.super.transaction_commit(ctx, changes_r); + ret = abox->module_ctx.super.transaction_commit(ctx, changes_r); + if (abox->no_read_right) { + /* don't allow IMAP client to see what UIDs the messages got */ + changes_r->no_read_perm = TRUE; + } + return ret; } static int acl_mailbox_exists(struct mailbox *box, bool auto_boxes, @@ -473,6 +480,14 @@ } return -1; } + if (open_right != ACL_STORAGE_RIGHT_READ) { + ret = acl_object_have_right(abox->aclobj, + idx_arr[ACL_STORAGE_RIGHT_READ]); + if (ret < 0) + return -1; + if (ret == 0) + abox->no_read_right = TRUE; + } return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/plugins/acl/acl-storage.c new/dovecot-2.1.13/src/plugins/acl/acl-storage.c --- old/dovecot-2.1.12/src/plugins/acl/acl-storage.c 2012-02-12 20:58:18.000000000 +0100 +++ new/dovecot-2.1.13/src/plugins/acl/acl-storage.c 2013-01-04 04:26:32.000000000 +0100 @@ -52,7 +52,7 @@ const char *env; env = mail_user_plugin_getenv(user, "acl"); - if (env != NULL) + if (env != NULL && *env != '\0') acl_mail_user_create(user, env); else { if (user->mail_debug) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/plugins/fts-solr/solr-connection.c new/dovecot-2.1.13/src/plugins/fts-solr/solr-connection.c --- old/dovecot-2.1.12/src/plugins/fts-solr/solr-connection.c 2012-07-31 22:39:48.000000000 +0200 +++ new/dovecot-2.1.13/src/plugins/fts-solr/solr-connection.c 2012-12-14 19:13:36.000000000 +0100 @@ -192,6 +192,7 @@ curl_slist_free_all(conn->headers_post); curl_multi_cleanup(conn->curlm); curl_easy_cleanup(conn->curl); + XML_ParserFree(conn->xml_parser); i_free(conn->last_sent_url); i_free(conn->url); i_free(conn); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/plugins/lazy-expunge/lazy-expunge-plugin.c new/dovecot-2.1.13/src/plugins/lazy-expunge/lazy-expunge-plugin.c --- old/dovecot-2.1.12/src/plugins/lazy-expunge/lazy-expunge-plugin.c 2012-10-02 20:34:13.000000000 +0200 +++ new/dovecot-2.1.13/src/plugins/lazy-expunge/lazy-expunge-plugin.c 2013-01-07 08:49:48.000000000 +0100 @@ -121,9 +121,20 @@ union mail_module_context *mmail = LAZY_EXPUNGE_MAIL_CONTEXT(mail); struct lazy_expunge_transaction *lt = LAZY_EXPUNGE_CONTEXT(_mail->transaction); + struct lazy_expunge_mailbox_list *llist; + struct mailbox *real_box; struct mail_save_context *save_ctx; const char *error; + /* don't copy the mail if we're expunging from lazy_expunge + namespace (even if it's via a virtual mailbox) */ + real_box = mail_get_real_mail(_mail)->box; + llist = LAZY_EXPUNGE_LIST_CONTEXT(real_box->list); + if (llist != NULL && llist->internal_namespace) { + mmail->super.expunge(_mail); + return; + } + if (lt->dest_box == NULL) { lt->dest_box = mailbox_open_or_create(luser->lazy_ns->list, _mail->box, &error); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/plugins/quota/quota-storage.c new/dovecot-2.1.13/src/plugins/quota/quota-storage.c --- old/dovecot-2.1.12/src/plugins/quota/quota-storage.c 2012-11-27 01:40:45.000000000 +0100 +++ new/dovecot-2.1.13/src/plugins/quota/quota-storage.c 2013-01-04 23:05:30.000000000 +0100 @@ -520,6 +520,7 @@ struct quota_mailbox_list *qlist; struct quota *quota = NULL; struct quota_root *root; + struct mail_user *quota_user; bool add; if (QUOTA_USER_CONTEXT(list->ns->user) == NULL) @@ -528,8 +529,14 @@ /* see if we have a quota explicitly defined for this namespace */ quota = quota_get_mail_user_quota(list->ns->user); root = quota_find_root_for_ns(quota, list->ns); - if (root != NULL) + if (root != NULL) { + /* explicit quota root */ root->ns = list->ns; + quota_user = list->ns->user; + } else { + quota_user = list->ns->owner != NULL ? + list->ns->owner : list->ns->user; + } if ((list->ns->flags & NAMESPACE_FLAG_NOQUOTA) != 0) add = FALSE; @@ -538,7 +545,9 @@ explicitly defined for it */ add = root != NULL; } else { - add = TRUE; + /* for shared namespaces add only if the owner has quota + enabled */ + add = QUOTA_USER_CONTEXT(quota_user) != NULL; } if (add) { @@ -550,10 +559,7 @@ v->deinit = quota_mailbox_list_deinit; MODULE_CONTEXT_SET(list, quota_mailbox_list_module, qlist); - /* register to owner's quota roots */ - quota = list->ns->owner != NULL ? - quota_get_mail_user_quota(list->ns->owner) : - quota_get_mail_user_quota(list->ns->user); + quota = quota_get_mail_user_quota(quota_user); quota_add_user_namespace(quota, list->ns); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/plugins/virtual/virtual-config.c new/dovecot-2.1.13/src/plugins/virtual/virtual-config.c --- old/dovecot-2.1.12/src/plugins/virtual/virtual-config.c 2012-02-21 10:06:59.000000000 +0100 +++ new/dovecot-2.1.13/src/plugins/virtual/virtual-config.c 2012-12-14 19:13:36.000000000 +0100 @@ -27,6 +27,7 @@ char sep; bool have_wildcards; + bool have_mailbox_defines; }; static struct mail_search_args * @@ -169,6 +170,7 @@ bbox->name++; ctx->mbox->save_bbox = bbox; } + ctx->have_mailbox_defines = TRUE; array_append(&ctx->mbox->backend_boxes, &bbox, 1); return 0; } @@ -419,7 +421,7 @@ if (ret == 0 && ctx.have_wildcards) ret = virtual_config_expand_wildcards(&ctx); - if (ret == 0 && array_count(&mbox->backend_boxes) == 0) { + if (ret == 0 && !ctx.have_mailbox_defines) { mail_storage_set_critical(storage, "%s: No mailboxes defined", path); ret = -1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/dovecot-2.1.12/src/plugins/virtual/virtual-mail.c new/dovecot-2.1.13/src/plugins/virtual/virtual-mail.c --- old/dovecot-2.1.12/src/plugins/virtual/virtual-mail.c 2012-03-22 16:43:50.000000000 +0100 +++ new/dovecot-2.1.13/src/plugins/virtual/virtual-mail.c 2013-01-04 02:42:31.000000000 +0100 @@ -289,15 +289,17 @@ { struct virtual_mail *vmail = (struct virtual_mail *)mail; struct mail_private *p = (struct mail_private *)vmail->backend_mail; + int ret; if (virtual_mail_handle_lost(vmail) < 0) return -1; - if (p->v.get_first_header(vmail->backend_mail, field, - decode_to_utf8, value_r) < 0) { + ret = p->v.get_first_header(vmail->backend_mail, field, + decode_to_utf8, value_r); + if (ret < 0) { virtual_box_copy_error(mail->box, vmail->backend_mail->box); return -1; } - return 0; + return ret; } static int -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
