]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm: fix who/kick out of order response
authorBjørnar Ness <bjornar.ness@gmail.com>
Tue, 17 Apr 2018 14:04:02 +0000 (16:04 +0200)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Tue, 10 Sep 2019 07:01:20 +0000 (10:01 +0300)
doveadm-who and kick did not properly flush protocol output
after doveadm_print(), this caused out-of-order response to
clients, example:

C: <tab><tab>who<crlf>
S: +<crlf>
S: username<tab>[...]<missing_crlf>

correct response should have been
S: <username><tab>[...]<crlf>
S: +<crlf>

fixed by adding doveadm_print_flush() calls.

src/doveadm/doveadm-kick.c
src/doveadm/doveadm-who.c

index 6db1bf77cc1e54de8cd6b73973d7e504d30f73f1..a0b06f38af2e0dd243f446afc36efc9db4caecc6 100644 (file)
@@ -126,6 +126,9 @@ kick_print_kicked(struct kick_context *ctx, const bool show_warning)
                if (strcmp(users[i-1], users[i]) != 0)
                        doveadm_print(users[i]);
        }
+
+       doveadm_print_flush();
+
        if (cli)
                printf("\n");
 
index ef62d2b6d427b47fa8ba9a9a775bdcba3217bd71..3b9034d3f1dd5a33f99e7ffd21e2a8bed212bc1d 100644 (file)
@@ -256,6 +256,8 @@ static void who_print_user(const struct who_user *user)
                str_truncate(str, str_len(str)-1);
        str_append_c(str, ')');
        doveadm_print(str_c(str));
+
+       doveadm_print_flush();
 }
 
 static void who_print(struct who_context *ctx)