From ee420bef24642ef6c4ec4508f938f25b5a2ed9ad Mon Sep 17 00:00:00 2001 From: Deltaman-MWI <281890303+Deltaman-MWI@users.noreply.github.com> Date: Tue, 15 Sep 2026 13:05:08 +0200 Subject: [PATCH] Allow the DMARC pct field to be left empty in bind8 RFC 9989 (DMARCbis) removes the pct tag, but the DMARC form validated the percentage as mandatory and always assigned it, so every record written through Webmin contained pct=. Treat the field like the sp field directly below it: when it is empty, delete the tag. Values 0-100 are still accepted and validated for anyone who deliberately uses pct during a rollout. join_dmarc() already skips tags with an empty value, so no change was needed there. Fixes #2843 Co-Authored-By: Claude Opus 5 (1M context) --- bind8/save_record.cgi | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bind8/save_record.cgi b/bind8/save_record.cgi index 406eb71a6..240fcea4a 100755 --- a/bind8/save_record.cgi +++ b/bind8/save_record.cgi @@ -394,9 +394,14 @@ else { my $dmarc = $r ? &parse_dmarc(@{$r->{'values'}}) : { }; $dmarc->{'p'} = $in{'dmarcp'}; - $in{'dmarcpct'} =~ /^\d+$/ && $in{'dmarcpct'} >= 0 && - $in{'dmarcpct'} <= 100 || &error($text{'edit_edmarcpct'}); - $dmarc->{'pct'} = $in{'dmarcpct'}; + if ($in{'dmarcpct'} ne '') { + $in{'dmarcpct'} =~ /^\d+$/ && $in{'dmarcpct'} >= 0 && + $in{'dmarcpct'} <= 100 || &error($text{'edit_edmarcpct'}); + $dmarc->{'pct'} = $in{'dmarcpct'}; + } + else { + delete($dmarc->{'pct'}); + } if ($in{'dmarcsp'}) { $dmarc->{'sp'} = $in{'dmarcsp'};