diff options
author | Linus Nordberg <linus@nordu.net> | 2011-05-31 14:36:31 +0200 |
---|---|---|
committer | Linus Nordberg <linus@nordu.net> | 2011-05-31 14:36:31 +0200 |
commit | 226f6c31d23e4c335ed64279a7e09274173355fb (patch) | |
tree | 47ec53d2d4996839e48d361f6a7c6e5b008dc320 /tools/naptr-eduroam.sh | |
parent | fa01d8dda3f32b3203c6fbaa4dd3c600d76eeaff (diff) |
(tools/naptr-eduroam.sh): Use /bin/sh rather than bash.
Not all systems have bash (esp. not in /bin) and some people argue
that /bin/sh should be less unsafe due to less code, lower complexity
and being around for longer time.
Fixes:
- /bin/sh builtin echo doesn't have `-e' -- use /bin/echo
- /bin/sh builtin test ([) doesn't understand `==' -- use `='
Diffstat (limited to 'tools/naptr-eduroam.sh')
-rwxr-xr-x | tools/naptr-eduroam.sh | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tools/naptr-eduroam.sh b/tools/naptr-eduroam.sh index 5f04704..99be5e1 100755 --- a/tools/naptr-eduroam.sh +++ b/tools/naptr-eduroam.sh @@ -1,4 +1,4 @@ -#! /bin/bash +#! /bin/sh # Example script! # This script looks up radsec srv records in DNS for the one @@ -8,7 +8,7 @@ # For host command this is coloumn 5, for dig it is coloumn 1. usage() { - echo "Usage: ${0} <realm>" + /bin/echo "Usage: ${0} <realm>" exit 1 } @@ -22,7 +22,7 @@ dig_it_srv() { ${DIGCMD} +short srv $SRV_HOST | sort -k1 | while read line ; do set $line ; PORT=$3 ; HOST=$4 - echo -e "\thost ${HOST%.}:${PORT}" + /bin/echo -e "\thost ${HOST%.}:${PORT}" done } @@ -30,7 +30,7 @@ dig_it_naptr() { ${DIGCMD} +short naptr ${REALM} | grep x-eduroam:radius.tls | sort -k1 | while read line ; do set $line ; TYPE=$3 ; HOST=$6 - if [ "$TYPE" == "\"s\"" ]; then { + if [ "$TYPE" = "\"s\"" ]; then { SRV_HOST=${HOST%.} dig_it_srv; }; fi @@ -41,7 +41,7 @@ host_it_srv() { ${HOSTCMD} -t srv $SRV_HOST | sort -k5 | while read line ; do set $line ; PORT=$7 ; HOST=$8 - echo -e "\thost ${HOST%.}:${PORT}" + /bin/echo -e "\thost ${HOST%.}:${PORT}" done } @@ -49,7 +49,7 @@ host_it_naptr() { ${HOSTCMD} -t naptr ${REALM} | grep x-eduroam:radius.tls | sort -k5 | while read line ; do set $line ; TYPE=$7 ; HOST=${10} - if [ "$TYPE" == "\"s\"" ]; then { + if [ "$TYPE" = "\"s\"" ]; then { SRV_HOST=${HOST%.} host_it_srv; }; fi @@ -61,12 +61,12 @@ if test -x "${DIGCMD}" ; then elif test -x "${HOSTCMD}" ; then SERVERS=$(host_it_naptr) else - echo "${0} requires either \"dig\" or \"host\" command." + /bin/echo "${0} requires either \"dig\" or \"host\" command." exit 1 fi if test -n "${SERVERS}" ; then - echo -e "server dynamic_radsec.${REALM} {\n${SERVERS}\n\ttype TLS\n}" + /bin/echo -e "server dynamic_radsec.${REALM} {\n${SERVERS}\n\ttype TLS\n}" exit 0 fi |