[Postfix] Sanitize string in smtpd last login script with printf

master
andryyy 2020-11-06 12:23:23 +01:00
parent 4e337b308f
commit 9245bd8636
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF
1 changed files with 2 additions and 1 deletions

View File

@ -16,7 +16,8 @@ while read QUERY; do
echo -ne "action=dunno\n\n" echo -ne "action=dunno\n\n"
# We found a username, log and return # We found a username, log and return
elif [[ "${QUERY[0]}" =~ sasl_username ]]; then elif [[ "${QUERY[0]}" =~ sasl_username ]]; then
${REDIS_CMDLINE} SET "last-login/smtp/$(echo ${QUERY[0]#sasl_username=})" "$(date +%s)" MUSER=$(printf "%q" ${QUERY[0]#sasl_username=})
${REDIS_CMDLINE} SET "last-login/smtp/$MUSER" "$(date +%s)"
echo -ne "action=dunno\n\n" echo -ne "action=dunno\n\n"
fi fi
done done