From fe29c7c3f59e57fbf374c550888020d6d3586db5 Mon Sep 17 00:00:00 2001 From: pea Date: Tue, 4 Jan 2011 13:59:17 +0000 Subject: [PATCH] Some fixes from upstream: - imap: Fixed a memory leak in ESEARCH. - imap/pop3-login: Don't crash if passdb returns proxy field without host. - lib-index: Added a missing sanity check for expunge-guid record's uid. This fixes a non-self healing assert-crash. - master: Delete also pipes from login_dir (left by v2.0). From Brad (maintainer), ok ajacoutot@ --- mail/dovecot/Makefile | 4 ++-- .../patches/patch-src_imap-login_imap-proxy_c | 15 +++++++++++++ .../patches/patch-src_imap_imap-search_c | 11 ++++++++++ ...tch-src_lib-index_mail-index-sync-update_c | 20 +++++++++++++++++ .../patch-src_master_master-settings_c | 22 +++++++++++++++++++ .../patches/patch-src_pop3-login_pop3-proxy_c | 15 +++++++++++++ 6 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 mail/dovecot/patches/patch-src_imap-login_imap-proxy_c create mode 100644 mail/dovecot/patches/patch-src_imap_imap-search_c create mode 100644 mail/dovecot/patches/patch-src_lib-index_mail-index-sync-update_c create mode 100644 mail/dovecot/patches/patch-src_master_master-settings_c create mode 100644 mail/dovecot/patches/patch-src_pop3-login_pop3-proxy_c diff --git a/mail/dovecot/Makefile b/mail/dovecot/Makefile index 8351112f59b..07316861e58 100644 --- a/mail/dovecot/Makefile +++ b/mail/dovecot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.157 2010/11/26 14:44:27 espie Exp $ +# $OpenBSD: Makefile,v 1.158 2011/01/04 13:59:17 pea Exp $ SHARED_ONLY= Yes @@ -12,7 +12,7 @@ V_MANAGESIEVE= 0.11.12 PKGNAME= dovecot-${V_DOVECOT} PKGNAME-server= dovecot-${V_DOVECOT} -REVISION-server=1 +REVISION-server=2 FULLPKGNAME-sieve= dovecot-sieve-${V_SIEVE} REVISION-sieve= 0 EPOCH-sieve= 0 diff --git a/mail/dovecot/patches/patch-src_imap-login_imap-proxy_c b/mail/dovecot/patches/patch-src_imap-login_imap-proxy_c new file mode 100644 index 00000000000..4b158507a9a --- /dev/null +++ b/mail/dovecot/patches/patch-src_imap-login_imap-proxy_c @@ -0,0 +1,15 @@ +$OpenBSD: patch-src_imap-login_imap-proxy_c,v 1.3 2011/01/04 13:59:17 pea Exp $ +--- src/imap-login/imap-proxy.c.orig Thu Dec 9 17:39:21 2010 ++++ src/imap-login/imap-proxy.c Thu Dec 9 17:41:00 2010 +@@ -436,6 +436,11 @@ int imap_proxy_new(struct imap_client *client, const c + client_send_tagline(client, PROXY_FAILURE_MSG); + return -1; + } ++ if (host == NULL || *host == '\0') { ++ client_syslog_err(&client->common, "proxy: host not given"); ++ client_send_tagline(client, PROXY_FAILURE_MSG); ++ return -1; ++ } + + i_assert(client->refcount > 1); + connection_queue_add(1); diff --git a/mail/dovecot/patches/patch-src_imap_imap-search_c b/mail/dovecot/patches/patch-src_imap_imap-search_c new file mode 100644 index 00000000000..1c37fa74475 --- /dev/null +++ b/mail/dovecot/patches/patch-src_imap_imap-search_c @@ -0,0 +1,11 @@ +$OpenBSD: patch-src_imap_imap-search_c,v 1.1 2011/01/04 13:59:17 pea Exp $ +--- src/imap/imap-search.c.orig Thu Dec 9 17:37:18 2010 ++++ src/imap/imap-search.c Thu Dec 9 17:37:44 2010 +@@ -283,6 +283,7 @@ static void imap_search_send_result(struct imap_search + } + str_append(str, "\r\n"); + o_stream_send(client->output, str_data(str), str_len(str)); ++ str_free(&str); + } + + static void search_update_mail(struct imap_search_context *ctx) diff --git a/mail/dovecot/patches/patch-src_lib-index_mail-index-sync-update_c b/mail/dovecot/patches/patch-src_lib-index_mail-index-sync-update_c new file mode 100644 index 00000000000..709094d3d3f --- /dev/null +++ b/mail/dovecot/patches/patch-src_lib-index_mail-index-sync-update_c @@ -0,0 +1,20 @@ +$OpenBSD: patch-src_lib-index_mail-index-sync-update_c,v 1.1 2011/01/04 13:59:17 pea Exp $ +--- src/lib-index/mail-index-sync-update.c.orig Sun Dec 5 18:18:06 2010 ++++ src/lib-index/mail-index-sync-update.c Sun Dec 5 18:18:45 2010 +@@ -528,8 +528,15 @@ int mail_index_sync_record(struct mail_index_sync_map_ + break; + } + end = CONST_PTR_OFFSET(data, hdr->size); +- for (; rec != end; rec++) ++ for (; rec != end; rec++) { ++ if (rec->uid == 0) { ++ mail_index_sync_set_corrupted(ctx, ++ "Expunge-guid for invalid uid=%u", ++ rec->uid); ++ break; ++ } + sync_expunge(ctx, rec->uid, rec->uid); ++ } + break; + } + case MAIL_TRANSACTION_FLAG_UPDATE: { diff --git a/mail/dovecot/patches/patch-src_master_master-settings_c b/mail/dovecot/patches/patch-src_master_master-settings_c new file mode 100644 index 00000000000..1ee17c24c6e --- /dev/null +++ b/mail/dovecot/patches/patch-src_master_master-settings_c @@ -0,0 +1,22 @@ +$OpenBSD: patch-src_master_master-settings_c,v 1.10 2011/01/04 13:59:17 pea Exp $ +--- src/master/master-settings.c.orig Thu Dec 9 17:29:09 2010 ++++ src/master/master-settings.c Thu Dec 9 17:29:09 2010 +@@ -649,7 +649,8 @@ static void unlink_auth_sockets(const char *path, cons + i_error("lstat(%s) failed: %m", str_c(str)); + continue; + } +- if (!S_ISSOCK(st.st_mode)) ++ /* delete also FIFOs created by v2.0 */ ++ if (!S_ISSOCK(st.st_mode) && !S_ISFIFO(st.st_mode)) + continue; + + /* try to avoid unlinking sockets if someone's already +@@ -657,7 +658,7 @@ static void unlink_auth_sockets(const char *path, cons + when SIGHUPing a child process might catch the new + connection before it notices that it's supposed + to die. null_fd == -1 check is a bit kludgy, but works.. */ +- if (null_fd == -1) { ++ if (null_fd == -1 && S_ISSOCK(st.st_mode)) { + int fd = net_connect_unix(str_c(str)); + if (fd != -1 || errno != ECONNREFUSED) { + i_fatal("Dovecot is already running? " diff --git a/mail/dovecot/patches/patch-src_pop3-login_pop3-proxy_c b/mail/dovecot/patches/patch-src_pop3-login_pop3-proxy_c new file mode 100644 index 00000000000..5d079982451 --- /dev/null +++ b/mail/dovecot/patches/patch-src_pop3-login_pop3-proxy_c @@ -0,0 +1,15 @@ +$OpenBSD: patch-src_pop3-login_pop3-proxy_c,v 1.3 2011/01/04 13:59:17 pea Exp $ +--- src/pop3-login/pop3-proxy.c.orig Thu Dec 9 17:41:09 2010 ++++ src/pop3-login/pop3-proxy.c Thu Dec 9 17:41:24 2010 +@@ -271,6 +271,11 @@ int pop3_proxy_new(struct pop3_client *client, const c + client_send_line(client, PROXY_FAILURE_MSG); + return -1; + } ++ if (host == NULL || *host == '\0') { ++ client_syslog_err(&client->common, "proxy: host not given"); ++ client_send_line(client, PROXY_FAILURE_MSG); ++ return -1; ++ } + + i_assert(client->refcount > 1); + connection_queue_add(1);