Add some bug-fix patches; at this point in the Dovecot release cycle
most work is on 1.1, so it makes sense to add them locally for now. - If SSL function fails and there are no errors, return "Unknown error" instead of "Success" as the reason. - Fixed a memory leak in ACL plugin. - Send the success reply in one write. - If remote disconnects, log "Connection closed: reason" just like IMAP does. - STORE: Ignore flag changes for read-only (especially EXAMINEd) mailboxes. - random_fill(): If read(/dev/urandom) returned EINTR, it could have written random data before the given buffer. - BODY/BODYSTRUCTURE fetch: Don't crash if we already had message parts parsed. From Brad, tested on various arch production servers.
This commit is contained in:
parent
ddfb1bb2de
commit
7bbaba5867
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.93 2008/05/16 05:45:26 bernd Exp $
|
||||
# $OpenBSD: Makefile,v 1.94 2008/05/22 07:55:08 sthen Exp $
|
||||
|
||||
SHARED_ONLY= Yes
|
||||
|
||||
@ -10,7 +10,7 @@ V_DOVECOT= 1.0.13
|
||||
V_SIEVE= 1.0.2
|
||||
|
||||
PKGNAME= dovecot-${V_DOVECOT}
|
||||
PKGNAME-server= dovecot-${V_DOVECOT}p1
|
||||
PKGNAME-server= dovecot-${V_DOVECOT}p2
|
||||
PKGNAME-sieve= dovecot-sieve-${V_SIEVE}p8
|
||||
|
||||
DISTNAME= dovecot-${V_DOVECOT}
|
||||
|
19
mail/dovecot/patches/patch-src_imap-login_imap-proxy_c
Normal file
19
mail/dovecot/patches/patch-src_imap-login_imap-proxy_c
Normal file
@ -0,0 +1,19 @@
|
||||
$OpenBSD: patch-src_imap-login_imap-proxy_c,v 1.1 2008/05/22 07:55:08 sthen Exp $
|
||||
--- src/imap-login/imap-proxy.c.orig Sun May 18 22:39:34 2008
|
||||
+++ src/imap-login/imap-proxy.c Sun May 18 22:40:30 2008
|
||||
@@ -45,9 +45,12 @@ static int proxy_input_line(struct imap_client *client
|
||||
return 0;
|
||||
} else if (strncmp(line, "P OK ", 5) == 0) {
|
||||
/* Login successful. Send this line to client. */
|
||||
- (void)o_stream_send_str(client->output, client->cmd_tag);
|
||||
- (void)o_stream_send_str(client->output, line + 1);
|
||||
- (void)o_stream_send(client->output, "\r\n", 2);
|
||||
+ str = t_str_new(128);
|
||||
+ str_append(str, client->cmd_tag);
|
||||
+ str_append(str, line + 1);
|
||||
+ str_append(str, "\r\n");
|
||||
+ (void)o_stream_send(client->output,
|
||||
+ str_data(str), str_len(str));
|
||||
|
||||
msg = t_strdup_printf("proxy(%s): started proxying to %s:%u",
|
||||
client->common.virtual_user,
|
16
mail/dovecot/patches/patch-src_imap_cmd-store_c
Normal file
16
mail/dovecot/patches/patch-src_imap_cmd-store_c
Normal file
@ -0,0 +1,16 @@
|
||||
$OpenBSD: patch-src_imap_cmd-store_c,v 1.1 2008/05/22 07:55:08 sthen Exp $
|
||||
--- src/imap/cmd-store.c.orig Sun May 18 22:36:46 2008
|
||||
+++ src/imap/cmd-store.c Sun May 18 22:37:13 2008
|
||||
@@ -86,6 +86,12 @@ bool cmd_store(struct client_command_context *cmd)
|
||||
if (search_arg == NULL)
|
||||
return TRUE;
|
||||
|
||||
+ if (mailbox_is_readonly(box)) {
|
||||
+ return cmd_sync(cmd, MAILBOX_SYNC_FLAG_FAST |
|
||||
+ (cmd->uid ? 0 : MAILBOX_SYNC_FLAG_NO_EXPUNGES),
|
||||
+ 0, "OK Store ignored with read-only mailbox.");
|
||||
+ }
|
||||
+
|
||||
t = mailbox_transaction_begin(box, !silent ? 0 :
|
||||
MAILBOX_TRANSACTION_FLAG_HIDE);
|
||||
keywords = keywords_list != NULL || modify_type == MODIFY_REPLACE ?
|
@ -0,0 +1,15 @@
|
||||
$OpenBSD: patch-src_lib-storage_index_index-mail_c,v 1.1 2008/05/22 07:55:08 sthen Exp $
|
||||
--- src/lib-storage/index/index-mail.c.orig Sun May 18 22:31:12 2008
|
||||
+++ src/lib-storage/index/index-mail.c Sun May 18 22:31:54 2008
|
||||
@@ -569,9 +569,8 @@ static void index_mail_parse_bodystructure(struct inde
|
||||
i_assert(data->parts->next == NULL);
|
||||
|
||||
old_offset = data->stream->v_offset;
|
||||
- i_stream_seek(data->stream,
|
||||
- data->hdr_size.physical_size);
|
||||
- message_parse_from_parts(data->parts->children,
|
||||
+ i_stream_seek(data->stream, 0);
|
||||
+ message_parse_from_parts(data->parts,
|
||||
data->stream,
|
||||
parse_bodystructure_part_header,
|
||||
mail->data_pool);
|
49
mail/dovecot/patches/patch-src_lib_randgen_c
Normal file
49
mail/dovecot/patches/patch-src_lib_randgen_c
Normal file
@ -0,0 +1,49 @@
|
||||
$OpenBSD: patch-src_lib_randgen_c,v 1.1 2008/05/22 07:55:08 sthen Exp $
|
||||
--- src/lib/randgen.c.orig Sun May 18 22:32:41 2008
|
||||
+++ src/lib/randgen.c Sun May 18 22:35:41 2008
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#ifdef HAVE_DEV_URANDOM
|
||||
|
||||
+#define URANDOM_PATH "/dev/urandom"
|
||||
+
|
||||
#include "fd-close-on-exec.h"
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
@@ -22,10 +24,16 @@ void random_fill(void *buf, size_t size)
|
||||
i_assert(init_refcount > 0);
|
||||
i_assert(size < SSIZE_T_MAX);
|
||||
|
||||
- for (pos = 0; pos < size; pos += ret) {
|
||||
+ for (pos = 0; pos < size; ) {
|
||||
ret = read(urandom_fd, (char *) buf + pos, size - pos);
|
||||
- if (ret < 0 && errno != EINTR)
|
||||
- i_fatal("Error reading from /dev/urandom: %m");
|
||||
+ if (ret <= 0) {
|
||||
+ if (ret == 0)
|
||||
+ i_fatal("EOF when reading from "URANDOM_PATH);
|
||||
+ else if (errno != EINTR)
|
||||
+ i_fatal("read("URANDOM_PATH") failed: %m");
|
||||
+ } else {
|
||||
+ pos += ret;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,13 +44,13 @@ void random_init(void)
|
||||
if (init_refcount++ > 0)
|
||||
return;
|
||||
|
||||
- urandom_fd = open("/dev/urandom", O_RDONLY);
|
||||
+ urandom_fd = open(URANDOM_PATH, O_RDONLY);
|
||||
if (urandom_fd == -1) {
|
||||
if (errno == ENOENT) {
|
||||
- i_fatal("/dev/urandom doesn't exist, "
|
||||
+ i_fatal(URANDOM_PATH" doesn't exist, "
|
||||
"currently we require it");
|
||||
} else {
|
||||
- i_fatal("Can't open /dev/urandom: %m");
|
||||
+ i_fatal("Can't open "URANDOM_PATH": %m");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,17 @@
|
||||
$OpenBSD: patch-src_login-common_ssl-proxy-openssl_c,v 1.1 2008/05/22 07:55:08 sthen Exp $
|
||||
--- src/login-common/ssl-proxy-openssl.c.orig Sun May 18 22:42:50 2008
|
||||
+++ src/login-common/ssl-proxy-openssl.c Sun May 18 22:43:22 2008
|
||||
@@ -307,8 +307,11 @@ static const char *ssl_last_error(void)
|
||||
size_t err_size = 256;
|
||||
|
||||
err = ERR_get_error();
|
||||
- if (err == 0)
|
||||
- return strerror(errno);
|
||||
+ if (err == 0) {
|
||||
+ if (errno != 0)
|
||||
+ return strerror(errno);
|
||||
+ return "Unknown error";
|
||||
+ }
|
||||
|
||||
buf = t_malloc(err_size);
|
||||
buf[err_size-1] = '\0';
|
12
mail/dovecot/patches/patch-src_plugins_acl_acl-cache_c
Normal file
12
mail/dovecot/patches/patch-src_plugins_acl_acl-cache_c
Normal file
@ -0,0 +1,12 @@
|
||||
$OpenBSD: patch-src_plugins_acl_acl-cache_c,v 1.1 2008/05/22 07:55:08 sthen Exp $
|
||||
--- src/plugins/acl/acl-cache.c.orig Sun May 18 22:41:57 2008
|
||||
+++ src/plugins/acl/acl-cache.c Sun May 18 22:42:17 2008
|
||||
@@ -63,6 +63,8 @@ void acl_cache_deinit(struct acl_cache **_cache)
|
||||
struct acl_cache *cache = *_cache;
|
||||
|
||||
*_cache = NULL;
|
||||
+
|
||||
+ acl_cache_flush_all(cache);
|
||||
array_free(&cache->right_idx_name_map);
|
||||
hash_destroy(cache->right_name_idx_map);
|
||||
hash_destroy(cache->objects);
|
13
mail/dovecot/patches/patch-src_pop3-login_pop3-proxy_c
Normal file
13
mail/dovecot/patches/patch-src_pop3-login_pop3-proxy_c
Normal file
@ -0,0 +1,13 @@
|
||||
$OpenBSD: patch-src_pop3-login_pop3-proxy_c,v 1.1 2008/05/22 07:55:08 sthen Exp $
|
||||
--- src/pop3-login/pop3-proxy.c.orig Sun May 18 22:40:47 2008
|
||||
+++ src/pop3-login/pop3-proxy.c Sun May 18 22:41:24 2008
|
||||
@@ -99,8 +99,8 @@ static void proxy_input(struct istream *input, struct
|
||||
break;
|
||||
|
||||
/* Login successful. Send this line to client. */
|
||||
+ line = t_strconcat(line, "\r\n", NULL);
|
||||
(void)o_stream_send_str(client->output, line);
|
||||
- (void)o_stream_send(client->output, "\r\n", 2);
|
||||
|
||||
msg = t_strdup_printf("proxy(%s): started proxying to %s:%u",
|
||||
client->common.virtual_user,
|
25
mail/dovecot/patches/patch-src_pop3_client_c
Normal file
25
mail/dovecot/patches/patch-src_pop3_client_c
Normal file
@ -0,0 +1,25 @@
|
||||
$OpenBSD: patch-src_pop3_client_c,v 1.5 2008/05/22 07:55:08 sthen Exp $
|
||||
--- src/pop3/client.c.orig Sun May 18 22:37:55 2008
|
||||
+++ src/pop3/client.c Sun May 18 22:38:38 2008
|
||||
@@ -231,11 +231,20 @@ static const char *client_stats(struct client *client)
|
||||
return str_c(str);
|
||||
}
|
||||
|
||||
+static const char *client_get_disconnect_reason(struct client *client)
|
||||
+{
|
||||
+ errno = client->input->stream_errno != 0 ?
|
||||
+ client->input->stream_errno :
|
||||
+ client->output->stream_errno;
|
||||
+ return errno == 0 || errno == EPIPE ? "Connection closed" :
|
||||
+ t_strdup_printf("Connection closed: %m");
|
||||
+}
|
||||
+
|
||||
void client_destroy(struct client *client, const char *reason)
|
||||
{
|
||||
if (!client->disconnected) {
|
||||
if (reason == NULL)
|
||||
- reason = "Disconnected";
|
||||
+ reason = client_get_disconnect_reason(client);
|
||||
i_info("%s %s", reason, client_stats(client));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user