Handle mismatched comment types properly
authorJamie Cameron <jcameron@webmin.com>
Fri, 25 Jun 2010 18:59:03 +0000 (11:59 -0700)
committerJamie Cameron <jcameron@webmin.com>
Fri, 25 Jun 2010 18:59:03 +0000 (11:59 -0700)
firewall/CHANGELOG
firewall/edit_rule.cgi
firewall/save_rule.cgi

index 270063a..35843e5 100644 (file)
@@ -33,3 +33,5 @@ Removed invalid "Above" options for packet flow rate.
 ---- Changes since 1.500 ----
 Added a button to move rules to another chain.
 Added a button to rename an existing custom chain.
+---- Changes since 1.510 ----
+Better handle the case where a rule has a --comment format description, but # format comments are enabled.
index eb01633..df6085c 100755 (executable)
@@ -38,7 +38,7 @@ print "<td>",$text{"index_chain_".lc($rule->{'chain'})} ||
             &text('index_chain', "<tt>$rule->{'chain'}</tt>"),"</td> </tr>\n";
 
 print "<tr> <td><b>$text{'edit_cmt'}</b></td>\n";
-if ($config{'comment_mod'}) {
+if ($config{'comment_mod'} || $rule->{'comment'}) {
        # Get comment from --comment option
        printf "<td><input name=cmt size=50 value='%s'></td> </tr>\n",
                &html_escape($rule->{'comment'}->[1]);
index a83c266..b45874c 100755 (executable)
@@ -40,6 +40,8 @@ else {
                }
        else {
                $rule->{'cmt'} = $in{'cmt'};
+               delete($rule->{'comment'});
+               @mods = grep { $_ ne "comment" } @mods;
                }
        if ($in{'jump'} eq '*') {
                $in{'other'} =~ /^\S+$/ || &error($text{'save_echain'});