diff options
-rwxr-xr-x | nocompile/libexec/gopherd.sh | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/nocompile/libexec/gopherd.sh b/nocompile/libexec/gopherd.sh index 6d12cd6..e50b129 100755 --- a/nocompile/libexec/gopherd.sh +++ b/nocompile/libexec/gopherd.sh @@ -9,7 +9,16 @@ if grep -v "^${base}" <<< "${realpath}" > /dev/null;then echo ${realpath} exit 1 fi -hostname=$(/usr/local/bin/hop0 $(/usr/local/libexec/peerip)) +myIP=$(/usr/local/bin/hop0 $(/usr/local/libexec/peerip)) +hostname=$(dig -x ${myIP} +short | rev | tail -c+2 | rev ) +if [ ! "${hostname}" ]; then + hostname=${myIP} +else + if [ $(dig +short $hostname) != ${myIP} ];then + logger "hostname (${hostname}) and IP (${myIP}) aren't matching up. >_>"; + exit 2 + fi +fi type=$(file "${realpath}" | cut -d: -f2-) if grep directory <<< "$type" 2>&1 > /dev/null; then if [ -e "${realpath}/.header" ];then |