Changeset 531 for trunk


Ignore:
Timestamp:
07/24/13 12:25:40 (11 years ago)
Author:
Kris Deugau
Message:

/trunk

Accept bare @ as a hostname for domain entries. Store the @, and
convert to the domain name on export. See #18.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r529 r531  
    438438  # or the intended parent domain for live records.
    439439  my $pname = ($args{defrec} eq 'y' ? 'DOMAIN' : $self->domainName($args{id}));
    440   ${$args{host}} =~ s/\.*$/\.$pname/ if ${$args{host}} !~ /$pname$/;
     440  ${$args{host}} =~ s/\.*$/\.$pname/ if (${$args{host}} ne '@' && ${$args{host}} !~ /$pname$/);
    441441
    442442  # Check IP is well-formed, and that it's a v4 address
     
    36753675  return ('FAIL', "Hostnames may not contain anything other than (0-9 a-z . _)")
    36763676        if $defrec eq 'n' && ($revrec eq 'y' ? $$rectype != $reverse_typemap{TXT} : 1) &&
    3677                 $$host !~ /^[0-9a-z_%.-]+$/i;
     3677                $$host !~ /^(?:[0-9a-z_%.-]+|@)$/i;
    36783678
    36793679  # Collect these even if we're only doing a simple A record so we can call *any* validation sub
     
    38123812  return ('FAIL', "Hostnames may not contain anything other than (0-9 a-z - . _)")
    38133813        if $defrec eq 'n' && ($revrec eq 'y' ? $$rectype != $reverse_typemap{TXT} : 1) &&
    3814                 $$host !~ /^[0-9a-z_%.-]+$/i;
     3814                $$host !~ /^(?:[0-9a-z_%.-]+|@)$/i;
    38153815
    38163816  # only MX and SRV will use these
     
    50935093  my ($datafile,$revrec,$recflags,$zone,$host,$type,$val,$dist,$weight,$port,$ttl,$loc,$stamp) = @_;
    50945094
     5095  if ($revrec eq 'y') {
     5096    $val = $zone if $val eq '@';
     5097  } else {
     5098    $host = $zone if $host eq '@';
     5099  }
     5100
    50955101  ## Convert a bare number into an octal-coded pair of octets.
    50965102  # Take optional arg to indicate a decimal or hex input.  Defaults to hex.
Note: See TracChangeset for help on using the changeset viewer.