mirror of
https://git.phreedom.club/localhost_frssoft/bbs-telnet
synced 2024-11-23 18:39:20 +02:00
Allow only one session per ip
This commit is contained in:
parent
41bbe69ac1
commit
6cd060681e
|
@ -4,7 +4,6 @@
|
|||
|
||||
remote_ip=$SOCAT_PEERADDR
|
||||
die(){
|
||||
rm access_granted/"$remote_ip"
|
||||
echo 'bye'
|
||||
pkill -P $PPID
|
||||
}
|
||||
|
@ -24,14 +23,14 @@ while read -r cmd mesg; do
|
|||
key=$(echo "$mesg" | cut -d' ' -f 2)
|
||||
session=$(echo "$mesg" | cut -d' ' -f 1)
|
||||
if [ "$session" = "$generator_session" ] && [ "$key" = "$pass_for_bbs" ]; then
|
||||
touch access_granted/"$remote_ip"
|
||||
echo "$generator_session" > access_granted/"$remote_ip"
|
||||
echo hi $remote_ip
|
||||
else
|
||||
die
|
||||
break
|
||||
fi
|
||||
fi
|
||||
if [ ! -f access_granted/"$remote_ip" ]; then # Drop unregistred handshake
|
||||
if [ ! -n "$(grep -F "$generator_session" access_granted/"$remote_ip")" ]; then # Drop unregistred handshake
|
||||
die
|
||||
break
|
||||
fi
|
||||
|
@ -76,7 +75,7 @@ while read -r cmd mesg; do
|
|||
done
|
||||
toot $full_status | jq '.id, .errors'
|
||||
;;
|
||||
*) die; break ;;
|
||||
*) break ;;
|
||||
esac
|
||||
printf 'bbs > '
|
||||
done
|
||||
|
|
Loading…
Reference in New Issue