ddns-scripts: fix parsing of parameters for cloudflare.com
authorLiangbin Lian <redacted>
Wed, 4 Jun 2025 09:22:03 +0000 (17:22 +0800)
committerFlorian Eckert <redacted>
Wed, 4 Jun 2025 11:54:01 +0000 (13:54 +0200)
Compatible with domain without the `@` symbol, consistent with the previous.

Fixes 8c55d089 ("ddns-scripts: fix parsing of parameters for cloudflare.com")

Signed-off-by: Liangbin Lian <redacted>
net/ddns-scripts/Makefile
net/ddns-scripts/files/usr/lib/ddns/update_cloudflare_com_v4.sh

index ed41fc88d9ae874c7ea376effb46ef73376e8217..d6a6fe3ab6a7a35f85466d9597ea1576b821b203 100644 (file)
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=ddns-scripts
 PKG_VERSION:=2.8.2
-PKG_RELEASE:=71
+PKG_RELEASE:=72
 
 PKG_LICENSE:=GPL-2.0
 
index ee4b7183a6983b228d6d4c8415728a3333c4ddaf..17cd7c02430e28932f76aa1be20659b6be4a10a4 100644 (file)
 local __HOST __DOMAIN __TYPE __URLBASE __PRGBASE __RUNPROG __DATA __IPV6 __ZONEID __RECID
 local __URLBASE="https://api.cloudflare.com/client/v4"
 
-# split __HOST __DOMAIN from $domain
-# given data:
-# @example.com for "domain record"
-# host.sub@example.com for a "host record"
-__HOST=$(printf %s "$domain" | cut -d@ -f1)
-__DOMAIN=$(printf %s "$domain" | cut -d@ -f2)
+if echo "$domain" | grep -Fq '@'; then
+       # split __HOST __DOMAIN from $domain
+       # given data:
+       # @example.com for "domain record"
+       # host.sub@example.com for a "host record"
+       __HOST=$(printf %s "$domain" | cut -d@ -f1)
+       __DOMAIN=$(printf %s "$domain" | cut -d@ -f2)
+else
+       __DOMAIN=$domain
+fi
 
 # Cloudflare v4 needs:
 # __DOMAIN = the base domain i.e. example.com
git clone https://git.99rst.org/PROJECT