Skip to content
Snippets Groups Projects
Commit 69cce444 authored by Timo Sirainen's avatar Timo Sirainen Committed by Stephan Bosch
Browse files

managesieve: Adjust to new o_stream_send_istream() API

parent b3f5d771
No related branches found
No related tags found
No related merge requests found
...@@ -16,7 +16,7 @@ struct cmd_getscript_context { ...@@ -16,7 +16,7 @@ struct cmd_getscript_context {
struct client *client; struct client *client;
struct client_command_context *cmd; struct client_command_context *cmd;
struct sieve_storage *storage; struct sieve_storage *storage;
uoff_t script_size, script_offset; uoff_t script_size;
struct sieve_script *script; struct sieve_script *script;
struct istream *script_stream; struct istream *script_stream;
...@@ -73,16 +73,14 @@ static bool cmd_getscript_continue(struct client_command_context *cmd) ...@@ -73,16 +73,14 @@ static bool cmd_getscript_continue(struct client_command_context *cmd)
return cmd_getscript_finish(ctx); return cmd_getscript_finish(ctx);
} }
ctx->script_offset += ret; if ( ctx->script_stream->v_offset != ctx->script_size && !ctx->failed ) {
if ( ctx->script_offset != ctx->script_size && !ctx->failed ) {
/* unfinished */ /* unfinished */
if ( !i_stream_have_bytes_left(ctx->script_stream) ) { if ( !i_stream_have_bytes_left(ctx->script_stream) ) {
/* Input stream gave less data than expected */ /* Input stream gave less data than expected */
sieve_storage_set_critical(ctx->storage, sieve_storage_set_critical(ctx->storage,
"GETSCRIPT for script `%s' from %s got too little data: " "GETSCRIPT for script `%s' from %s got too little data: "
"%"PRIuUOFF_T" vs %"PRIuUOFF_T, sieve_script_name(ctx->script), "%"PRIuUOFF_T" vs %"PRIuUOFF_T, sieve_script_name(ctx->script),
sieve_script_location(ctx->script), ctx->script_offset, ctx->script_size); sieve_script_location(ctx->script), ctx->script_stream->v_offset, ctx->script_size);
client_disconnect(ctx->client, "GETSCRIPT failed"); client_disconnect(ctx->client, "GETSCRIPT failed");
ctx->failed = TRUE; ctx->failed = TRUE;
...@@ -135,7 +133,7 @@ bool cmd_getscript(struct client_command_context *cmd) ...@@ -135,7 +133,7 @@ bool cmd_getscript(struct client_command_context *cmd)
return cmd_getscript_finish(ctx); return cmd_getscript_finish(ctx);
} }
ctx->script_offset = 0; i_assert(ctx->script_stream->v_offset == 0);
client_send_line client_send_line
(client, t_strdup_printf("{%"PRIuUOFF_T"}", ctx->script_size)); (client, t_strdup_printf("{%"PRIuUOFF_T"}", ctx->script_size));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.