25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

Merge pull request #3660 from ballerburg9005/patch-1

"sort -R" command in captcha-ng.sh is not POSIX - added "shuf" and "cat" as fallback
This commit is contained in:
badlop 2021-08-16 13:16:43 +02:00 committed by GitHub
commit 8afc320aba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -42,7 +42,8 @@ INTRUDER()
{ {
NUMBERS=$(echo "$INPUT" | grep -o . | tr '\n' ' ') NUMBERS=$(echo "$INPUT" | grep -o . | tr '\n' ' ')
SORTED_UNIQ_NUM=$(echo "${NUMBERS[@]}" | sort -u | tr '\n' ' ') SORTED_UNIQ_NUM=$(echo "${NUMBERS[@]}" | sort -u | tr '\n' ' ')
RANDOM_DIGITS=$(echo 123456789 | grep -o . | sort -R | tr '\n' ' ') SORT_RANDOM_CMD="$( ( echo x|sort -R >&/dev/null && echo "sort -R" ) || ( echo x|shuf >&/dev/null && echo shuf ) || echo cat)"
RANDOM_DIGITS=$(echo 123456789 | grep -o . | eval "$SORT_RANDOM_CMD" | tr '\n' ' ')
INTRUDER=-1 INTRUDER=-1
for i in $RANDOM_DIGITS for i in $RANDOM_DIGITS