From a23b5f921d551863dbcae494e58622164a1d3492 Mon Sep 17 00:00:00 2001 From: Epoch Qwert Date: Thu, 23 Oct 2014 01:54:42 -0500 Subject: added some nifty magic for hostname instead of using one given on command-line --- nocompile/libexec/gopherd.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3