changeset 19814:79ca5c365eac

doveadm-http: Return HTTP failure on unexpected JSON input
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Mon, 22 Feb 2016 20:00:13 +0200
parents 7e9b5db56a85
children 6cbcdcbd9ad7
files src/doveadm/client-connection-http.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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