From: Eric McDonald Date: Sat, 7 Mar 2026 21:50:13 +0000 (-0800) Subject: net-snmp: add early return when HostName is unset X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=8033cfc287257ce2507999dd8ee332655cf554d5;p=openwrt-packages.git net-snmp: add early return when HostName is unset snmpd_access_HostName_add would write unintended output to the config file if the HostName option is not specified. Add an early return to prevent writing in that case. This is a breaking change for configs where HostName is unset. Previously, an empty HostName option would result in a malformed directive with a trailing space and no guaranteed newline, the exact form of which depended on the values of other options. Now, no directive is written. Signed-off-by: Eric McDonald --- diff --git a/net/net-snmp/files/snmpd.init b/net/net-snmp/files/snmpd.init index 96d36b162..7c1a7429b 100644 --- a/net/net-snmp/files/snmpd.init +++ b/net/net-snmp/files/snmpd.init @@ -143,6 +143,7 @@ snmpd_access_default_add() { snmpd_access_HostName_add() { local cfg="$1" config_get hostname "$cfg" HostName + [ -n "$hostname" ] || return 0 config_get mode "$cfg" Mode [ -n "$mode" ] || return 0 config_get community "$cfg" CommunityName