]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: GETMETADATA: If i_stream_get_size() fails, send client an internal error line
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 24 Jul 2019 12:36:03 +0000 (15:36 +0300)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Tue, 10 Sep 2019 07:02:10 +0000 (10:02 +0300)
Previously the client didn't get any kind of an explanation why the
GETMETADATA failed.

src/imap/cmd-getmetadata.c

index 7dbc59e86fe5685159e6adfedd505e825b5bc677..13b2677e640158b93947251989ba08ee851d6e7c 100644 (file)
@@ -146,6 +146,15 @@ cmd_getmetadata_send_nil_reply(struct imap_getmetadata_context *ctx,
        o_stream_nsend(ctx->cmd->client->output, str_data(str), str_len(str));
 }
 
+static void
+cmd_getmetadata_handle_error_str(struct imap_getmetadata_context *ctx,
+                                const char *error_string,
+                                enum mail_error error)
+{
+       str_printfa(ctx->delayed_errors, "* NO %s\r\n", error_string);
+       ctx->last_error = error;
+}
+
 static bool
 cmd_getmetadata_handle_error(struct imap_getmetadata_context *ctx,
                             bool entry_error)
@@ -160,8 +169,7 @@ cmd_getmetadata_handle_error(struct imap_getmetadata_context *ctx,
                return FALSE;
        }
 
-       str_printfa(ctx->delayed_errors, "* NO %s\r\n", error_string);
-       ctx->last_error = error;
+       cmd_getmetadata_handle_error_str(ctx, error_string, error);
        return TRUE;
 }
 
@@ -186,7 +194,8 @@ static void cmd_getmetadata_send_entry(struct imap_getmetadata_context *ctx,
                                i_stream_get_name(value.value_stream),
                                i_stream_get_error(value.value_stream));
                        i_stream_unref(&value.value_stream);
-                       ctx->last_error = MAIL_ERROR_TEMP;
+                       cmd_getmetadata_handle_error_str(ctx,
+                               MAIL_ERRSTR_CRITICAL_MSG, MAIL_ERROR_TEMP);
                        return;
                }
        } else {