diff --git a/src/lib-sieve/sieve-error.c b/src/lib-sieve/sieve-error.c index c2f1e628fb07612ebbf5b665d5ccc8a4edec7e36..51bf7e5b77767a96ecd2a325812e5616998acc3a 100644 --- a/src/lib-sieve/sieve-error.c +++ b/src/lib-sieve/sieve-error.c @@ -382,6 +382,7 @@ struct sieve_strbuf_ehandler { struct sieve_error_handler handler; string_t *errors; + bool crlf; }; static void sieve_strbuf_verror @@ -395,7 +396,11 @@ static void sieve_strbuf_verror str_printfa(handler->errors, "%s: ", location); str_append(handler->errors, "error: "); str_vprintfa(handler->errors, fmt, args); - str_append(handler->errors, ".\n"); + + if ( !handler->crlf ) + str_append(handler->errors, ".\n"); + else + str_append(handler->errors, ".\r\n"); } static void sieve_strbuf_vwarning @@ -409,7 +414,11 @@ static void sieve_strbuf_vwarning str_printfa(handler->errors, "%s: ", location); str_printfa(handler->errors, "warning: "); str_vprintfa(handler->errors, fmt, args); - str_append(handler->errors, ".\n"); + + if ( !handler->crlf ) + str_append(handler->errors, ".\n"); + else + str_append(handler->errors, ".\r\n"); } static void sieve_strbuf_vinfo @@ -423,11 +432,15 @@ static void sieve_strbuf_vinfo str_printfa(handler->errors, "%s: ", location); str_printfa(handler->errors, "info: "); str_vprintfa(handler->errors, fmt, args); - str_append(handler->errors, ".\n"); + + if ( !handler->crlf ) + str_append(handler->errors, ".\n"); + else + str_append(handler->errors, ".\r\n"); } struct sieve_error_handler *sieve_strbuf_ehandler_create -(string_t *strbuf, unsigned int max_errors) +(string_t *strbuf, bool crlf, unsigned int max_errors) { pool_t pool; struct sieve_strbuf_ehandler *ehandler; @@ -442,6 +455,8 @@ struct sieve_error_handler *sieve_strbuf_ehandler_create ehandler->handler.vwarning = sieve_strbuf_vwarning; ehandler->handler.vinfo = sieve_strbuf_vinfo; + ehandler->crlf = crlf; + return &(ehandler->handler); } diff --git a/src/lib-sieve/sieve-error.h b/src/lib-sieve/sieve-error.h index 4ee103e01c07344cd0d1b8e0e2c80add2635bc73..9dda4751721da0f8b7ba18b70850de072981b6c9 100644 --- a/src/lib-sieve/sieve-error.h +++ b/src/lib-sieve/sieve-error.h @@ -163,7 +163,7 @@ struct sieve_error_handler *sieve_stderr_ehandler_create /* Write errors into a string buffer */ struct sieve_error_handler *sieve_strbuf_ehandler_create - (string_t *strbuf, unsigned int max_errors); + (string_t *strbuf, bool crlf, unsigned int max_errors); /* Write errors to a logfile */ struct sieve_error_handler *sieve_logfile_ehandler_create