diff --git a/mail-toaster.sh b/mail-toaster.sh index 5c8c9a49..487cfca7 100755 --- a/mail-toaster.sh +++ b/mail-toaster.sh @@ -1360,7 +1360,7 @@ get_random_pass() if [ -z "$2" ]; then # default, good, limited by base64 charset - openssl rand -base64 $(echo "$_pass_len + 4" | bc) | head -c "$_pass_len" + openssl rand -base64 "$(echo "$_pass_len + 4" | bc)" | head -c "$_pass_len" else # https://unix.stackexchange.com/questions/230673/how-to-generate-a-random-string # more entropy with 94 ASCII chars but special chars are often problematic diff --git a/test/mail-toaster.bats b/test/mail-toaster.bats index a2e96958..1ce76ef4 100644 --- a/test/mail-toaster.bats +++ b/test/mail-toaster.bats @@ -56,3 +56,10 @@ setup() { assert_success assert_output --partial "Success! A new 'test' jail is provisioned" } + +@test "get_random_pass" { + run get_random_pass 15 + assert_success + echo "# $output" >&3 + #assert_output --partial "" +}