fixes from upstream via Brad;

- Fixed setgid() failure error message.
- imap: If selecting a mailbox fails, close the already selected mailbox.
This commit is contained in:
sthen 2010-09-17 13:11:14 +00:00
parent f5c3e21f06
commit 3fc4111f2c
3 changed files with 94 additions and 1 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.147 2010/08/27 08:27:15 sthen Exp $
# $OpenBSD: Makefile,v 1.148 2010/09/17 13:11:14 sthen Exp $
SHARED_ONLY= Yes
@ -12,6 +12,7 @@ V_MANAGESIEVE= 0.11.11
PKGNAME= dovecot-${V_DOVECOT}
PKGNAME-server= dovecot-${V_DOVECOT}
REVISION-server=0
FULLPKGNAME-sieve= dovecot-sieve-${V_SIEVE}
REVISION-sieve= 2
EPOCH-sieve= 0

View File

@ -0,0 +1,80 @@
$OpenBSD: patch-src_imap_cmd-select_c,v 1.3 2010/09/17 13:11:14 sthen Exp $
--- src/imap/cmd-select.c.orig Mon Aug 23 10:37:53 2010
+++ src/imap/cmd-select.c Mon Sep 6 17:06:13 2010
@@ -327,10 +327,28 @@ select_open(struct imap_select_context *ctx, const cha
return 0;
}
+static void close_selected_mailbox(struct client *client)
+{
+ struct mail_storage *old_storage;
+ struct mailbox *box;
+
+ if (client->mailbox == NULL)
+ return;
+
+ old_storage = mailbox_get_storage(client->mailbox);
+ client_search_updates_free(client);
+ box = client->mailbox;
+ client->mailbox = NULL;
+
+ if (mailbox_close(&box) < 0)
+ client_send_untagged_storage_error(client, old_storage);
+ /* CLOSED response is required by QRESYNC */
+ client_send_line(client, "* OK [CLOSED] Previous mailbox closed.");
+}
+
bool cmd_select_full(struct client_command_context *cmd, bool readonly)
{
struct client *client = cmd->client;
- struct mailbox *box;
struct imap_select_context *ctx;
const struct imap_arg *args;
const char *mailbox;
@@ -342,6 +360,7 @@ bool cmd_select_full(struct client_command_context *cm
if (!IMAP_ARG_TYPE_IS_STRING(args[0].type)) {
client_send_command_error(cmd, "Invalid arguments.");
+ close_selected_mailbox(client);
return FALSE;
}
mailbox = IMAP_ARG_STR(&args[0]);
@@ -349,12 +368,15 @@ bool cmd_select_full(struct client_command_context *cm
ctx = p_new(cmd->pool, struct imap_select_context, 1);
ctx->cmd = cmd;
ctx->storage = client_find_storage(cmd, &mailbox);
- if (ctx->storage == NULL)
+ if (ctx->storage == NULL) {
+ close_selected_mailbox(client);
return TRUE;
+ }
if (args[1].type == IMAP_ARG_LIST) {
if (!select_parse_options(ctx, IMAP_ARG_LIST_ARGS(&args[1]))) {
select_context_free(ctx);
+ close_selected_mailbox(client);
return TRUE;
}
}
@@ -362,20 +384,7 @@ bool cmd_select_full(struct client_command_context *cm
i_assert(client->mailbox_change_lock == NULL);
client->mailbox_change_lock = cmd;
- if (client->mailbox != NULL) {
- struct mail_storage *old_storage =
- mailbox_get_storage(client->mailbox);
-
- client_search_updates_free(client);
- box = client->mailbox;
- client->mailbox = NULL;
-
- if (mailbox_close(&box) < 0)
- client_send_untagged_storage_error(client, old_storage);
- /* CLOSED response is required by QRESYNC */
- client_send_line(client,
- "* OK [CLOSED] Previous mailbox closed.");
- }
+ close_selected_mailbox(client);
if (ctx->condstore) {
/* Enable while no mailbox is opened to avoid sending

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-src_lib_restrict-access_c,v 1.1 2010/09/17 13:11:14 sthen Exp $
--- src/lib/restrict-access.c.orig Mon Sep 6 17:04:04 2010
+++ src/lib/restrict-access.c Mon Sep 6 17:05:16 2010
@@ -98,7 +98,7 @@ static void restrict_init_groups(gid_t primary_gid, gi
"process group set to %s instead of %s)",
get_gid_str(primary_gid), get_uid_str(geteuid()),
get_gid_str(getgid()), get_gid_str(getegid()),
- get_gid_str(primary_gid), get_uid_str(geteuid()));
+ get_gid_str(primary_gid), get_gid_str(getegid()));
}
return;
}