Date: Wednesday, June 20, 2018 @ 07:09:15 Author: foxxx0 Revision: 344190
archrelease: copy trunk to community-x86_64 Added: dovecot/repos/community-x86_64/PKGBUILD (from rev 344189, dovecot/trunk/PKGBUILD) dovecot/repos/community-x86_64/dovecot-0004-fix-replication-hang-ioloop.patch (from rev 344189, dovecot/trunk/dovecot-0004-fix-replication-hang-ioloop.patch) dovecot/repos/community-x86_64/dovecot-0005-fix-mail_user_home_mkdir.patch (from rev 344189, dovecot/trunk/dovecot-0005-fix-mail_user_home_mkdir.patch) dovecot/repos/community-x86_64/dovecot-0006-fix-segfault-when-overquota.patch (from rev 344189, dovecot/trunk/dovecot-0006-fix-segfault-when-overquota.patch) dovecot/repos/community-x86_64/dovecot-0007-lda-allow-empty-envelope-sender.patch (from rev 344189, dovecot/trunk/dovecot-0007-lda-allow-empty-envelope-sender.patch) dovecot/repos/community-x86_64/dovecot.ld.so.conf (from rev 344189, dovecot/trunk/dovecot.ld.so.conf) dovecot/repos/community-x86_64/dovecot.sysusersd (from rev 344189, dovecot/trunk/dovecot.sysusersd) dovecot/repos/community-x86_64/dovecot.tmpfilesd (from rev 344189, dovecot/trunk/dovecot.tmpfilesd) Deleted: dovecot/repos/community-x86_64/PKGBUILD dovecot/repos/community-x86_64/dovecot-0004-fix-replication-hang-ioloop.patch dovecot/repos/community-x86_64/dovecot-0005-fix-mail_user_home_mkdir.patch dovecot/repos/community-x86_64/dovecot-0006-fix-segfault-when-overquota.patch dovecot/repos/community-x86_64/dovecot.ld.so.conf dovecot/repos/community-x86_64/dovecot.sysusersd dovecot/repos/community-x86_64/dovecot.tmpfilesd ----------------------------------------------------+ PKGBUILD | 246 ++++++++--------- dovecot-0004-fix-replication-hang-ioloop.patch | 52 +-- dovecot-0005-fix-mail_user_home_mkdir.patch | 264 +++++++++---------- dovecot-0006-fix-segfault-when-overquota.patch | 50 +-- dovecot-0007-lda-allow-empty-envelope-sender.patch | 27 + dovecot.ld.so.conf | 2 dovecot.sysusersd | 4 dovecot.tmpfilesd | 2 8 files changed, 338 insertions(+), 309 deletions(-) Deleted: PKGBUILD =================================================================== --- PKGBUILD 2018-06-20 07:09:04 UTC (rev 344189) +++ PKGBUILD 2018-06-20 07:09:15 UTC (rev 344190) @@ -1,122 +0,0 @@ -# $Id$ -# Maintainer: Johannes Löthberg <johan...@kyriasis.com> -# Maintainer: Thore Bödecker <fox...@archlinux.org> -# Contributor: Bartłomiej Piotrowski <bpiotrow...@archlinux.org> -# Contributor: Andreas Radke <andy...@archlinux.org> -# Contributor: Paul Mattal <p...@mattal.com> -# Contributor: Federico Quagliata (quaqo) <qu...@despammed.com> -# Contributor: GARETTE Emmanuel <gnunux at laposte dot net> - -# --->>> remember to rebuild/bump pigeonhole in one step <<<--- - -pkgname=dovecot -pkgver=2.3.1 -pkgrel=5 - -pkgdesc="An IMAP and POP3 server written with security primarily in mind" -url="http://dovecot.org/" -arch=('x86_64') -license=("LGPL") - -depends=('krb5' 'openssl' 'sqlite' 'libmariadbclient' 'libsodium' - 'postgresql-libs' 'bzip2' 'lz4' 'expat' 'curl' 'pam') -makedepends=('libcap' 'libldap' 'clucene' 'libsodium') -optdepends=('libldap: ldap plugin' - 'xz: imap zlib plugin' - 'clucene: alternative FTS indexer') - -provides=('imap-server' 'pop3-server') - -source=("https://dovecot.org/releases/2.3/${pkgname}-${pkgver}.tar.gz"{,.sig} - 'dovecot.sysusersd' - 'dovecot.tmpfilesd' - 'dovecot.ld.so.conf' - 'dovecot-0004-fix-replication-hang-ioloop.patch' - 'dovecot-0005-fix-mail_user_home_mkdir.patch' - 'dovecot-0006-fix-segfault-when-overquota.patch') - -sha256sums=('0883821b97fd02a084a84b9469a681f7e6edc56541d854b5419d98891c51fb93' - 'SKIP' - 'c5e3a8ffe23e5deb4f7893d9877d972347c2ee45c4ebf713de85c537e47cfcaf' - 'bb7620be7fc0217d77fcac940441c2abbd9efc6ef660153288d09ba412e27e06' - 'a457a1691cfa82495fc0503bfa4b61e54b149e63400fe0f568dff2c24a3f7858' - '38d944d7fb3790f1ac64ecd855a37ba5c16374a83b374306ce6296a598f5257c' - 'd4e34418dbe1b3ddd10e859bccd735e8708081916a5be3d35a8a54bdf8cda70c' - '27f3624ea33165c5eddd0bcdb2c92cb92c559b6e1e74975c72241383656c3b2a') - -validpgpkeys=( - 'E643F0BDFDCD04D9FFCB6279C948525140558AC9' # Timo Sirainen <t...@iki.fi> - '2BE74AAB3EE754DFB9C80D3318A348AEED409DA1' # Dovecot Community Edition -) - -prepare() { - cd "${srcdir}/${pkgname}-${pkgver}" - - local filename - for filename in "${source[@]}"; do - if [[ "$filename" =~ \.patch$ ]]; then - msg2 "Applying patch ${filename##*/}" - patch -p1 -N -l -i "$srcdir/${filename##*/}" - fi - done - - # fix path in helper script - sed -i 's:OPENSSLCONFIG=${OPENSSLCONFIG-dovecot-openssl.cnf}:OPENSSLCONFIG=${OPENSSLCONFIG- /etc/ssl/dovecot-openssl.cnf}:' doc/mkcert.sh -} - -build() { - cd "${srcdir}/${pkgname}-${pkgver}" - - ./configure --prefix=/usr --sysconfdir=/etc \ - --sbindir=/usr/bin \ - --localstatedir=/var \ - --libexecdir=/usr/lib \ - --with-moduledir=/usr/lib/dovecot/modules \ - --with-systemdsystemunitdir=/usr/lib/systemd/system \ - --disable-static \ - --with-nss \ - --with-pam \ - --with-mysql \ - --with-pgsql \ - --with-sqlite \ - --with-ssl=openssl \ - --with-ssldir=/etc/ssl \ - --with-gssapi \ - --with-ldap=plugin \ - --with-zlib \ - --with-bzlib \ - --with-lzma \ - --with-lz4 \ - --with-libcap \ - --with-solr \ - --with-lucene \ - --with-sodium \ - --with-docs - - make -} - -check() { - cd "${srcdir}/${pkgname}-${pkgver}" - make check -} - -package() { - # system user/group dovenull - 74 - # system user/group dovecot - 76 - - cd "${srcdir}/${pkgname}-${pkgver}" - make DESTDIR="$pkgdir" install - install -Dm644 "${srcdir}/dovecot.sysusersd" \ - "${pkgdir}/usr/lib/sysusers.d/dovecot.conf" - install -Dm644 "${srcdir}/dovecot.tmpfilesd" \ - "${pkgdir}/usr/lib/tmpfiles.d/dovecot.conf" - install -d -m755 "${pkgdir}/etc/dovecot/conf.d" - rm -f "${pkgdir}/etc/dovecot/README" - - # install mkcert helper script - install -m 755 doc/mkcert.sh "${pkgdir}/usr/lib/dovecot/mkcert.sh" - - # add dovecot libdir - install -Dm644 "${srcdir}/dovecot.ld.so.conf" "${pkgdir}/etc/ld.so.conf.d/dovecot.conf" -} Copied: dovecot/repos/community-x86_64/PKGBUILD (from rev 344189, dovecot/trunk/PKGBUILD) =================================================================== --- PKGBUILD (rev 0) +++ PKGBUILD 2018-06-20 07:09:15 UTC (rev 344190) @@ -0,0 +1,124 @@ +# $Id$ +# Maintainer: Johannes Löthberg <johan...@kyriasis.com> +# Maintainer: Thore Bödecker <fox...@archlinux.org> +# Contributor: Bartłomiej Piotrowski <bpiotrow...@archlinux.org> +# Contributor: Andreas Radke <andy...@archlinux.org> +# Contributor: Paul Mattal <p...@mattal.com> +# Contributor: Federico Quagliata (quaqo) <qu...@despammed.com> +# Contributor: GARETTE Emmanuel <gnunux at laposte dot net> + +# --->>> remember to rebuild/bump pigeonhole in one step <<<--- + +pkgname=dovecot +pkgver=2.3.1 +pkgrel=6 + +pkgdesc="An IMAP and POP3 server written with security primarily in mind" +url="http://dovecot.org/" +arch=('x86_64') +license=("LGPL") + +depends=('krb5' 'openssl' 'sqlite' 'libmariadbclient' 'libsodium' + 'postgresql-libs' 'bzip2' 'lz4' 'expat' 'curl' 'pam') +makedepends=('libcap' 'libldap' 'clucene' 'libsodium') +optdepends=('libldap: ldap plugin' + 'xz: imap zlib plugin' + 'clucene: alternative FTS indexer') + +provides=('imap-server' 'pop3-server') + +source=("https://dovecot.org/releases/2.3/${pkgname}-${pkgver}.tar.gz"{,.sig} + 'dovecot.sysusersd' + 'dovecot.tmpfilesd' + 'dovecot.ld.so.conf' + 'dovecot-0004-fix-replication-hang-ioloop.patch' + 'dovecot-0005-fix-mail_user_home_mkdir.patch' + 'dovecot-0006-fix-segfault-when-overquota.patch' + 'dovecot-0007-lda-allow-empty-envelope-sender.patch') + +sha256sums=('0883821b97fd02a084a84b9469a681f7e6edc56541d854b5419d98891c51fb93' + 'SKIP' + 'c5e3a8ffe23e5deb4f7893d9877d972347c2ee45c4ebf713de85c537e47cfcaf' + 'bb7620be7fc0217d77fcac940441c2abbd9efc6ef660153288d09ba412e27e06' + 'a457a1691cfa82495fc0503bfa4b61e54b149e63400fe0f568dff2c24a3f7858' + '38d944d7fb3790f1ac64ecd855a37ba5c16374a83b374306ce6296a598f5257c' + 'd4e34418dbe1b3ddd10e859bccd735e8708081916a5be3d35a8a54bdf8cda70c' + '27f3624ea33165c5eddd0bcdb2c92cb92c559b6e1e74975c72241383656c3b2a' + '53514030608054566bd8530c4bc388e0e325352f86764bece2ebef6205108ce2') + +validpgpkeys=( + 'E643F0BDFDCD04D9FFCB6279C948525140558AC9' # Timo Sirainen <t...@iki.fi> + '2BE74AAB3EE754DFB9C80D3318A348AEED409DA1' # Dovecot Community Edition +) + +prepare() { + cd "${srcdir}/${pkgname}-${pkgver}" + + local filename + for filename in "${source[@]}"; do + if [[ "$filename" =~ \.patch$ ]]; then + msg2 "Applying patch ${filename##*/}" + patch -p1 -N -l -i "$srcdir/${filename##*/}" + fi + done + + # fix path in helper script + sed -i 's:OPENSSLCONFIG=${OPENSSLCONFIG-dovecot-openssl.cnf}:OPENSSLCONFIG=${OPENSSLCONFIG- /etc/ssl/dovecot-openssl.cnf}:' doc/mkcert.sh +} + +build() { + cd "${srcdir}/${pkgname}-${pkgver}" + + ./configure --prefix=/usr --sysconfdir=/etc \ + --sbindir=/usr/bin \ + --localstatedir=/var \ + --libexecdir=/usr/lib \ + --with-moduledir=/usr/lib/dovecot/modules \ + --with-systemdsystemunitdir=/usr/lib/systemd/system \ + --disable-static \ + --with-nss \ + --with-pam \ + --with-mysql \ + --with-pgsql \ + --with-sqlite \ + --with-ssl=openssl \ + --with-ssldir=/etc/ssl \ + --with-gssapi \ + --with-ldap=plugin \ + --with-zlib \ + --with-bzlib \ + --with-lzma \ + --with-lz4 \ + --with-libcap \ + --with-solr \ + --with-lucene \ + --with-sodium \ + --with-docs + + make +} + +check() { + cd "${srcdir}/${pkgname}-${pkgver}" + make check +} + +package() { + # system user/group dovenull - 74 + # system user/group dovecot - 76 + + cd "${srcdir}/${pkgname}-${pkgver}" + make DESTDIR="$pkgdir" install + install -Dm644 "${srcdir}/dovecot.sysusersd" \ + "${pkgdir}/usr/lib/sysusers.d/dovecot.conf" + install -Dm644 "${srcdir}/dovecot.tmpfilesd" \ + "${pkgdir}/usr/lib/tmpfiles.d/dovecot.conf" + install -d -m755 "${pkgdir}/etc/dovecot/conf.d" + rm -f "${pkgdir}/etc/dovecot/README" + + # install mkcert helper script + install -m 755 doc/mkcert.sh "${pkgdir}/usr/lib/dovecot/mkcert.sh" + + # add dovecot libdir + install -Dm644 "${srcdir}/dovecot.ld.so.conf" "${pkgdir}/etc/ld.so.conf.d/dovecot.conf" +} Deleted: dovecot-0004-fix-replication-hang-ioloop.patch =================================================================== --- dovecot-0004-fix-replication-hang-ioloop.patch 2018-06-20 07:09:04 UTC (rev 344189) +++ dovecot-0004-fix-replication-hang-ioloop.patch 2018-06-20 07:09:15 UTC (rev 344190) @@ -1,26 +0,0 @@ -From a952e178943a5944255cb7c053d970f8e6d49336 Mon Sep 17 00:00:00 2001 -From: Timo Sirainen <timo.sirai...@dovecot.fi> -Date: Tue, 5 Jun 2018 20:23:52 +0300 -Subject: [PATCH] doveadm-server: Fix hang when sending a lot of output to - clients - -Nowadays ostream adds its io to the stream's specified ioloop, not to -current ioloop. ---- - src/doveadm/client-connection-tcp.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/src/doveadm/client-connection-tcp.c b/src/doveadm/client-connection-tcp.c -index a2e1358d7f..672017495d 100644 ---- a/src/doveadm/client-connection-tcp.c -+++ b/src/doveadm/client-connection-tcp.c -@@ -336,6 +336,9 @@ static int doveadm_cmd_handle(struct client_connection_tcp *conn, - running one and we can't call the original one recursively, so - create a new ioloop. */ - conn->ioloop = io_loop_create(); -+ o_stream_switch_ioloop(conn->output); -+ if (conn->log_out != NULL) -+ o_stream_switch_ioloop(conn->log_out); - - if (cmd_ver2 != NULL) - doveadm_cmd_server_run_ver2(conn, argc, argv, cctx); Copied: dovecot/repos/community-x86_64/dovecot-0004-fix-replication-hang-ioloop.patch (from rev 344189, dovecot/trunk/dovecot-0004-fix-replication-hang-ioloop.patch) =================================================================== --- dovecot-0004-fix-replication-hang-ioloop.patch (rev 0) +++ dovecot-0004-fix-replication-hang-ioloop.patch 2018-06-20 07:09:15 UTC (rev 344190) @@ -0,0 +1,26 @@ +From a952e178943a5944255cb7c053d970f8e6d49336 Mon Sep 17 00:00:00 2001 +From: Timo Sirainen <timo.sirai...@dovecot.fi> +Date: Tue, 5 Jun 2018 20:23:52 +0300 +Subject: [PATCH] doveadm-server: Fix hang when sending a lot of output to + clients + +Nowadays ostream adds its io to the stream's specified ioloop, not to +current ioloop. +--- + src/doveadm/client-connection-tcp.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/doveadm/client-connection-tcp.c b/src/doveadm/client-connection-tcp.c +index a2e1358d7f..672017495d 100644 +--- a/src/doveadm/client-connection-tcp.c ++++ b/src/doveadm/client-connection-tcp.c +@@ -336,6 +336,9 @@ static int doveadm_cmd_handle(struct client_connection_tcp *conn, + running one and we can't call the original one recursively, so + create a new ioloop. */ + conn->ioloop = io_loop_create(); ++ o_stream_switch_ioloop(conn->output); ++ if (conn->log_out != NULL) ++ o_stream_switch_ioloop(conn->log_out); + + if (cmd_ver2 != NULL) + doveadm_cmd_server_run_ver2(conn, argc, argv, cctx); Deleted: dovecot-0005-fix-mail_user_home_mkdir.patch =================================================================== --- dovecot-0005-fix-mail_user_home_mkdir.patch 2018-06-20 07:09:04 UTC (rev 344189) +++ dovecot-0005-fix-mail_user_home_mkdir.patch 2018-06-20 07:09:15 UTC (rev 344190) @@ -1,132 +0,0 @@ -From 59cd19919bf444e5c3fa429314408aacc8dd4eb8 Mon Sep 17 00:00:00 2001 -From: Timo Sirainen <timo.sirai...@dovecot.fi> -Date: Tue, 24 Apr 2018 18:47:28 +0300 -Subject: [PATCH 1/2] lib-storage: Add mail_user_home_mkdir() - ---- - src/lib-storage/mail-user.c | 61 +++++++++++++++++++++++++++++++++++++++++++++ - src/lib-storage/mail-user.h | 5 ++++ - 2 files changed, 66 insertions(+) - -diff --git a/src/lib-storage/mail-user.c b/src/lib-storage/mail-user.c -index 947e26cee4..a15ed353ff 100644 ---- a/src/lib-storage/mail-user.c -+++ b/src/lib-storage/mail-user.c -@@ -8,6 +8,7 @@ - #include "module-dir.h" - #include "home-expand.h" - #include "file-create-locked.h" -+#include "mkdir-parents.h" - #include "safe-mkstemp.h" - #include "str.h" - #include "strescape.h" -@@ -716,6 +717,66 @@ void mail_user_stats_fill(struct mail_user *user, struct stats *stats) - user->v.stats_fill(user, stats); - } - -+static int -+mail_user_home_mkdir_try_ns(struct mail_namespace *ns, const char *home) -+{ -+ const enum mailbox_list_path_type types[] = { -+ MAILBOX_LIST_PATH_TYPE_DIR, -+ MAILBOX_LIST_PATH_TYPE_ALT_DIR, -+ MAILBOX_LIST_PATH_TYPE_CONTROL, -+ MAILBOX_LIST_PATH_TYPE_INDEX, -+ MAILBOX_LIST_PATH_TYPE_INDEX_PRIVATE, -+ MAILBOX_LIST_PATH_TYPE_INDEX_CACHE, -+ MAILBOX_LIST_PATH_TYPE_LIST_INDEX, -+ }; -+ size_t home_len = strlen(home); -+ const char *path; -+ -+ for (unsigned int i = 0; i < N_ELEMENTS(types); i++) { -+ if (!mailbox_list_get_root_path(ns->list, types[i], &path)) -+ continue; -+ if (strncmp(path, home, home_len) == 0 && -+ (path[home_len] == '\0' || path[home_len] == '/')) { -+ return mailbox_list_mkdir_root(ns->list, path, -+ types[i]) < 0 ? -1 : 1; -+ } -+ } -+ return 0; -+} -+ -+int mail_user_home_mkdir(struct mail_user *user) -+{ -+ struct mail_namespace *ns; -+ const char *home; -+ int ret; -+ -+ if (mail_user_get_home(user, &home) < 0) -+ return -1; -+ -+ /* Try to create the home directory by creating the root directory for -+ a namespace that exists under the home. This way we end up in the -+ special mkdir() code in mailbox_list_try_mkdir_root_parent(). -+ Start from INBOX, since that's usually the correct place. */ -+ ns = mail_namespace_find_inbox(user->namespaces); -+ if ((ret = mail_user_home_mkdir_try_ns(ns, home)) != 0) -+ return ret < 0 ? -1 : 0; -+ /* try other namespaces */ -+ for (ns = user->namespaces; ns != NULL; ns = ns->next) { -+ if ((ns->flags & NAMESPACE_FLAG_INBOX_USER) != 0) { -+ /* already tried the INBOX namespace */ -+ continue; -+ } -+ if ((ret = mail_user_home_mkdir_try_ns(ns, home)) != 0) -+ return ret < 0 ? -1 : 0; -+ } -+ /* fallback to a safe mkdir() with 0700 mode */ -+ if (mkdir_parents(home, 0700) < 0 && errno != EEXIST) { -+ i_error("mkdir_parents(%s) failed: %m", home); -+ return -1; -+ } -+ return 0; -+} -+ - static const struct var_expand_func_table mail_user_var_expand_func_table_arr[] = { - { "userdb", mail_user_var_expand_func_userdb }, - { NULL, NULL } -diff --git a/src/lib-storage/mail-user.h b/src/lib-storage/mail-user.h -index b97514df75..1627e34fe1 100644 ---- a/src/lib-storage/mail-user.h -+++ b/src/lib-storage/mail-user.h -@@ -210,4 +210,9 @@ void mail_user_init_fs_settings(struct mail_user *user, - plugin must be loaded to have anything filled. */ - void mail_user_stats_fill(struct mail_user *user, struct stats *stats); - -+/* Try to mkdir() user's home directory. Ideally this should be called only -+ after the caller tries to create a file to the home directory, but it fails -+ with ENOENT. This way it avoids unnecessary disk IO to the home. */ -+int mail_user_home_mkdir(struct mail_user *user); -+ - #endif - -From 8077d714e11388a294f1583e706152396972acce Mon Sep 17 00:00:00 2001 -From: Timo Sirainen <timo.sirai...@dovecot.fi> -Date: Tue, 24 Apr 2018 18:50:38 +0300 -Subject: [PATCH 2/2] dsync: If lock file can't be created because home is - missing, mkdir the home - ---- - src/doveadm/dsync/dsync-brain.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/src/doveadm/dsync/dsync-brain.c b/src/doveadm/dsync/dsync-brain.c -index c2b8169f1a..6bc013ff53 100644 ---- a/src/doveadm/dsync/dsync-brain.c -+++ b/src/doveadm/dsync/dsync-brain.c -@@ -441,6 +441,13 @@ dsync_brain_lock(struct dsync_brain *brain, const char *remote_hostname) - "/"DSYNC_LOCK_FILENAME, NULL); - brain->lock_fd = file_create_locked(brain->lock_path, &lock_set, - &brain->lock, &created, &error); -+ if (brain->lock_fd == -1 && errno == ENOENT) { -+ /* home directory not created */ -+ if (mail_user_home_mkdir(brain->user) < 0) -+ return -1; -+ brain->lock_fd = file_create_locked(brain->lock_path, &lock_set, -+ &brain->lock, &created, &error); -+ } - if (brain->lock_fd == -1) - i_error("Couldn't lock %s: %s", brain->lock_path, error); - else if (brain->debug) { Copied: dovecot/repos/community-x86_64/dovecot-0005-fix-mail_user_home_mkdir.patch (from rev 344189, dovecot/trunk/dovecot-0005-fix-mail_user_home_mkdir.patch) =================================================================== --- dovecot-0005-fix-mail_user_home_mkdir.patch (rev 0) +++ dovecot-0005-fix-mail_user_home_mkdir.patch 2018-06-20 07:09:15 UTC (rev 344190) @@ -0,0 +1,132 @@ +From 59cd19919bf444e5c3fa429314408aacc8dd4eb8 Mon Sep 17 00:00:00 2001 +From: Timo Sirainen <timo.sirai...@dovecot.fi> +Date: Tue, 24 Apr 2018 18:47:28 +0300 +Subject: [PATCH 1/2] lib-storage: Add mail_user_home_mkdir() + +--- + src/lib-storage/mail-user.c | 61 +++++++++++++++++++++++++++++++++++++++++++++ + src/lib-storage/mail-user.h | 5 ++++ + 2 files changed, 66 insertions(+) + +diff --git a/src/lib-storage/mail-user.c b/src/lib-storage/mail-user.c +index 947e26cee4..a15ed353ff 100644 +--- a/src/lib-storage/mail-user.c ++++ b/src/lib-storage/mail-user.c +@@ -8,6 +8,7 @@ + #include "module-dir.h" + #include "home-expand.h" + #include "file-create-locked.h" ++#include "mkdir-parents.h" + #include "safe-mkstemp.h" + #include "str.h" + #include "strescape.h" +@@ -716,6 +717,66 @@ void mail_user_stats_fill(struct mail_user *user, struct stats *stats) + user->v.stats_fill(user, stats); + } + ++static int ++mail_user_home_mkdir_try_ns(struct mail_namespace *ns, const char *home) ++{ ++ const enum mailbox_list_path_type types[] = { ++ MAILBOX_LIST_PATH_TYPE_DIR, ++ MAILBOX_LIST_PATH_TYPE_ALT_DIR, ++ MAILBOX_LIST_PATH_TYPE_CONTROL, ++ MAILBOX_LIST_PATH_TYPE_INDEX, ++ MAILBOX_LIST_PATH_TYPE_INDEX_PRIVATE, ++ MAILBOX_LIST_PATH_TYPE_INDEX_CACHE, ++ MAILBOX_LIST_PATH_TYPE_LIST_INDEX, ++ }; ++ size_t home_len = strlen(home); ++ const char *path; ++ ++ for (unsigned int i = 0; i < N_ELEMENTS(types); i++) { ++ if (!mailbox_list_get_root_path(ns->list, types[i], &path)) ++ continue; ++ if (strncmp(path, home, home_len) == 0 && ++ (path[home_len] == '\0' || path[home_len] == '/')) { ++ return mailbox_list_mkdir_root(ns->list, path, ++ types[i]) < 0 ? -1 : 1; ++ } ++ } ++ return 0; ++} ++ ++int mail_user_home_mkdir(struct mail_user *user) ++{ ++ struct mail_namespace *ns; ++ const char *home; ++ int ret; ++ ++ if (mail_user_get_home(user, &home) < 0) ++ return -1; ++ ++ /* Try to create the home directory by creating the root directory for ++ a namespace that exists under the home. This way we end up in the ++ special mkdir() code in mailbox_list_try_mkdir_root_parent(). ++ Start from INBOX, since that's usually the correct place. */ ++ ns = mail_namespace_find_inbox(user->namespaces); ++ if ((ret = mail_user_home_mkdir_try_ns(ns, home)) != 0) ++ return ret < 0 ? -1 : 0; ++ /* try other namespaces */ ++ for (ns = user->namespaces; ns != NULL; ns = ns->next) { ++ if ((ns->flags & NAMESPACE_FLAG_INBOX_USER) != 0) { ++ /* already tried the INBOX namespace */ ++ continue; ++ } ++ if ((ret = mail_user_home_mkdir_try_ns(ns, home)) != 0) ++ return ret < 0 ? -1 : 0; ++ } ++ /* fallback to a safe mkdir() with 0700 mode */ ++ if (mkdir_parents(home, 0700) < 0 && errno != EEXIST) { ++ i_error("mkdir_parents(%s) failed: %m", home); ++ return -1; ++ } ++ return 0; ++} ++ + static const struct var_expand_func_table mail_user_var_expand_func_table_arr[] = { + { "userdb", mail_user_var_expand_func_userdb }, + { NULL, NULL } +diff --git a/src/lib-storage/mail-user.h b/src/lib-storage/mail-user.h +index b97514df75..1627e34fe1 100644 +--- a/src/lib-storage/mail-user.h ++++ b/src/lib-storage/mail-user.h +@@ -210,4 +210,9 @@ void mail_user_init_fs_settings(struct mail_user *user, + plugin must be loaded to have anything filled. */ + void mail_user_stats_fill(struct mail_user *user, struct stats *stats); + ++/* Try to mkdir() user's home directory. Ideally this should be called only ++ after the caller tries to create a file to the home directory, but it fails ++ with ENOENT. This way it avoids unnecessary disk IO to the home. */ ++int mail_user_home_mkdir(struct mail_user *user); ++ + #endif + +From 8077d714e11388a294f1583e706152396972acce Mon Sep 17 00:00:00 2001 +From: Timo Sirainen <timo.sirai...@dovecot.fi> +Date: Tue, 24 Apr 2018 18:50:38 +0300 +Subject: [PATCH 2/2] dsync: If lock file can't be created because home is + missing, mkdir the home + +--- + src/doveadm/dsync/dsync-brain.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/src/doveadm/dsync/dsync-brain.c b/src/doveadm/dsync/dsync-brain.c +index c2b8169f1a..6bc013ff53 100644 +--- a/src/doveadm/dsync/dsync-brain.c ++++ b/src/doveadm/dsync/dsync-brain.c +@@ -441,6 +441,13 @@ dsync_brain_lock(struct dsync_brain *brain, const char *remote_hostname) + "/"DSYNC_LOCK_FILENAME, NULL); + brain->lock_fd = file_create_locked(brain->lock_path, &lock_set, + &brain->lock, &created, &error); ++ if (brain->lock_fd == -1 && errno == ENOENT) { ++ /* home directory not created */ ++ if (mail_user_home_mkdir(brain->user) < 0) ++ return -1; ++ brain->lock_fd = file_create_locked(brain->lock_path, &lock_set, ++ &brain->lock, &created, &error); ++ } + if (brain->lock_fd == -1) + i_error("Couldn't lock %s: %s", brain->lock_path, error); + else if (brain->debug) { Deleted: dovecot-0006-fix-segfault-when-overquota.patch =================================================================== --- dovecot-0006-fix-segfault-when-overquota.patch 2018-06-20 07:09:04 UTC (rev 344189) +++ dovecot-0006-fix-segfault-when-overquota.patch 2018-06-20 07:09:15 UTC (rev 344190) @@ -1,25 +0,0 @@ -From 847790d5aab84df38256a6f9b4849af0eb408419 Mon Sep 17 00:00:00 2001 -From: Stephan Bosch <stephan.bo...@dovecot.fi> -Date: Mon, 14 May 2018 23:56:21 +0200 -Subject: [PATCH] lmtp: Fix segfault occurring when a user turns out to be over - quota at DATA transfer. - -The LMTP recipient context was not updated with the final recipient address when -the RCPT command was accepted. This left a dangling struct smtp_address pointer -which triggered the segfault when used. ---- - src/lmtp/lmtp-common.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/lmtp/lmtp-common.c b/src/lmtp/lmtp-common.c -index b3f13dec41..39ed6c1b4f 100644 ---- a/src/lmtp/lmtp-common.c -+++ b/src/lmtp/lmtp-common.c -@@ -22,6 +22,7 @@ void lmtp_recipient_finish(struct lmtp_recipient *rcpt, - { - trcpt->context = rcpt; - -+ rcpt->path = trcpt->path; - rcpt->rcpt = trcpt; - rcpt->index = index; - rcpt->rcpt_cmd = NULL; Copied: dovecot/repos/community-x86_64/dovecot-0006-fix-segfault-when-overquota.patch (from rev 344189, dovecot/trunk/dovecot-0006-fix-segfault-when-overquota.patch) =================================================================== --- dovecot-0006-fix-segfault-when-overquota.patch (rev 0) +++ dovecot-0006-fix-segfault-when-overquota.patch 2018-06-20 07:09:15 UTC (rev 344190) @@ -0,0 +1,25 @@ +From 847790d5aab84df38256a6f9b4849af0eb408419 Mon Sep 17 00:00:00 2001 +From: Stephan Bosch <stephan.bo...@dovecot.fi> +Date: Mon, 14 May 2018 23:56:21 +0200 +Subject: [PATCH] lmtp: Fix segfault occurring when a user turns out to be over + quota at DATA transfer. + +The LMTP recipient context was not updated with the final recipient address when +the RCPT command was accepted. This left a dangling struct smtp_address pointer +which triggered the segfault when used. +--- + src/lmtp/lmtp-common.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/lmtp/lmtp-common.c b/src/lmtp/lmtp-common.c +index b3f13dec41..39ed6c1b4f 100644 +--- a/src/lmtp/lmtp-common.c ++++ b/src/lmtp/lmtp-common.c +@@ -22,6 +22,7 @@ void lmtp_recipient_finish(struct lmtp_recipient *rcpt, + { + trcpt->context = rcpt; + ++ rcpt->path = trcpt->path; + rcpt->rcpt = trcpt; + rcpt->index = index; + rcpt->rcpt_cmd = NULL; Copied: dovecot/repos/community-x86_64/dovecot-0007-lda-allow-empty-envelope-sender.patch (from rev 344189, dovecot/trunk/dovecot-0007-lda-allow-empty-envelope-sender.patch) =================================================================== --- dovecot-0007-lda-allow-empty-envelope-sender.patch (rev 0) +++ dovecot-0007-lda-allow-empty-envelope-sender.patch 2018-06-20 07:09:15 UTC (rev 344190) @@ -0,0 +1,27 @@ +From 6553f20bb31b5f0eebb73a0db526f00816b47d71 Mon Sep 17 00:00:00 2001 +From: Stephan Bosch <stephan.bo...@dovecot.fi> +Date: Sun, 8 Apr 2018 11:28:19 +0200 +Subject: [PATCH] lda: Allow empty envelope sender. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Fix by Martin Waschbüsch. +--- + src/lda/main.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/lda/main.c b/src/lda/main.c +index bab20e88ad..1d7c8473d2 100644 +--- a/src/lda/main.c ++++ b/src/lda/main.c +@@ -332,7 +332,8 @@ int main(int argc, char *argv[]) + case 'f': + /* envelope sender address */ + if (smtp_address_parse_path(ctx.pool, optarg, +- SMTP_ADDRESS_PARSE_FLAG_BRACKETS_OPTIONAL, ++ SMTP_ADDRESS_PARSE_FLAG_BRACKETS_OPTIONAL | ++ SMTP_ADDRESS_PARSE_FLAG_ALLOW_EMPTY, + &mail_from, &errstr) < 0) { + i_fatal_status(EX_USAGE, + "Invalid -f parameter: %s", errstr); Deleted: dovecot.ld.so.conf =================================================================== --- dovecot.ld.so.conf 2018-06-20 07:09:04 UTC (rev 344189) +++ dovecot.ld.so.conf 2018-06-20 07:09:15 UTC (rev 344190) @@ -1 +0,0 @@ -/usr/lib/dovecot Copied: dovecot/repos/community-x86_64/dovecot.ld.so.conf (from rev 344189, dovecot/trunk/dovecot.ld.so.conf) =================================================================== --- dovecot.ld.so.conf (rev 0) +++ dovecot.ld.so.conf 2018-06-20 07:09:15 UTC (rev 344190) @@ -0,0 +1 @@ +/usr/lib/dovecot Deleted: dovecot.sysusersd =================================================================== --- dovecot.sysusersd 2018-06-20 07:09:04 UTC (rev 344189) +++ dovecot.sysusersd 2018-06-20 07:09:15 UTC (rev 344190) @@ -1,2 +0,0 @@ -u dovenull 74 "Dovecot user for completely untrustworthy processes" - -u dovecot 76 "Dovecot user" - Copied: dovecot/repos/community-x86_64/dovecot.sysusersd (from rev 344189, dovecot/trunk/dovecot.sysusersd) =================================================================== --- dovecot.sysusersd (rev 0) +++ dovecot.sysusersd 2018-06-20 07:09:15 UTC (rev 344190) @@ -0,0 +1,2 @@ +u dovenull 74 "Dovecot user for completely untrustworthy processes" - +u dovecot 76 "Dovecot user" - Deleted: dovecot.tmpfilesd =================================================================== --- dovecot.tmpfilesd 2018-06-20 07:09:04 UTC (rev 344189) +++ dovecot.tmpfilesd 2018-06-20 07:09:15 UTC (rev 344190) @@ -1 +0,0 @@ -d /var/run/dovecot 0755 root dovecot - Copied: dovecot/repos/community-x86_64/dovecot.tmpfilesd (from rev 344189, dovecot/trunk/dovecot.tmpfilesd) =================================================================== --- dovecot.tmpfilesd (rev 0) +++ dovecot.tmpfilesd 2018-06-20 07:09:15 UTC (rev 344190) @@ -0,0 +1 @@ +d /var/run/dovecot 0755 root dovecot -