27 lines
925 B
Bash
Executable File
27 lines
925 B
Bash
Executable File
#!/bin/bash
|
|
# FILE: wagon:back/lib/ns_lookup_rxfr_rdns4
|
|
# DESCRIPTION: Get all IPv4 rDNS records
|
|
# USAGE: ns_lookup_rxfr
|
|
# OUTPUT: The complete set of records for the IP range
|
|
# ERRORS:
|
|
# 3: Bad usage
|
|
# 4: Domain not found
|
|
# 5: Server down
|
|
# 6: nslookup not found
|
|
# 7: nslookup refused
|
|
# 8: nslookup error
|
|
|
|
source /etc/wagon/config
|
|
|
|
rev_ipv4="$(/usr/lib/wagon/ns_update_rev_ipv4 ${IPV4_HUB} | cut -f1 | cut -d'.' -f3-6)"
|
|
res="$(/usr/lib/wagon/ns_lookup_rdns "-query=axfr" "${rev_ipv4}")"
|
|
case $? in
|
|
0) printf '%s' "${res}"; exit 0;;
|
|
4) printf 'Domain for %s not found!\n' "${1}" >&2; exit 4;;
|
|
5) printf 'Nameserver not available: %s\n' "${DNS_MASTER}" >&2; exit 5;;
|
|
6) printf 'nslookup not installed!\n' >&2; exit 6;;
|
|
8) printf 'nslookup threw an error!\n' >&2; exit 8;;
|
|
9) printf 'nslookup refused AXFR request!\n' >&2; exit 7;;
|
|
*) printf 'Bad usage: %s %s\n' "${0}" "${@}" >&2; exit 3;;
|
|
esac
|