removed single quotes from -f argument to sendmail; fixes #2586
Costa Tsaousis (ktsaou) committed
Sep 5, 2017 at 23:50 UTC
7d725d589c4521980ccabdfbe961bf0336f1a935
1 file changed
+8
-4
plugins.d/alarm-notify.sh
+8
-4
@@ -730,15 +730,19 @@ send_email() {
730
then
731
if [[ "${EMAIL_SENDER}" =~ \".*\"\ \<.*\> ]]
732
then
733
- opts=" -f '$(echo "${EMAIL_SENDER}" | cut -d '<' -f 2 | cut -d '>' -f 1)' -F $(echo "${EMAIL_SENDER}" | cut -d '<' -f 1)"
733
+ # the name includes single quotes
734
+ opts=" -f $(echo "${EMAIL_SENDER}" | cut -d '<' -f 2 | cut -d '>' -f 1) -F $(echo "${EMAIL_SENDER}" | cut -d '<' -f 1)"
735
elif [[ "${EMAIL_SENDER}" =~ \'.*\'\ \<.*\> ]]
736
then
736
- opts=" -f '$(echo "${EMAIL_SENDER}" | cut -d '<' -f 2 | cut -d '>' -f 1)' -F $(echo "${EMAIL_SENDER}" | cut -d '<' -f 1)"
737
+ # the name includes double quotes
738
+ opts=" -f $(echo "${EMAIL_SENDER}" | cut -d '<' -f 2 | cut -d '>' -f 1) -F $(echo "${EMAIL_SENDER}" | cut -d '<' -f 1)"
739
elif [[ "${EMAIL_SENDER}" =~ .*\ \<.*\> ]]
740
then
739
- opts=" -f '$(echo "${EMAIL_SENDER}" | cut -d '<' -f 2 | cut -d '>' -f 1)' -F '$(echo "${EMAIL_SENDER}" | cut -d '<' -f 1)'"
741
+ # the name does not have any quotes
742
+ opts=" -f $(echo "${EMAIL_SENDER}" | cut -d '<' -f 2 | cut -d '>' -f 1) -F '$(echo "${EMAIL_SENDER}" | cut -d '<' -f 1)'"
743
else
741
- opts=" -f '${EMAIL_SENDER}'"
744
+ # no name at all
745
+ opts=" -f ${EMAIL_SENDER}"
746
fi
747
fi
748