Thanks to visit codestin.com
Credit goes to github.com

Skip to content

NicToolServer::Import::tinydns MX and SRV issues #243

@rendest

Description

@rendest

Missing code for SRV import

       elsif ( $first eq 'S' ) {      #  SRV
            push @err, $self->zr_srv($record);
        }


Fixed srv import function (not sure why it borked)

sub zr_srv {
    my $self = shift;
    my $r = shift or die;

    print "SRV     : $r\n";
    my ($fqdn, $addr, $port, $priority, $weight, $ttl, $timestamp, $location) = split ':', $r;

    my ($zone_id, $host) = $self->get_zone_id( $fqdn );

    $self->nt_create_record(
        zone_id  => $zone_id,
        type     => 'SRV',
        name     => $host,
        address  => $self->fully_qualify( $addr ),
        weight   => $weight,
        priority => $priority,
        other    => $port,
        defined $ttl       ? ( ttl       => $ttl       ) : (),
        defined $timestamp ? ( timestamp => $timestamp ) : (),
        defined $location  ? ( location  => $location  ) : (),
    );
}

MX function also had a small issue (no variable IP, $addr was sufficient, caused distance to be address when importing)

sub zr_mx {
    my $self = shift;
    my $r = shift or die;

    print "MX      : $r\n";
    my ( $fqdn, $addr, $distance, $ttl, $timestamp, $location ) = split(':', $r);

    my ($zone_id, $host) = $self->get_zone_id( $fqdn );

    $self->nt_create_record(
        zone_id => $zone_id,
        type    => 'MX',
        name    => $host,
        address => $self->fully_qualify( $addr ),
        weight  => $distance || 0,
        defined $ttl       ? ( ttl       => $ttl       ) : (),
        defined $timestamp ? ( timestamp => $timestamp ) : (),
        defined $location  ? ( location  => $location  ) : (),
    );
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions