dns: fix dns-update fqdn() double-appending zone to FQDN records #481
@@ -20,7 +20,15 @@ applied="$(grep -vE '^[[:space:]]*(#|$)' "$STATE" 2>/dev/null | sort -u || true)
|
||||
[ "$desired" = "$applied" ] && exit 0
|
||||
|
||||
fqdn() { # name zone
|
||||
if [ -z "$1" ] || [ "$1" = "@" ]; then printf '%s.' "$2"; else printf '%s.%s.' "$1" "$2"; fi
|
||||
# $1 may be relative to the zone, "@"/empty for the apex, or already a FQDN
|
||||
# (trailing dot). Only append the zone in the relative case; appending it to
|
||||
# an already-qualified name yields a "..", which nsupdate rejects as an
|
||||
# "invalid owner name: empty label".
|
||||
case "$1" in
|
||||
''|'@') printf '%s.' "$2" ;;
|
||||
*.) printf '%s' "$1" ;;
|
||||
*) printf '%s.%s.' "$1" "$2" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
msg="$(mktemp)"
|
||||
|
||||
Reference in New Issue
Block a user