mirror of https://github.com/Icinga/icinga2.git
Strip '\r' in notification messages to avoid 'Content-Type: application/octet-stream'
Without this patch, an accidential `\r` in e.g. `$NOTIFICATIONCOMMENT` leads to a `Content-Type: application/octet-stream` header in e-mails. The accidential `\r` might slip in usually using Icinga/Nagios apps...
This commit is contained in:
parent
cb945feb19
commit
90d08faa9c
|
@ -165,13 +165,15 @@ if [ -n "$MAILFROM" ] ; then
|
||||||
|
|
||||||
## Debian/Ubuntu use mailutils which requires `-a` to append the header
|
## Debian/Ubuntu use mailutils which requires `-a` to append the header
|
||||||
if [ -f /etc/debian_version ]; then
|
if [ -f /etc/debian_version ]; then
|
||||||
/usr/bin/printf "%b" "$NOTIFICATION_MESSAGE" | $MAILBIN -a "From: $MAILFROM" -s "$SUBJECT" $USEREMAIL
|
/usr/bin/printf "%b" "$NOTIFICATION_MESSAGE" | tr -d '\015' \
|
||||||
|
| $MAILBIN -a "From: $MAILFROM" -s "$SUBJECT" $USEREMAIL
|
||||||
## Other distributions (RHEL/SUSE/etc.) prefer mailx which sets a sender address with `-r`
|
## Other distributions (RHEL/SUSE/etc.) prefer mailx which sets a sender address with `-r`
|
||||||
else
|
else
|
||||||
/usr/bin/printf "%b" "$NOTIFICATION_MESSAGE" | $MAILBIN -r "$MAILFROM" -s "$SUBJECT" $USEREMAIL
|
/usr/bin/printf "%b" "$NOTIFICATION_MESSAGE" | tr -d '\015' \
|
||||||
|
| $MAILBIN -r "$MAILFROM" -s "$SUBJECT" $USEREMAIL
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
/usr/bin/printf "%b" "$NOTIFICATION_MESSAGE" \
|
/usr/bin/printf "%b" "$NOTIFICATION_MESSAGE" | tr -d '\015' \
|
||||||
| $MAILBIN -s "$SUBJECT" $USEREMAIL
|
| $MAILBIN -s "$SUBJECT" $USEREMAIL
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -178,13 +178,15 @@ if [ -n "$MAILFROM" ] ; then
|
||||||
|
|
||||||
## Debian/Ubuntu use mailutils which requires `-a` to append the header
|
## Debian/Ubuntu use mailutils which requires `-a` to append the header
|
||||||
if [ -f /etc/debian_version ]; then
|
if [ -f /etc/debian_version ]; then
|
||||||
/usr/bin/printf "%b" "$NOTIFICATION_MESSAGE" | $MAILBIN -a "From: $MAILFROM" -s "$SUBJECT" $USEREMAIL
|
/usr/bin/printf "%b" "$NOTIFICATION_MESSAGE" | tr -d '\015' \
|
||||||
|
| $MAILBIN -a "From: $MAILFROM" -s "$SUBJECT" $USEREMAIL
|
||||||
## Other distributions (RHEL/SUSE/etc.) prefer mailx which sets a sender address with `-r`
|
## Other distributions (RHEL/SUSE/etc.) prefer mailx which sets a sender address with `-r`
|
||||||
else
|
else
|
||||||
/usr/bin/printf "%b" "$NOTIFICATION_MESSAGE" | $MAILBIN -r "$MAILFROM" -s "$SUBJECT" $USEREMAIL
|
/usr/bin/printf "%b" "$NOTIFICATION_MESSAGE" | tr -d '\015' \
|
||||||
|
| $MAILBIN -r "$MAILFROM" -s "$SUBJECT" $USEREMAIL
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
/usr/bin/printf "%b" "$NOTIFICATION_MESSAGE" \
|
/usr/bin/printf "%b" "$NOTIFICATION_MESSAGE" | tr -d '\015' \
|
||||||
| $MAILBIN -s "$SUBJECT" $USEREMAIL
|
| $MAILBIN -s "$SUBJECT" $USEREMAIL
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue