From 150d88585bafec6f9579a753da0da59fe4bee1fc Mon Sep 17 00:00:00 2001 From: Liangbin Lian Date: Wed, 4 Jun 2025 17:22:03 +0800 Subject: [PATCH] ddns-scripts: fix parsing of parameters for cloudflare.com 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 --- net/ddns-scripts/Makefile | 2 +- .../usr/lib/ddns/update_cloudflare_com_v4.sh | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/net/ddns-scripts/Makefile b/net/ddns-scripts/Makefile index ed41fc88d9..d6a6fe3ab6 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:=71 +PKG_RELEASE:=72 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 ee4b7183a6..17cd7c0243 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 @@ -30,12 +30,16 @@ 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