Redirect and explanation modifiers can be viewed and edited in SPF records

This commit is contained in:
Jamie Cameron
2009-05-20 19:38:12 +00:00
parent a4b6800375
commit e39440bdb7
5 changed files with 36 additions and 1 deletions

View 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.

View 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

View 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

View 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) {

View File

@@ -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 {