blob: 75a5b5a161b2cee7be4788e48a5b361bdf60f756 [file] [log] [blame] [raw]
#!/bin/sh
if [ $# != 1 ]; then
printf "Usage: %s <user-name>\\n" "$0" 1>&2
exit 255
fi
user_name="$1"
if printf %s "$user_name" | grep -Fq -e " " -e " " -e \' -e \" -e \# -e \* -e / -e \\ -e :; then
echo "Invalid user name" 1>&2
exit 1
fi
if [ -z "$SSH_CLIENT" ]; then
echo "SSH_CLIENT not set" 1>&2
exit 1
fi
set -- $SSH_CLIENT
remote_address="$1"
set -e
[ -d plugins/tsauth ] || mkdir plugins/tsauth
printf %s\\n "$remote_address" > "plugins/tsauth/$user_name"
printf "You are now authorzied to access our Minecraft server as %s from %s.\\nThis authorization is valid for 30 minutes.\\n" "$user_name" "$remote_address"
sleep 2