mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
Bugfix: './setup.sh email list' does not display aliases correctly (#2881)
This commit is contained in:
parent
5f671a4c0b
commit
69aef2e94f
|
@ -87,18 +87,27 @@ function _bytes_to_human_readable_size
|
||||||
# Returns a comma delimited list of aliases associated to a recipient (ideally the recipient is a mail account):
|
# Returns a comma delimited list of aliases associated to a recipient (ideally the recipient is a mail account):
|
||||||
function _alias_list_for_account
|
function _alias_list_for_account
|
||||||
{
|
{
|
||||||
|
local GREP_OPTIONS
|
||||||
local MAIL_ACCOUNT=${1}
|
local MAIL_ACCOUNT=${1}
|
||||||
|
|
||||||
# `__db_list_already_contains_value` would be a more reliable check:
|
# postfix-virtual.cf sample lines:
|
||||||
function _account_has_an_alias
|
#
|
||||||
{
|
# all@example.com foo@example.com
|
||||||
local ANY_ALIAS='\S\+\s'
|
# all@example.com foo@example.com,another@example.com
|
||||||
grep -qis "^${ANY_ALIAS}.*${MAIL_ACCOUNT}" "${DATABASE_VIRTUAL}"
|
# all@example.com another@example.com,foo@example.com,yetanother@example.com
|
||||||
}
|
# all@example.com another@example.com,foo@example.com
|
||||||
|
|
||||||
if _account_has_an_alias
|
GREP_OPTIONS=(
|
||||||
|
--ignore-case
|
||||||
|
--extended-regexp
|
||||||
|
-e "\s${MAIL_ACCOUNT}($|,)" # match first and second sample line
|
||||||
|
-e ",${MAIL_ACCOUNT}($|,)" # match third and fourth sample line
|
||||||
|
"${DATABASE_VIRTUAL}"
|
||||||
|
)
|
||||||
|
|
||||||
|
if grep --quiet --no-messages "${GREP_OPTIONS[@]}"
|
||||||
then
|
then
|
||||||
grep "${MAIL_ACCOUNT}" "${DATABASE_VIRTUAL}" | awk '{print $1;}' | sed ':a;N;$!ba;s/\n/, /g'
|
grep "${GREP_OPTIONS[@]}" | awk '{print $1;}' | sed ':a;N;$!ba;s/\n/, /g'
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue