brian m. carlson
2016-Nov-27 00:17 UTC
[Logcheck-devel] [PATCH] src/logcheck: let mime-construct pick the encoding
Several places in the logcheck script used --encoding 7bit, but in nearly all these places, it's possible to have data (such as log entries) that contain UTF-8 or other 8bit data. Furthermore, the logs could potentially even contain lines exceeding 998 octets, which would require encoding. The mime-construct documentation states that it will pick the correct encoding if the option isn't specified, so let it do that. This fixes delivery to mail servers that are strict about MIME encoding. --- I'm not subscribed, so please CC me if you have any comments or feedback. src/logcheck | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/logcheck b/src/logcheck index a8d2d02e..c7bd81a2 100755 --- a/src/logcheck +++ b/src/logcheck @@ -175,7 +175,7 @@ Also verify that the logcheck user can read all files referenced in $(export) EOF } | eval mime-construct $MIMECONSTRUCTARGS \ - --subject "'Logcheck: $HOSTNAME $DATE exiting due to errors'" --encoding "7bit" \ + --subject "'Logcheck: $HOSTNAME $DATE exiting due to errors'" \ --file - --to "$SENDMAILTO" elif [ "$MAILOUT" -eq 1 ]; then @@ -302,14 +302,14 @@ sendreport() { debug "Sending report: '$subject' to $SENDMAILTO" if [ "$MAILASATTACH" -eq 1 ]; then debug "Sending report as attachment" - eval mime-construct $MIMECONSTRUCTARGS --subject "'$subject'" --encoding "7bit" --string "'Report attached'" --to "$SENDMAILTO" --attachment "logcheck_report" --encoding "7bit" --file "$TMPDIR/report" + eval mime-construct $MIMECONSTRUCTARGS --subject "'$subject'" --string "'Report attached'" --to "$SENDMAILTO" --attachment "logcheck_report" --file "$TMPDIR/report" return $? elif [ "$MAILASATTACH" -eq 2 ]; then debug "Sending report as gzip attachment" - eval mime-construct $MIMECONSTRUCTARGS --subject "'$subject'" --encoding "7bit" --string "'Report attached'" --to "$SENDMAILTO" --type "application/x-gzip" --attachment "logcheck_report.gz" --file "'gzip -c $TMPDIR/report |'" + eval mime-construct $MIMECONSTRUCTARGS --subject "'$subject'" --string "'Report attached'" --to "$SENDMAILTO" --type "application/x-gzip" --attachment "logcheck_report.gz" --file "'gzip -c $TMPDIR/report |'" return $? fi - eval mime-construct $MIMECONSTRUCTARGS --subject "'$subject'" --to "$SENDMAILTO" --encoding "7bit" --file "$TMPDIR/report" + eval mime-construct $MIMECONSTRUCTARGS --subject "'$subject'" --to "$SENDMAILTO" --file "$TMPDIR/report" fi } -- 2.11.0.rc1.160.g51e66c2