ddns-scripts: fix parsing of parameters

There is an obvious bug here:
if we want to update example.com.example.com in zone example.com,
so `domain=example.com@example.com`, after parsing,
the `__HOST` will be `example.com`, not expected `example.com.example.com`.

Signed-off-by: Liangbin Lian <jjm2473@gmail.com>
This commit is contained in:
Liangbin Lian 2024-04-16 11:24:31 +08:00
parent 3886eac61c
commit ff23671d0a
2 changed files with 6 additions and 3 deletions

View File

@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=ddns-scripts
PKG_VERSION:=2.8.2
PKG_RELEASE:=43
PKG_RELEASE:=44
PKG_LICENSE:=GPL-2.0

View File

@ -43,10 +43,13 @@ __DOMAIN=$(printf %s "$domain" | cut -d@ -f2)
# __HOST = the FQDN of record to modify
# i.e. example.com for the "domain record" or host.sub.example.com for "host record"
if [ -z "$__HOST" ]; then
# handling domain record then set __HOST = __DOMAIN
[ -z "$__HOST" ] && __HOST=$__DOMAIN
__HOST=$__DOMAIN
else
# handling host record then rebuild fqdn host@domain.tld => host.domain.tld
[ "$__HOST" != "$__DOMAIN" ] && __HOST="${__HOST}.${__DOMAIN}"
__HOST="${__HOST}.${__DOMAIN}"
fi
# set record type
[ $use_ipv6 -eq 0 ] && __TYPE="A" || __TYPE="AAAA"