net-snmp: add early return when IPMask is unset
authorEric McDonald <redacted>
Sat, 7 Mar 2026 21:52:19 +0000 (13:52 -0800)
committerFlorian Eckert <redacted>
Wed, 11 Mar 2026 08:07:04 +0000 (09:07 +0100)
snmpd_access_HostIP_add would write unintended output to the
config file if the IPMask option is not specified. Add an early
return to prevent writing in that case.

This is a breaking change for configs where IPMask is unset.
Previously, an empty IPMask option would result in a malformed
directive containing a trailing slash with 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 <redacted>
net/net-snmp/files/snmpd.init

index b1e13edb11af64e41a29773aa3cd10a84d93925e..371c15071cabaf1918f0eda1f6b9e9945e0d06e2 100644 (file)
@@ -160,6 +160,7 @@ snmpd_access_HostIP_add() {
        config_get host_ip "$cfg" HostIP
        [ -n "$host_ip" ] || return 0
        config_get ip_mask "$cfg" IPMask
+       [ -n "$ip_mask" ] || return 0
        config_get mode "$cfg" Mode
        [ -n "$mode" ] || return 0
        config_get community "$cfg" CommunityName
git clone https://git.99rst.org/PROJECT