Comparison

mod_auth_external/authorize_example.sh @ 197:2686221255cf

restart authorize command if crashed or ended; added example shell script
author Bjoern Kalkbrenner <terminar@cyberphoria.org>
date Wed, 07 Jul 2010 13:27:46 +0200
comparison
equal deleted inserted replaced
196:a1c2677257da 197:2686221255cf
1 #!/bin/bash
2
3 IFS=":"
4 AUTH_OK=1
5 AUTH_FAILED=0
6 LOGFILE="/var/log/prosody/auth.log"
7 USELOG=true
8
9 while read ACTION USER HOST PASS ; do
10
11 [ $USELOG == true ] && { echo "Date: $(date) Action: $ACTION User: $USER Host: $HOST Pass: $PASS" >> $LOGFILE; }
12
13 case $ACTION in
14 "auth")
15 if [ $USER == "someone" ] ; then
16 echo $AUTH_OK
17 else
18 echo $AUTH_FAILED
19 fi
20 ;;
21 *)
22 echo $AUTH_FAILED
23 ;;
24 esac
25
26 done