Changeset 944 for trunk


Ignore:
Timestamp:
09/19/23 10:40:24 (15 months ago)
Author:
Kris Deugau
Message:

/trunk

Fix an edge case updating rDNS on a netblock. If all but one per-IP field
is blank, and the remaining field is cleared, the removal wouldn't be sent
to dnsadmin because the hash wouldn't have that IP as a key.

Fixed with an extra flag field indicating "this IP had a DNS name", so we
can explicitly set the hash value to so it'll be cleared when passed
down the chain.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/main.cgi

    r939 r944  
    13571357  # collect per-IP rDNS fields.  only copy over the ones that actually have something in them.
    13581358  my %iprev;
    1359   foreach (keys %webvar) {
    1360     $iprev{$_} = $webvar{$_} if /host_[\d.a-fA-F:]+/ && $webvar{$_};
     1359  foreach (sort keys %webvar) {
     1360    # skip all but the host_* fields
     1361    next unless /^host_[\d.a-fA-F:]+/;
     1362    # propagate the per-IP rDNS if present
     1363    $iprev{$_} = $webvar{$_} if $webvar{$_};
     1364    # set the rDNS to be cleared if there was a value before (was_host_* field),
     1365    # but there's no value in the matching visible form field now (host_*)
     1366    $iprev{$_} = '' if $webvar{"was_$_"} && !$webvar{$_};
    13611367  }
    13621368
  • trunk/templates/edit.tmpl

    r938 r944  
    8282<tr>
    8383<td><TMPL_VAR NAME=r_ip></td>
    84 <td><input class="host" name="host_<TMPL_VAR NAME=r_ip>" value="<TMPL_VAR NAME=iphost>"></td>
     84<td><input class="host" name="host_<TMPL_VAR NAME=r_ip>" value="<TMPL_VAR NAME=iphost>">
     85<TMPL_IF iphost><input type="hidden" name="was_host_<TMPL_VAR NAME=r_ip>" value="1"></TMPL_IF></td>
    8586</tr>
    8687</TMPL_LOOP>
Note: See TracChangeset for help on using the changeset viewer.