Compare commits

..

No commits in common. "e937935a287fb8b9842db88011d6f8e23de6e1e4" and "4e230b606ef13c1890111dc79ac44e9f45d4ff75" have entirely different histories.

View File

@ -5,19 +5,6 @@ source "$THIS_DIR/../tools/common.sh"
RIOT_TRUST_CLIENT=${RIOT_TRUST_CLIENT:-${DFS_TRUST:-0}} RIOT_TRUST_CLIENT=${RIOT_TRUST_CLIENT:-${DFS_TRUST:-0}}
RIOT_TRUST_SERVER=${RIOT_TRUST_SERVER:-0} RIOT_TRUST_SERVER=${RIOT_TRUST_SERVER:-0}
# check if port number valid
check_port() {
( echo $1 | grep -qxE "[1-9][0-9]{0,4}" ) || return 1
test $1 -lt 65536 -a $1 -gt 0 || return 1
return 0
}
# check if username valid
check_username() {
( echo $1 | grep -qxE "^[a-z][-a-z0-9_]*\$" ) || return 1
return 0
}
# get single server setting # get single server setting
# may be called more than once # may be called more than once
get_server_meta() { get_server_meta() {
@ -33,24 +20,22 @@ get_server_meta() {
if [[ "$remote" == *@* ]]; then if [[ "$remote" == *@* ]]; then
RET_USERNAME=${remote%%@*} RET_USERNAME=${remote%%@*}
remote=${remote#*@} remote=${remote#*@}
check_username $RET_USERNAME || fmt_fatal invalid username \"$RET_USERNAME\"
fi fi
# if in the form ...:22 # if in the form ...:22
if [[ "$remote" == "["*"]":* || ( "$remote" != "["*"]" && "$remote" == *:* ) ]]; then if [[ "$remote" == *:* ]]; then
RET_PORT=${remote##*:} RET_PORT=${remote##*:}
remote=${remote%:*} remote=${remote%:*}
check_port $RET_PORT || fmt_fatal invalid port number \"$RET_PORT\"
fi fi
# presets -- match domain # presets -- match domain
local domain=${remote##*.} local domain=${remote##*.}
local host=${remote%.*} local host=${remote%.*}
# if there's no dot # if there's no dot
if [[ "$host" == "$domain" && "$host" != "["*"]" ]]; then if [[ "$host" == "$domain" ]]; then
domain="ibd" domain="ibd"
fi fi
case $domain in case $domain in
i|ibd ) ibd|ebd )
RET_HOSTNAME=$host.ibd.ink RET_HOSTNAME=$host.$domain.ink
RET_PORT=${RET_PORT:-12022} RET_PORT=${RET_PORT:-12022}
RET_USERNAME=${RET_USERNAME:-root} RET_USERNAME=${RET_USERNAME:-root}
RET_TRUST_SERVER=1 RET_TRUST_SERVER=1