mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2024-01-19 02:48:50 +00:00
* fix password with spaces is stripped to first word
This commit is contained in:
parent
f28e9843ce
commit
2e06228b10
|
@ -28,5 +28,5 @@ if [ -z "$PASSWD" ]; then
|
|||
echo
|
||||
[ -z "$PASSWD" ] && errex "Password must not be empty"
|
||||
fi
|
||||
|
||||
echo "$USER|$(doveadm pw -s SHA512-CRYPT -u "$USER" -p "$PASSWD")" >>$DATABASE
|
||||
HASH="$(doveadm pw -s SHA512-CRYPT -u "$USER" -p "$PASSWD")"
|
||||
echo "$USER|$HASH" >> $DATABASE
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
DATABASE=${DATABASE:-/tmp/docker-mailserver/postfix-accounts.cf}
|
||||
|
||||
USER="$1"
|
||||
PASSWD=$(doveadm pw -s SHA512-CRYPT -u "$USER" -p "$2")
|
||||
PASSWD="$(doveadm pw -s SHA512-CRYPT -u "$USER" -p "$2")"
|
||||
|
||||
usage() {
|
||||
echo "Usage: updatemailuser <user@domain.tld> [password]"
|
||||
|
@ -23,4 +23,3 @@ escape() {
|
|||
grep -qi "^$(escape "$USER")|" $DATABASE 2>/dev/null ||
|
||||
errex "User \"$USER\" does not exist"
|
||||
sed -i "s ^"$USER"|.* "$USER"|"$PASSWD" " $DATABASE
|
||||
#sed -i "s/^"$(escape "$USER")"|*/"$USER"|"$(doveadm pw -s SHA512-CRYPT -u "$USER" -p "$PASSWD")"/" $DATABASE
|
||||
|
|
|
@ -1188,17 +1188,34 @@ load 'test_helper/bats-assert/load'
|
|||
assert_success
|
||||
value=$(cat ./config/postfix-accounts.cf | grep lorem@impsum.org | awk -F '|' '{print $1}')
|
||||
[ "$value" = "lorem@impsum.org" ]
|
||||
|
||||
# don't know why, but the test suite needs to delete the (non existant) user prior succeeding in adding him again.
|
||||
# when executed directly against the container this workaround is not neccessary.
|
||||
run docker exec mail delmailuser -y pass@localhorst.localdomain
|
||||
assert_success
|
||||
docker exec mail addmailuser pass@localhost.localdomain 'may be \a `p^a.*ssword'
|
||||
sleep 30
|
||||
docker exec mail doveadm auth test -x service=smtp pass@localhost.localdomain 'may be \a `p^a.*ssword' | grep 'auth succeeded'
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "checking setup.sh: setup.sh email list" {
|
||||
run ./setup.sh -c mail email list
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "checking setup.sh: setup.sh email update" {
|
||||
initialpass=$(cat ./config/postfix-accounts.cf | grep lorem@impsum.org | awk -F '|' '{print $2}')
|
||||
run ./setup.sh -c mail email update lorem@impsum.org consectetur
|
||||
updatepass=$(cat ./config/postfix-accounts.cf | grep lorem@impsum.org | awk -F '|' '{print $2}')
|
||||
[ "$initialpass" != "$changepass" ]
|
||||
|
||||
docker exec mail /bin/sh -c "updatemailuser pass@localhost.localdomain 'my other password'"
|
||||
sleep 30
|
||||
docker exec mail /bin/sh -c "doveadm auth test -x service=smtp pass@localhost.localdomain 'my other password' | grep 'auth succeeded'"
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "checking setup.sh: setup.sh email del" {
|
||||
run ./setup.sh -c mail email del -y lorem@impsum.org
|
||||
assert_success
|
||||
|
@ -1243,7 +1260,6 @@ load 'test_helper/bats-assert/load'
|
|||
run /bin/sh -c 'cat ./config/postfix-virtual.cf | grep "test1@example.org test1@forward.com,test2@forward.com" | wc -l | grep 1'
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "checking setup.sh: setup.sh alias del" {
|
||||
echo -e 'test1@example.org test1@forward.com,test2@forward.com\ntest2@example.org test1@forward.com' > ./config/postfix-virtual.cf
|
||||
|
||||
|
|
Loading…
Reference in a new issue