From ff23671d0a07281a6042aff9447b4165ed0c3e1f Mon Sep 17 00:00:00 2001 From: Liangbin Lian Date: Tue, 16 Apr 2024 11:24:31 +0800 Subject: [PATCH] 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 --- net/ddns-scripts/Makefile | 2 +- .../files/usr/lib/ddns/update_cloudflare_com_v4.sh | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/net/ddns-scripts/Makefile b/net/ddns-scripts/Makefile index 9ffc3d2f3b..2524188aa9 100644 --- a/net/ddns-scripts/Makefile +++ b/net/ddns-scripts/Makefile @@ -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 diff --git a/net/ddns-scripts/files/usr/lib/ddns/update_cloudflare_com_v4.sh b/net/ddns-scripts/files/usr/lib/ddns/update_cloudflare_com_v4.sh index 4fb3a0dd6b..2647faaa80 100644 --- a/net/ddns-scripts/files/usr/lib/ddns/update_cloudflare_com_v4.sh +++ b/net/ddns-scripts/files/usr/lib/ddns/update_cloudflare_com_v4.sh @@ -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"