mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Change captcha.sh to not depend on bash (thanks to Konstantin Khomoutov)(EJAB-1105)
SVN Revision: 2749
This commit is contained in:
parent
1716b090f9
commit
7fd3d67ff3
@ -351,7 +351,7 @@ GNU Make
|
|||||||
</LI><LI CLASS="li-itemize">Erlang pgsql library. Optional. For PostgreSQL authentication or storage. See section <A HREF="#compilepgsql">3.2.3</A>.
|
</LI><LI CLASS="li-itemize">Erlang pgsql library. Optional. For PostgreSQL authentication or storage. See section <A HREF="#compilepgsql">3.2.3</A>.
|
||||||
</LI><LI CLASS="li-itemize">PAM library. Optional. For Pluggable Authentication Modules (PAM). See section <A HREF="#pam">3.1.4</A>.
|
</LI><LI CLASS="li-itemize">PAM library. Optional. For Pluggable Authentication Modules (PAM). See section <A HREF="#pam">3.1.4</A>.
|
||||||
</LI><LI CLASS="li-itemize">GNU Iconv 1.8 or higher, for the IRC Transport (mod_irc). Optional. Not needed on systems with GNU Libc. See section <A HREF="#modirc">3.3.8</A>.
|
</LI><LI CLASS="li-itemize">GNU Iconv 1.8 or higher, for the IRC Transport (mod_irc). Optional. Not needed on systems with GNU Libc. See section <A HREF="#modirc">3.3.8</A>.
|
||||||
</LI><LI CLASS="li-itemize">ImageMagick’s Convert program, and Bash. Optional. For CAPTCHA challenges. See section <A HREF="#captcha">3.1.8</A>.
|
</LI><LI CLASS="li-itemize">ImageMagick’s Convert program. Optional. For CAPTCHA challenges. See section <A HREF="#captcha">3.1.8</A>.
|
||||||
</LI><LI CLASS="li-itemize">exmpp 0.9.1 or higher. Optional. For import/export user data with <A HREF="http://xmpp.org/extensions/xep-0227.html">XEP-0227</A> XML files.
|
</LI><LI CLASS="li-itemize">exmpp 0.9.1 or higher. Optional. For import/export user data with <A HREF="http://xmpp.org/extensions/xep-0227.html">XEP-0227</A> XML files.
|
||||||
</LI></UL><P> <A NAME="download"></A> </P><!--TOC subsection Download Source Code-->
|
</LI></UL><P> <A NAME="download"></A> </P><!--TOC subsection Download Source Code-->
|
||||||
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc10">2.4.2</A>  <A HREF="#download">Download Source Code</A></H3><!--SEC END --><P> <A NAME="download"></A>
|
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc10">2.4.2</A>  <A HREF="#download">Download Source Code</A></H3><!--SEC END --><P> <A NAME="download"></A>
|
||||||
@ -1243,7 +1243,7 @@ In order to take effect there must be a translation file
|
|||||||
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc29">3.1.8</A>  <A HREF="#captcha">CAPTCHA</A></H3><!--SEC END --><P> <A NAME="captcha"></A>
|
<H3 CLASS="subsection"><!--SEC ANCHOR --><A NAME="htoc29">3.1.8</A>  <A HREF="#captcha">CAPTCHA</A></H3><!--SEC END --><P> <A NAME="captcha"></A>
|
||||||
</P><P>Some <TT>ejabberd</TT> modules can be configured to require a CAPTCHA challenge on certain actions.
|
</P><P>Some <TT>ejabberd</TT> modules can be configured to require a CAPTCHA challenge on certain actions.
|
||||||
If the client does not support CAPTCHA Forms (<A HREF="http://xmpp.org/extensions/xep-0158.html">XEP-0158</A>),
|
If the client does not support CAPTCHA Forms (<A HREF="http://xmpp.org/extensions/xep-0158.html">XEP-0158</A>),
|
||||||
a web link is provided so the user can fill the challenge in a web browser.</P><P>An example Bash script is provided that generates the image
|
a web link is provided so the user can fill the challenge in a web browser.</P><P>An example script is provided that generates the image
|
||||||
using ImageMagick’s Convert program.</P><P>The configurable options are:
|
using ImageMagick’s Convert program.</P><P>The configurable options are:
|
||||||
</P><DL CLASS="description"><DT CLASS="dt-description">
|
</P><DL CLASS="description"><DT CLASS="dt-description">
|
||||||
<B><TT>{captcha_cmd, Path}</TT></B></DT><DD CLASS="dd-description">
|
<B><TT>{captcha_cmd, Path}</TT></B></DT><DD CLASS="dd-description">
|
||||||
|
@ -315,7 +315,7 @@ To compile \ejabberd{} on a `Unix-like' operating system, you need:
|
|||||||
\item Erlang pgsql library. Optional. For PostgreSQL authentication or storage. See section \ref{compilepgsql}.
|
\item Erlang pgsql library. Optional. For PostgreSQL authentication or storage. See section \ref{compilepgsql}.
|
||||||
\item PAM library. Optional. For Pluggable Authentication Modules (PAM). See section \ref{pam}.
|
\item PAM library. Optional. For Pluggable Authentication Modules (PAM). See section \ref{pam}.
|
||||||
\item GNU Iconv 1.8 or higher, for the IRC Transport (mod\_irc). Optional. Not needed on systems with GNU Libc. See section \ref{modirc}.
|
\item GNU Iconv 1.8 or higher, for the IRC Transport (mod\_irc). Optional. Not needed on systems with GNU Libc. See section \ref{modirc}.
|
||||||
\item ImageMagick's Convert program, and Bash. Optional. For CAPTCHA challenges. See section \ref{captcha}.
|
\item ImageMagick's Convert program. Optional. For CAPTCHA challenges. See section \ref{captcha}.
|
||||||
\item exmpp 0.9.1 or higher. Optional. For import/export user data with \xepref{0227} XML files.
|
\item exmpp 0.9.1 or higher. Optional. For import/export user data with \xepref{0227} XML files.
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
|
|
||||||
@ -1546,7 +1546,7 @@ Some \ejabberd{} modules can be configured to require a CAPTCHA challenge on cer
|
|||||||
If the client does not support CAPTCHA Forms (\xepref{0158}),
|
If the client does not support CAPTCHA Forms (\xepref{0158}),
|
||||||
a web link is provided so the user can fill the challenge in a web browser.
|
a web link is provided so the user can fill the challenge in a web browser.
|
||||||
|
|
||||||
An example Bash script is provided that generates the image
|
An example script is provided that generates the image
|
||||||
using ImageMagick's Convert program.
|
using ImageMagick's Convert program.
|
||||||
|
|
||||||
The configurable options are:
|
The configurable options are:
|
||||||
|
@ -1,35 +1,70 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
INPUT=$1
|
INPUT=$1
|
||||||
|
|
||||||
WAVE1_AMPLITUDE=$((2 + $RANDOM % 5))
|
if test -n ${BASH_VERSION:-''} ; then
|
||||||
WAVE1_LENGTH=$((50 + $RANDOM % 25))
|
get_random ()
|
||||||
WAVE2_AMPLITUDE=$((2 + $RANDOM % 5))
|
{
|
||||||
WAVE2_LENGTH=$((50 + $RANDOM % 25))
|
R=$RANDOM
|
||||||
WAVE3_AMPLITUDE=$((2 + $RANDOM % 5))
|
}
|
||||||
WAVE3_LENGTH=$((50 + $RANDOM % 25))
|
else
|
||||||
W1_LINE_START_Y=$((10 + $RANDOM % 40))
|
for n in `od -A n -t u2 -N 48 /dev/urandom`; do RL="$RL$n "; done
|
||||||
W1_LINE_STOP_Y=$((10 + $RANDOM % 40))
|
get_random ()
|
||||||
W2_LINE_START_Y=$((10 + $RANDOM % 40))
|
{
|
||||||
W2_LINE_STOP_Y=$((10 + $RANDOM % 40))
|
R=${RL%% *}
|
||||||
W3_LINE_START_Y=$((10 + $RANDOM % 40))
|
RL=${RL#* }
|
||||||
W3_LINE_STOP_Y=$((10 + $RANDOM % 40))
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
B1_LINE_START_Y=$(($RANDOM % 40))
|
get_random
|
||||||
B1_LINE_STOP_Y=$(($RANDOM % 40))
|
WAVE1_AMPLITUDE=$((2 + $R % 5))
|
||||||
B2_LINE_START_Y=$(($RANDOM % 40))
|
get_random
|
||||||
B2_LINE_STOP_Y=$(($RANDOM % 40))
|
WAVE1_LENGTH=$((50 + $R % 25))
|
||||||
#B3_LINE_START_Y=$(($RANDOM % 40))
|
get_random
|
||||||
#B3_LINE_STOP_Y=$(($RANDOM % 40))
|
WAVE2_AMPLITUDE=$((2 + $R % 5))
|
||||||
|
get_random
|
||||||
|
WAVE2_LENGTH=$((50 + $R % 25))
|
||||||
|
get_random
|
||||||
|
WAVE3_AMPLITUDE=$((2 + $R % 5))
|
||||||
|
get_random
|
||||||
|
WAVE3_LENGTH=$((50 + $R % 25))
|
||||||
|
get_random
|
||||||
|
W1_LINE_START_Y=$((10 + $R % 40))
|
||||||
|
get_random
|
||||||
|
W1_LINE_STOP_Y=$((10 + $R % 40))
|
||||||
|
get_random
|
||||||
|
W2_LINE_START_Y=$((10 + $R % 40))
|
||||||
|
get_random
|
||||||
|
W2_LINE_STOP_Y=$((10 + $R % 40))
|
||||||
|
get_random
|
||||||
|
W3_LINE_START_Y=$((10 + $R % 40))
|
||||||
|
get_random
|
||||||
|
W3_LINE_STOP_Y=$((10 + $R % 40))
|
||||||
|
|
||||||
B1_LINE_START_X=$(($RANDOM % 20))
|
get_random
|
||||||
B1_LINE_STOP_X=$((100 + $RANDOM % 40))
|
B1_LINE_START_Y=$(($R % 40))
|
||||||
B2_LINE_START_X=$(($RANDOM % 20))
|
get_random
|
||||||
B2_LINE_STOP_X=$((100 + $RANDOM % 40))
|
B1_LINE_STOP_Y=$(($R % 40))
|
||||||
#B3_LINE_START_X=$(($RANDOM % 20))
|
get_random
|
||||||
#B3_LINE_STOP_X=$((100 + $RANDOM % 40))
|
B2_LINE_START_Y=$(($R % 40))
|
||||||
|
get_random
|
||||||
|
B2_LINE_STOP_Y=$(($R % 40))
|
||||||
|
#B3_LINE_START_Y=$(($R % 40))
|
||||||
|
#B3_LINE_STOP_Y=$(($R % 40))
|
||||||
|
|
||||||
ROLL_X=$(($RANDOM % 40))
|
get_random
|
||||||
|
B1_LINE_START_X=$(($R % 20))
|
||||||
|
get_random
|
||||||
|
B1_LINE_STOP_X=$((100 + $R % 40))
|
||||||
|
get_random
|
||||||
|
B2_LINE_START_X=$(($R % 20))
|
||||||
|
get_random
|
||||||
|
B2_LINE_STOP_X=$((100 + $R % 40))
|
||||||
|
#B3_LINE_START_X=$(($R % 20))
|
||||||
|
#B3_LINE_STOP_X=$((100 + $R % 40))
|
||||||
|
|
||||||
|
get_random
|
||||||
|
ROLL_X=$(($R % 40))
|
||||||
|
|
||||||
convert -size 180x60 xc:none -pointsize 40 \
|
convert -size 180x60 xc:none -pointsize 40 \
|
||||||
\( -clone 0 -fill white \
|
\( -clone 0 -fill white \
|
||||||
|
Loading…
Reference in New Issue
Block a user