From 91954f4b692d9c787e48e10943b8491f0960502d Mon Sep 17 00:00:00 2001 From: Paul Donald Date: Wed, 27 Nov 2024 20:39:00 +0100 Subject: [PATCH] ddns-scripts: refactor update_url checks to avoid echo|grep sub-shells Signed-off-by: Paul Donald --- .../files/usr/lib/ddns/dynamic_dns_updater.sh | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_updater.sh b/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_updater.sh index e6f91e8ee0..53099aae5c 100644 --- a/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_updater.sh +++ b/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_updater.sh @@ -266,16 +266,16 @@ esac [ -n "$update_url" ] && { # only check if update_url is given, update_scripts have to check themselves - [ -z "$domain" ] && $(echo "$update_url" | grep "\[DOMAIN\]" >/dev/null 2>&1) && \ - write_log 14 "Service section not configured correctly! Missing 'domain'" - [ -z "$username" ] && $(echo "$update_url" | grep "\[USERNAME\]" >/dev/null 2>&1) && \ - write_log 14 "Service section not configured correctly! Missing 'username'" - [ -z "$password" ] && $(echo "$update_url" | grep "\[PASSWORD\]" >/dev/null 2>&1) && \ - write_log 14 "Service section not configured correctly! Missing 'password'" - [ -z "$param_enc" ] && $(echo "$update_url" | grep "\[PARAMENC\]" >/dev/null 2>&1) && \ - write_log 14 "Service section not configured correctly! Missing 'param_enc'" - [ -z "$param_opt" ] && $(echo "$update_url" | grep "\[PARAMOPT\]" >/dev/null 2>&1) && \ - write_log 14 "Service section not configured correctly! Missing 'param_opt'" + [ -z "$domain" ] && [ "${update_url##*'[DOMAIN]'}" != "$update_url" ] && \ + write_log 14 "Service section missing 'domain'" + [ -z "$username" ] && [ "${update_url##*'[USERNAME]'}" != "$update_url" ] && \ + write_log 14 "Service section missing 'username'" + [ -z "$password" ] && [ "${update_url##*'[PASSWORD]'}" != "$update_url" ] && \ + write_log 14 "Service section missing 'password'" + [ -z "$param_enc" ] && [ "${update_url##*'[PARAMENC]'}" != "$update_url" ] && \ + write_log 14 "Service section missing 'param_enc'" + [ -z "$param_opt" ] && [ "${update_url##*'[PARAMOPT]'}" != "$update_url" ] && \ + write_log 14 "Service section missing 'param_opt'" } # verify ip_source 'script' if script is configured and executable