31 lines
1004 B
Bash
Executable File
31 lines
1004 B
Bash
Executable File
#!/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:
|
|
# 3: bad usage
|
|
# 4: not found
|
|
# 5: server down
|
|
# 6: nslookup not found
|
|
# 7: config not found
|
|
# 8: nslookup refused
|
|
# 9: nslookup error
|
|
|
|
# Accept no arguments
|
|
[ ${#} -eq 0 ] || exit 3
|
|
CONFIG_FILE='/etc/wgapi/config'
|
|
[ -f "${CONFIG_FILE}" ] || exit 7
|
|
source "${CONFIG_FILE}"
|
|
|
|
res="$("${LIB_DIR}/ns_lookup_send" "-query=AXFR" "${TLD}.")"
|
|
case $? in
|
|
0) printf '%s' "${res}"; exit 0;;
|
|
4) printf 'Domain for %s not found!\n' "${1}" >>"${LOGFILE}"; exit 4;;
|
|
5) printf 'Nameserver not available: %s\n' "${DNS_MASTER}" >>"${LOGFILE}"; exit 5;;
|
|
6) printf 'nslookup not installed!\n' >>"${LOGFILE}"; exit 6;;
|
|
8) printf 'nslookup threw an error!\n' >>"${LOGFILE}"; exit 9;;
|
|
9) printf 'nslookup refused RXFR request!\n' >>"${LOGFILE}"; exit 8;;
|
|
*) printf 'Bad usage: %s %s\n' "${0}" "${@}" >>"${LOGFILE}"; exit 3;;
|
|
esac
|