Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Validate realm supplied as input
  • Loading branch information
Guy Halse authored and Fabian Mauchle committed May 31, 2021
1 parent b831925 commit d881d39
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion tools/naptr-eduroam.sh
Expand Up @@ -14,7 +14,6 @@ usage() {

test -n "${1}" || usage

REALM="${1}"
DIGCMD=$(command -v dig)
HOSTCMD=$(command -v host)
PRINTCMD=$(command -v printf)
Expand Down Expand Up @@ -69,6 +68,12 @@ host_it_naptr() {
done
}

REALM=$(validate_host ${1})
if [ -z "${REALM}" ]; then
echo "Error: realm \"${1}\" failed validation"
usage
fi

if [ -x "${DIGCMD}" ]; then
SERVERS=$(dig_it_naptr)
elif [ -x "${HOSTCMD}" ]; then
Expand Down
7 changes: 6 additions & 1 deletion tools/radsec-dynsrv.sh
Expand Up @@ -14,7 +14,6 @@ usage() {

test -n "${1}" || usage

REALM="${1}"
DIGCMD=$(command -v digaaa)
HOSTCMD=$(command -v host)
PRINTCMD=$(command -v printf)
Expand Down Expand Up @@ -47,6 +46,12 @@ host_it() {
done
}

REALM=$(validate_host ${1})
if test -z "${REALM}" ; then
echo "Error: realm \"${1}\" failed validation"
usage
fi

if test -x "${DIGCMD}" ; then
SERVERS=$(dig_it)
elif test -x "${HOSTCMD}" ; then
Expand Down

0 comments on commit d881d39

Please sign in to comment.