Redirect and explanation modifiers can be viewed and edited in SPF records
authorJamie Cameron <jcameron@webmin.com>
Wed, 20 May 2009 19:38:12 +0000 (19:38 +0000)
committerJamie Cameron <jcameron@webmin.com>
Wed, 20 May 2009 19:38:12 +0000 (19:38 +0000)
bind8/CHANGELOG
bind8/bind8-lib.pl
bind8/lang/en
bind8/records-lib.pl
bind8/save_record.cgi

index 3999bcc..ca4f1f1 100644 (file)
@@ -103,7 +103,8 @@ Fixed the 'Directory for DNSSEC keys' option on the Module Config page so that i
 SPF records longer than 255 bytes are automatically split into separate fields in the underlying TXT record.
 ---- Changes since 1.460 ----
 When adding a master zone with automatically created slaves, add an also-notify block to the master configuration to update the slaves.
----- Changes since 1.480 ----
+---- Changes since 1.470 ----
 Added mass record change and creation buttons to the zone search results page.
 Made the manual config file editor textboxes full-width.
 Fixed a bug that cause blocks like sortlist not be parsed properly, and possible cause Webmin to corrupt other parts of the named.conf file.
+Redirect and explanation modifiers can be viewed and edited in SPF records.
index 99e222c..a16bd2f 100644 (file)
@@ -1064,6 +1064,14 @@ elsif ($type eq "SPF") {
                          [ 1, $text{'value_spfall1'} ],
                          [ 0, $text{'value_spfall0'} ],
                          [ undef, $text{'value_spfalldef'} ] ]), 3);
+
+       print &ui_table_row($text{'value_spfredirect'},
+               &ui_opt_textbox("spfredirect", $spf->{'redirect'}, 40,
+                           $text{'value_spfnoredirect'}), 3);
+
+       print &ui_table_row($text{'value_spfexp'},
+               &ui_opt_textbox("spfexp", $spf->{'exp'}, 40,
+                           $text{'value_spfnoexp'}), 3);
        }
 else {
        # All other types just have a text box
index de5bfc9..61de74b 100644 (file)
@@ -277,6 +277,8 @@ edit_espfa='$1' is not a valid host to allow sending from
 edit_espfmx='$1' is not a valid domain name to allow MX sending from
 edit_espfip='$1' is not a valid IP address or IP/prefix to allow sending from
 edit_espfinclude='$1' is not a valid additional domain from which mail is sent
+edit_espfredirect='$1' is not a valid alternate domain name
+edit_espfexp='$1' is a valid record name for a rejection message
 
 text_title=Edit Records File
 text_title2=View Records File
@@ -434,6 +436,10 @@ value_spfall2=Discourage (~all)
 value_spfall1=Neutral (?all)
 value_spfall0=Allow (+all)
 value_spfalldef=Default
+value_spfredirect=Use SPF record from alternate domain
+value_spfnoredirect=Use this domain's record
+value_spfexp=TXT record for rejection reason
+value_spfnoexp=None
 
 warn=Warn
 fail=Fail
index e333bb3..d307c51 100644 (file)
@@ -670,6 +670,10 @@ if ($txt =~ /^v=spf1/) {
                elsif ($w eq "v=spf1") {
                        # Ignore this
                        }
+               elsif ($w =~ /^(redirect|exp)=(\S+)$/) {
+                       # Modifier for domain redirect or expansion
+                       $spf->{$1} = $2;
+                       }
                else {
                        push(@{$spf->{'other'}}, $w);
                        }
@@ -700,6 +704,11 @@ if ($spf->{'all'} == 3) { push(@rv, "-all"); }
 elsif ($spf->{'all'} == 2) { push(@rv, "~all"); }
 elsif ($spf->{'all'} == 1) { push(@rv, "?all"); }
 elsif ($spf->{'all'} eq '0') { push(@rv, "all"); }
+foreach my $m ("redirect", "exp") {
+       if ($spf->{$m}) {
+               push(@rv, $m."=".$spf->{$m});
+               }
+       }
 local @rvwords;
 local $rvword;
 while(@rv) {
index ab6ee5c..d58198c 100755 (executable)
@@ -305,6 +305,17 @@ else {
                        &valname($i) || &error(&text('edit_espfinclude', $i));
                        }
                $spf->{'all'} = $in{'spfall'};
+               foreach my $m ('redirect', 'exp') {
+                       if ($in{'spf'.$m.'_def'}) {
+                               delete($spf->{$m});
+                               }
+                       else {
+                               &valname($in{'spf'.$m}) || 
+                                       &error(&text('edit_espf'.$m, 
+                                                    $in{'spf'.$m}));
+                               $spf->{$m} = $in{'spf'.$m};
+                               }
+                       }
                $vals = "\"".&join_spf($spf)."\"";
                }
        else {