# HG changeset patch # User Timo Sirainen # Date 1456164013 -7200 # Node ID 79ca5c365eac2a099928ec158b228541cc89bf24 # Parent 7e9b5db56a857813074cd070a97ca05f4273fe5a doveadm-http: Return HTTP failure on unexpected JSON input diff -r 7e9b5db56a85 -r 79ca5c365eac src/doveadm/client-connection-http.c --- a/src/doveadm/client-connection-http.c Mon Feb 22 19:56:35 2016 +0200 +++ b/src/doveadm/client-connection-http.c Mon Feb 22 20:00:13 2016 +0200 @@ -462,7 +462,7 @@ 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