2022-10-03 10:45:30 -06:00
|
|
|
#!/bin/bash
|
|
|
|
# FILE: wgapi:back/lib/ns_lookup_rxfr
|
|
|
|
# DESCRIPTION: Get all records
|
|
|
|
# USAGE: ns_lookup_rxfr
|
|
|
|
# OUTPUT: The complete set of records for the TLD
|
|
|
|
# ERRORS:
|
2022-12-03 18:23:13 -07:00
|
|
|
# 3: Bad usage
|
|
|
|
# 4: Domain not found
|
|
|
|
# 5: Server down
|
2022-10-03 10:45:30 -06:00
|
|
|
# 6: nslookup not found
|
2022-12-03 18:23:13 -07:00
|
|
|
# 7: nslookup refused
|
|
|
|
# 8: nslookup error
|
2022-10-03 10:45:30 -06:00
|
|
|
|
2022-12-03 18:23:13 -07:00
|
|
|
source /etc/wgapi/config
|
2022-10-03 10:45:30 -06:00
|
|
|
|
2022-12-03 18:30:14 -07:00
|
|
|
res="$("/usr/lib/wgapi/ns_lookup_send" "-query=AXFR" "${TLD}.")"
|
2022-10-03 10:45:30 -06:00
|
|
|
case $? in
|
|
|
|
0) printf '%s' "${res}"; exit 0;;
|
2022-12-03 17:07:03 -07:00
|
|
|
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;;
|
2022-12-03 18:23:13 -07:00
|
|
|
8) printf 'nslookup threw an error!\n' >&2; exit 8;;
|
|
|
|
9) printf 'nslookup refused RXFR request!\n' >&2; exit 7;;
|
2022-12-03 17:07:03 -07:00
|
|
|
*) printf 'Bad usage: %s %s\n' "${0}" "${@}" >&2; exit 3;;
|
2022-10-03 10:45:30 -06:00
|
|
|
esac
|