Changeset 565


Ignore:
Timestamp:
12/19/13 16:27:22 (11 years ago)
Author:
Kris Deugau
Message:

/trunk

Edge case bug; databases upgraded from 1.0 to 1.2 schema will be missing
default reverse records. Fix the key bug of missing the SOA record by
adding one if it's missing on whatever entity one is editing. Other records
can be added as usual.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r561 r565  
    34983498
    34993499  eval {
    3500     my $sql = "UPDATE "._rectable($defrec, $revrec)." SET host=?, val=?, ttl=? WHERE record_id=? AND type=6";
    3501     $dbh->do($sql, undef, ("$soa{contact}:$soa{prins}", "$soa{refresh}:$soa{retry}:$soa{expire}:$soa{minttl}",
     3500    if (!$oldsoa) {
     3501      # old SOA record is missing for some reason.  create a new one.
     3502      my $sql = "INSERT INTO "._rectable($defrec, $revrec)." (group_id, host, type, val, ttl) VALUES (?,?,6,?,?)";
     3503      $dbh->do($sql, undef, ($soa{id}, "$soa{contact}:$soa{prins}",
     3504        "$soa{refresh}:$soa{retry}:$soa{expire}:$soa{minttl}", $soa{ttl}) );
     3505      $msg = ($defrec eq 'y' ? ($revrec eq 'y' ? 'Default reverse ' : 'Default ') : '').
     3506        "SOA missing for $parname;  added (ns $soa{prins}, contact $soa{contact}, refresh $soa{refresh},".
     3507        " retry $soa{retry}, expire $soa{expire}, minTTL $soa{minttl}, TTL $soa{ttl})";
     3508    } else {
     3509      my $sql = "UPDATE "._rectable($defrec, $revrec)." SET host=?, val=?, ttl=? WHERE record_id=? AND type=6";
     3510      $dbh->do($sql, undef, ("$soa{contact}:$soa{prins}", "$soa{refresh}:$soa{retry}:$soa{expire}:$soa{minttl}",
    35023511        $soa{ttl}, $oldsoa->{record_id}) );
    3503     $msg = "Updated ".($defrec eq 'y' ? ($revrec eq 'y' ? 'default reverse ' : 'default ') : '').
     3512      $msg = "Updated ".($defrec eq 'y' ? ($revrec eq 'y' ? 'default reverse ' : 'default ') : '').
    35043513        "SOA for $parname: ".
    35053514        "(ns $oldsoa->{prins}, contact $oldsoa->{contact}, refresh $oldsoa->{refresh},".
     
    35073516        "(ns $soa{prins}, contact $soa{contact}, refresh $soa{refresh},".
    35083517        " retry $soa{retry}, expire $soa{expire}, minTTL $soa{minttl}, TTL $soa{ttl})";
    3509 
     3518    }
    35103519    $logdata{entry} = $msg;
    35113520    $self->_log(%logdata);
Note: See TracChangeset for help on using the changeset viewer.