Author: julian
Date: 2006-03-11 17:10:00 -0600 (Sat, 11 Mar 2006)
New Revision: 16

Modified:
   wizard.html
Log:
wizard.html
* Catch invalid "ip4:" IPv4/CIDR specifications and output a graceful error
  message instead of dying an ugly death.
* Help VIM syntax highlighting by inserting a space in <% foo |h%> constructs
  before the closing "%>" part.


Modified: wizard.html
===================================================================
--- wizard.html 2006-03-11 22:18:14 UTC (rev 15)
+++ wizard.html 2006-03-11 23:10:00 UTC (rev 16)
@@ -229,12 +229,12 @@
 % 
 %   if ($directive eq "v=spf1") {
       <TR><TD ALIGN=CENTER VALIGN=MIDDLE CLASS="orangeblock"><& .mechlabel, 
label => "v=spf1" &></TD>
-         <TH><CODE><% $directive |h%></CODE></TH><TD>This identifies the TXT 
record as an SPF string.</TD></TR>
+         <TH><CODE><% $directive |h %></CODE></TH><TD>This identifies the TXT 
record as an SPF string.</TD></TR>
 %   }
 % 
 %   elsif ($directive =~ /^\+?a(\/.*)?$/i) {
       <TR><TD ALIGN=CENTER VALIGN=MIDDLE CLASS="orangeblock"><& .mechlabel, 
label => "a" &></TD>
-         <TH><CODE><% $directive |h%></CODE></TH><TD>
+         <TH><CODE><% $directive |h %></CODE></TH><TD>
 %      if (@a == 0) {
                             <% $Mydomain %> has no IP addresses.  This 
declaration has no effect.
 %      } elsif (@a == 1) {
@@ -252,7 +252,7 @@
 %
 %   elsif ($directive =~ /^\+?mx(\/.*)?$/i) {
       <TR><TD ALIGN=CENTER VALIGN=MIDDLE CLASS="orangeblock"><& .mechlabel, 
label => "mx" &></TD>
-         <TH><CODE><% $directive |h%></CODE></TH><TD>
+         <TH><CODE><% $directive |h %></CODE></TH><TD>
 %     if (keys %mxhosts == 0) {
                                 <% $Mydomain %> has no MX servers.
 %     } elsif (keys %mxhosts == 1) {
@@ -272,35 +272,40 @@
 %
 %   elsif ($directive =~ /^\+?ptr$/i) {
       <TR><TD ALIGN=CENTER VALIGN=MIDDLE CLASS="orangeblock"><& .mechlabel, 
label => "ptr" &></TD>
-         <TH><CODE><% $directive |h%></CODE></TH><TD>
+         <TH><CODE><% $directive |h %></CODE></TH><TD>
                                 Any server whose name ends in <% $Mydomain %> 
is allowed to send mail from <% $Mydomain %>.
        </TD></TR>
 %   }
 %
 %   elsif ($directive =~ /^\+?ptr:(\S+)/i) {
       <TR><TD ALIGN=CENTER VALIGN=MIDDLE CLASS="orangeblock"><& .mechlabel, 
label => "ptr" &></TD>
-         <TH><CODE><% $directive |h%></CODE></TH><TD>
+         <TH><CODE><% $directive |h %></CODE></TH><TD>
                                 Any server whose name ends in <CODE><% 
$spfquery->macro_substitute($1) %></CODE> is allowed to send mail from <% 
$Mydomain %>.
        </TD></TR>
 %   }
 %
 %   elsif ($directive =~ /^\+?ip4:(\S+)/i) {{
       <TR><TD ALIGN=CENTER VALIGN=MIDDLE CLASS="orangeblock"><& .mechlabel, 
label => "ip4:" &></TD>
-         <TH><CODE><% $directive |h%></CODE></TH><TD>
+         <TH><CODE><% $directive |h %></CODE></TH><TD>
 % my $network = $1; $network =~ s/\/32$//;
 % if ($network =~ /\//) {
-%   my $cidr = Net::CIDR::Lite->new($network);
-          Every host in the range <% $cidr->list_range |h%> is allowed to send 
mail from <% $Mydomain %>.
+%   my $cidr = eval { Net::CIDR::Lite->new($network) };
+%   if (not $@) {
+          Every host in the range <% $cidr->list_range |h %> is allowed to 
send mail from <% $Mydomain %>.
+%   }
+%   else {  # Net::CIDR::Lite->new() threw an exception:
+          <SPAN STYLE="color: red; font-variant: italic">Error: "<% $network 
|h %>" is not a valid IPv4 address or CIDR specificaion.</SPAN>
+%   }
 % } else {
-          <% $network |h%> is allowed to send mail from <% $Mydomain %>.
+          <% $network |h %> is allowed to send mail from <% $Mydomain %>.
 % }
       </TD></TR>
 %   }}
 %
 %   elsif ($directive =~ /^\+?mx:([^\/]+)/i) {
       <TR><TD ALIGN=CENTER VALIGN=MIDDLE CLASS="orangeblock"><& .mechlabel, 
label => "mx:" &></TD>
-         <TH><CODE><% $directive |h%></CODE></TH><TD>
-          The MX servers for <% $1 |h%> are allowed to send mail from <% 
$Mydomain %>.
+         <TH><CODE><% $directive |h %></CODE></TH><TD>
+          The MX servers for <% $1 |h %> are allowed to send mail from <% 
$Mydomain %>.
 %      if ($directive =~ /\/(\d+)$/) {
                             <BR>So are any other servers in the same /<%$1%> 
<% keys %mxhosts > 1 ? "subnets" : "subnet" %>.
 %      }
@@ -309,8 +314,8 @@
 %
 %   elsif ($directive =~ /^\+?a:([^\/]+)/i) {
       <TR><TD ALIGN=CENTER VALIGN=MIDDLE CLASS="orangeblock"><& .mechlabel, 
label => "a:" &></TD>
-         <TH><CODE><% $directive |h%></CODE></TH><TD>
-          <% $1 |h%> is also allowed to send mail from <% $Mydomain %>.
+         <TH><CODE><% $directive |h %></CODE></TH><TD>
+          <% $1 |h %> is also allowed to send mail from <% $Mydomain %>.
 %      if ($directive =~ /\/(\d+)$/) {
                             <BR>So are any other servers in the same /<%$1%> 
subnet.
 %      }
@@ -319,8 +324,8 @@
 %
 %   elsif ($directive =~ /^\+?include:(\S+)/i) {
       <TR><TD ALIGN=CENTER VALIGN=MIDDLE CLASS="orangeblock"><& .mechlabel, 
label => "include:" &></TD>
-         <TH><CODE><% $directive |h%></CODE></TH><TD>
-          Any server allowed to send mail from <CODE><% 
$spfquery->macro_substitute($1) |h%></CODE> is also allowed to send mail from 
<% $Mydomain %>.
+         <TH><CODE><% $directive |h %></CODE></TH><TD>
+          Any server allowed to send mail from <CODE><% 
$spfquery->macro_substitute($1) |h %></CODE> is also allowed to send mail from 
<% $Mydomain %>.
 %   # TODO: add a check to ensure the included domains actually have SPF 
records.
 %
       </TD></TR>
@@ -328,15 +333,15 @@
 %
 %   elsif ($directive =~ /^\+?exists:(\S+)/i) {
       <TR><TD ALIGN=CENTER VALIGN=MIDDLE CLASS="orangeblock"><& .mechlabel, 
label => "exists:" &></TD>
-         <TH><CODE><% $directive |h%></CODE></TH><TD>
-       <CODE><% $1 |h%></CODE> is <A HREF="macros.html">macro-expanded</A>.
+         <TH><CODE><% $directive |h %></CODE></TH><TD>
+       <CODE><% $1 |h %></CODE> is <A HREF="macros.html">macro-expanded</A>.
        <BR>If the result has an A record, the transaction is approved.
       </TD></TR>
 %   }
 %
 %   elsif ($directive =~ /^([+~?-])all/) {
       <TR><TD ALIGN=CENTER VALIGN=MIDDLE CLASS="orangeblock"><& .mechlabel, 
label => "all" &></TD>
-         <TH><CODE><% $directive |h%></CODE></TH><TD>
+         <TH><CODE><% $directive |h %></CODE></TH><TD>
 %      if ($1 eq "+") {
                                                          The entire Internet 
is allowed to send mail from <% $Mydomain %>.
                                                         <BR>This is <BLINK>not 
recommended</BLINK>.
@@ -358,14 +363,14 @@
 %
 %   elsif ($directive =~ /^redirect=(\S+)/) {
       <TR><TD ALIGN=CENTER VALIGN=MIDDLE CLASS="orangeblock"><& .mechlabel, 
label => "redirect=" &></TD>
-         <TH><CODE><% $directive |h%></CODE></TH><TD>
+         <TH><CODE><% $directive |h %></CODE></TH><TD>
                                           Load the SPF record for <% $1 %> and 
execute it instead.
       </TD></TR>
 %   }
 %
 %   elsif ($directive =~ /^exp=(\S+)/) {
       <TR><TD ALIGN=CENTER VALIGN=MIDDLE CLASS="orangeblock"><& .mechlabel, 
label => "exp=" &></TD>
-         <TH><CODE><% $directive |h%></CODE></TH><TD>
+         <TH><CODE><% $directive |h %></CODE></TH><TD>
 %  my @txt_exp = "";
 % if (my $query = $res->query($1, "TXT")) { @txt_exp = map { join "", 
$_->char_str_list } grep { $_->type eq "TXT" } $query->answer }
                                           If the message is rejected, the 
explanation string
@@ -377,7 +382,7 @@
 %
 %   elsif ($directive =~ /^[^:\/]+=/) {
       <TR><TD ALIGN=CENTER VALIGN=MIDDLE CLASS="orangeblock"><& .mechlabel, 
label => "unknown-modifier" &></TD>
-         <TH><CODE><% $directive |h%></CODE></TH><TD>
+         <TH><CODE><% $directive |h %></CODE></TH><TD>
 %  my @txt_exp = "";
 % if (my $query = $res->query($1, "TXT")) { @txt_exp = map { join "", 
$_->char_str_list } grep { $_->type eq "TXT" } $query->answer }
                                           Unrecognized modifiers are ignored.
@@ -386,21 +391,21 @@
 %
 %   elsif ($directive =~ /^-/) {
       <TR><TD ALIGN=CENTER VALIGN=MIDDLE CLASS="orangeblock"><& .mechlabel, 
label => "fail" &></TD>
-         <TH><CODE><% $directive |h%></CODE></TH><TD>
+         <TH><CODE><% $directive |h %></CODE></TH><TD>
                                           If this directive matches, SPF will 
return "fail".
       </TD></TR>
 %   }
 %
 %   elsif ($directive =~ /^\?/) {
       <TR><TD ALIGN=CENTER VALIGN=MIDDLE CLASS="orangeblock"><& .mechlabel, 
label => "unknown-mechanism" &></TD>
-         <TH><CODE><% $directive |h%></CODE></TH><TD>
+         <TH><CODE><% $directive |h %></CODE></TH><TD>
                                           If this directive matches, SPF will 
return "unknown".
       </TD></TR>
 %   }
 %
 %   else {
       <TR><TD ALIGN=CENTER VALIGN=MIDDLE CLASS="orangeblock"><& .mechlabel, 
label => "unknown-mechanism" &></TD>
-         <TH><CODE><% $directive |h%></CODE></TH><TD>
+         <TH><CODE><% $directive |h %></CODE></TH><TD>
                                           An SPF client will abort if it 
encounters a mechanism it does not recognize.
       </TD></TR>
 %   }

-------
To unsubscribe, change your address, or temporarily deactivate your 
subscription, 
please go to http://v2.listbox.com/member/[EMAIL PROTECTED]

Reply via email to