]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: don't crash when pop3c-client timeouts
authorMartti Rannanjärvi <martti.rannanjarvi@dovecot.fi>
Wed, 10 Aug 2016 12:40:23 +0000 (15:40 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 15 Aug 2016 13:24:07 +0000 (16:24 +0300)
src/lib-storage/index/pop3c/pop3c-client.c

index 9388568de6322b00819c5cb82fc4d9d29fb8bb75..0b5081e65d7a38a75f2c0bafc23845c226696a1a 100644 (file)
@@ -871,6 +871,11 @@ int pop3c_client_cmd_stream(struct pop3c_client *client, const char *cmdline,
        struct pop3c_client_sync_cmd_ctx ctx;
        const char *reply;
 
+       if (client->state == POP3C_CLIENT_STATE_DISCONNECTED) {
+               *error_r = "Disconnected from server";
+               return -1;
+       }
+
        memset(&ctx, 0, sizeof(ctx));
        *input_r = pop3c_client_cmd_stream_async(client, cmdline,
                                                 pop3c_client_cmd_reply, &ctx);