From 06363cd79890cc039d2b089c9a1587b1d3ef68e7 Mon Sep 17 00:00:00 2001 From: Dirk Brenken Date: Sat, 16 May 2026 22:49:56 +0200 Subject: [PATCH] adblock: update 4.5.5-4 - gated f_load behind a ubus socket check at the end of adblock.sh to harden against pre-ubus invocations - added a 'adb_bver' fallback in f_log for invocation paths without prior f_load execution - minor code improvements and fixes Signed-off-by: Dirk Brenken --- net/adblock/Makefile | 2 +- net/adblock/files/adblock.sh | 31 +++++++++++++++++-------------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/net/adblock/Makefile b/net/adblock/Makefile index 74e2c11e17..e4d41b546f 100644 --- a/net/adblock/Makefile +++ b/net/adblock/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=adblock PKG_VERSION:=4.5.5 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_LICENSE:=GPL-3.0-or-later PKG_MAINTAINER:=Dirk Brenken diff --git a/net/adblock/files/adblock.sh b/net/adblock/files/adblock.sh index 97f042ef51..6b1fe27592 100755 --- a/net/adblock/files/adblock.sh +++ b/net/adblock/files/adblock.sh @@ -1722,13 +1722,13 @@ f_log() { if [ -n "${log_msg}" ] && { [ "${class}" != "debug" ] || [ "${adb_debug}" = "1" ]; }; then if [ -x "${adb_loggercmd}" ]; then - "${adb_loggercmd}" -p "${class}" -t "adblock-${adb_bver}[${$}]" "${log_msg::512}" + "${adb_loggercmd}" -p "${class}" -t "adblock-${adb_bver:-"-"}[${$}]" "${log_msg::512}" else - printf '%s %s %s\n' "${class}" "adblock-${adb_bver}[${$}]" "${log_msg::512}" + printf '%s %s %s\n' "${class}" "adblock-${adb_bver:-"-"}[${$}]" "${log_msg::512}" >&2 fi if [ "${class}" = "err" ] || [ "${class}" = "emerg" ]; then [ "${adb_action}" != "mail" ] && f_rmdns - f_jsnup "error" + [ -s "${adb_rtfile}" ] && f_jsnup "error" exit 1 fi fi @@ -2435,16 +2435,6 @@ f_report() { esac } -# source required system libraries -# -if [ -r "/lib/functions.sh" ] && [ -r "/lib/functions/network.sh" ] && [ -r "/usr/share/libubox/jshn.sh" ]; then - . "/lib/functions.sh" - . "/lib/functions/network.sh" - . "/usr/share/libubox/jshn.sh" -else - f_log "err" "system libraries not found" -fi - # create runtime directory if it doesn't exist # [ ! -d "${adb_rundir}" ] && mkdir -p "${adb_rundir}" @@ -2474,9 +2464,22 @@ adb_mailcmd="$(f_cmd msmtp optional)" adb_logreadcmd="$(f_cmd logread optional)" adb_nftcmd="$(f_cmd nft)" +# source required system libraries +# +if [ -r "/lib/functions.sh" ] && [ -r "/lib/functions/network.sh" ] && [ -r "/usr/share/libubox/jshn.sh" ]; then + . "/lib/functions.sh" + . "/lib/functions/network.sh" + . "/usr/share/libubox/jshn.sh" +else + f_log "err" "system libraries not found" +fi + +# initial system load +# +[ -S "/var/run/ubus/ubus.sock" ] && f_load + # handle different adblock actions # -f_load case "${adb_action}" in "stop") f_temp