Changeset 1002 for trunk/DNSDB.pm


Ignore:
Timestamp:
01/27/26 15:48:00 (3 days ago)
Author:
Kris Deugau
Message:

/trunk

Forcibly clean up some stray dashes in DNS labels so that downstream AXFR
consumers don't reject the zone.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r966 r1002  
    48164816  return ($retcode,$retmsg) if $retcode eq 'FAIL';
    48174817
     4818  # Minor cleanup of invalid DNS labels
     4819##fixme: seems like map should be used here to be decently Perlish, but any time I stick
     4820# a s/// inside the block map only returns the match/replace count instead of whatever
     4821# the changed $_ is for some reason
     4822  my @hbits = split '.', $host;
     4823  foreach (@hbits) {
     4824    s/^-+//;
     4825    s/-+$//;
     4826  }
     4827  $host = join '.', @hbits;
     4828
    48184829  # Set up database fields and bind parameters
    48194830  $fields .= "host,type,val,ttl,"._recparent($defrec,$revrec);
     
    49824993
    49834994  return ($retcode,$retmsg) if $retcode eq 'FAIL';
     4995
     4996  # Minor cleanup of invalid DNS labels
     4997##fixme: seems like map should be used here to be decently Perlish, but any time I stick
     4998# a s/// inside the block map only returns the match/replace count instead of whatever
     4999# the changed $_ is for some reason
     5000  my @hbits = split '.', $host;
     5001  foreach (@hbits) {
     5002    s/^-+//;
     5003    s/-+$//;
     5004  }
     5005  $host = join '.', @hbits;
    49845006
    49855007  # Set up database fields and bind parameters.  Note only the optional fields
Note: See TracChangeset for help on using the changeset viewer.