Fixes #546 & #560 - comments and new lines should not be parsed (#562)

* Fixes #546 & #560 - comments and new lines should not be parsed
This commit is contained in:
Thomas VIAL 2017-03-28 10:59:02 +02:00 committed by GitHub
parent fe8287f60a
commit 912cb5676b
3 changed files with 12 additions and 2 deletions

View File

@ -463,7 +463,7 @@ function _setup_dovecot_local_user() {
# Creating users
# 'pass' is encrypted
while IFS=$'|' read login pass
grep "^[a-z]" /tmp/docker-mailserver/postfix-accounts.cf | while IFS=$'|' read login pass
do
# Setting variables for better readability
user=$(echo ${login} | cut -d @ -f1)
@ -488,7 +488,7 @@ function _setup_dovecot_local_user() {
# Copy user provided sieve file, if present
test -e /tmp/docker-mailserver/${login}.dovecot.sieve && cp /tmp/docker-mailserver/${login}.dovecot.sieve /var/mail/${domain}/${user}/.dovecot.sieve
echo ${domain} >> /tmp/vhost.tmp
done < /tmp/docker-mailserver/postfix-accounts.cf
done
else
notify 'warn' "'config/docker-mailserver/postfix-accounts.cf' is not provided. No mail account created."
fi
@ -805,7 +805,10 @@ function _setup_postfix_override_configuration() {
if [ -f /tmp/docker-mailserver/postfix-main.cf ]; then
while read line; do
# line should start with a letter (avoid comments and new lines)
if [[ "$line" =~ ^[a-z] ]]; then
postconf -e "$line"
fi
done < /tmp/docker-mailserver/postfix-main.cf
notify 'inf' "Loaded 'config/postfix-main.cf'"
else

View File

@ -1,3 +1,5 @@
recipient_delimiter = ~
max_idle = 600s
# this is a comment
readme_directory = /tmp

View File

@ -346,6 +346,11 @@ load 'test_helper/bats-assert/load'
assert_output 7
}
@test "checking accounts: comments are not parsed" {
run docker exec mail /bin/bash -c "ls /var/mail | grep 'comment'"
assert_failure
}
#
# postfix
#