diff options
author | Epoch Qwert <epoch@53flpnlls43fcguy.onion> | 2014-10-23 01:54:42 -0500 |
---|---|---|
committer | Epoch Qwert <epoch@53flpnlls43fcguy.onion> | 2014-10-23 01:54:42 -0500 |
commit | a23b5f921d551863dbcae494e58622164a1d3492 (patch) | |
tree | 5013b07cd49cf5944bd8d2698c81faada45352a2 /nocompile | |
parent | 8c542d83091f9ba5ccb095fad730651f8e6c1eef (diff) | |
download | misc-a23b5f921d551863dbcae494e58622164a1d3492.tar.gz misc-a23b5f921d551863dbcae494e58622164a1d3492.zip |
added some nifty magic for hostname instead of using one given on command-line
Diffstat (limited to 'nocompile')
-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 |