]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm-http: Return HTTP failure on unexpected JSON input
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 22 Feb 2016 18:00:13 +0000 (20:00 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 22 Feb 2016 18:00:13 +0000 (20:00 +0200)
src/doveadm/client-connection-http.c

index 6fcf21a7a5ec989911d2e963169e71a8a9671ac4..3788d7a67993b08ee183301ae9034be60e0c0312 100644 (file)
@@ -462,7 +462,7 @@ doveadm_http_server_read_request(struct client_connection_http *conn)
        if (!conn->client.input->eof && rc == 0)
                return;
 
-       if ((rc == 1 && conn->json_state != JSON_STATE_DONE)) {
+       if (rc == -2 || (rc == 1 && conn->json_state != JSON_STATE_DONE)) {
                /* this will happen if the parser above runs into unexpected element, but JSON is OK */
                http_server_request_fail_close(conn->http_server_request, 400, "Unexpected element in input");
                // FIXME: should be returned as error to client, not logged