dovecot-2.2-pigeonhole: managesieve: Changed managesieve parser'...

pigeonhole at rename-it.nl pigeonhole at rename-it.nl
Sun Oct 19 11:37:48 UTC 2014


details:   http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/bf2531a05b30
changeset: 1930:bf2531a05b30
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Sun Oct 19 13:10:27 2014 +0200
description:
managesieve: Changed managesieve parser's quoted string stream to use io_stream_set_error().

diffstat:

 src/managesieve-login/client-authenticate.c |  21 +++++++--------------
 src/managesieve/cmd-putscript.c             |  20 +++++++++-----------
 2 files changed, 16 insertions(+), 25 deletions(-)

diffs (68 lines):

diff -r e11f41c437a5 -r bf2531a05b30 src/managesieve-login/client-authenticate.c
--- a/src/managesieve-login/client-authenticate.c	Sun Oct 19 11:01:17 2014 +0200
+++ b/src/managesieve-login/client-authenticate.c	Sun Oct 19 13:10:27 2014 +0200
@@ -221,20 +221,13 @@
 	if ( ret == 0 ) return 0;
 
 	if ( msieve_client->auth_response_input->stream_errno != 0 ) {
-		if ( msieve_client->auth_response_input->stream_errno == EIO ) {
-			error = managesieve_parser_get_error(msieve_client->parser, &fatal);
-			if (error != NULL ) {
-				if (fatal) {
-					client_send_bye(client, error);
-					client_destroy(client, t_strconcat
-						("Disconnected: parse error during auth: ", error, NULL));
-				} else {
-					msieve_client->skip_line = TRUE;
-					*error_r = t_strconcat
-						("Error in AUTHENTICATE response string: ", error, NULL);
-				}
-				return -1;
-			}
+		if ( !client->input->eof &&
+			msieve_client->auth_response_input->stream_errno == EINVAL ) {
+			msieve_client->skip_line = TRUE;
+			*error_r = t_strconcat
+				("Error in AUTHENTICATE response string: ",
+					i_stream_get_error(msieve_client->auth_response_input), NULL);
+			return -1;
 		}
 
 		client_destroy(client, "Disconnected");
diff -r e11f41c437a5 -r bf2531a05b30 src/managesieve/cmd-putscript.c
--- a/src/managesieve/cmd-putscript.c	Sun Oct 19 11:01:17 2014 +0200
+++ b/src/managesieve/cmd-putscript.c	Sun Oct 19 13:10:27 2014 +0200
@@ -356,7 +356,9 @@
 			}
 
 			ret = i_stream_read(ctx->input);
-			if (sieve_storage_save_continue(ctx->save_ctx) < 0) {
+			if ((ret != -1 || ctx->input->stream_errno != EINVAL ||
+				client->input->eof) &&
+				sieve_storage_save_continue(ctx->save_ctx) < 0) {
 				/* we still have to finish reading the script
 			   	  from client */
 				sieve_storage_save_cancel(&ctx->save_ctx);
@@ -378,16 +380,12 @@
 		bool all_written = FALSE;
 
 		if ( ctx->script_size == 0 ) {
-			if ( ctx->input->stream_errno == EIO ) {
-				bool fatal;
-				const char *parse_error;
-
-				parse_error = managesieve_parser_get_error(ctx->save_parser, &fatal);
-				if ( parse_error != NULL) {
-					client_send_command_error(cmd, parse_error);
-					client->input_skip_line = TRUE;
-					failed = TRUE;
-				}
+			if ( !client->input->eof &&
+				ctx->input->stream_errno == EINVAL ) {
+				client_send_command_error(cmd, t_strdup_printf(
+					"Invalid input: %s", i_stream_get_error(ctx->input)));
+				client->input_skip_line = TRUE;
+				failed = TRUE;
 			}
 			all_written = ( ctx->input->eof && ctx->input->stream_errno == 0 );
 


More information about the dovecot-cvs mailing list