[net-dns-users] How to translate the email in SOA

Dick Franks rwfranks at acm.org
Mon Jan 14 17:59:13 UTC 2013


Now I see the full picture!

On 11 January 2013 03:07, Feng He <fenghe at nsbeta.info> wrote:
[snip]
>
> I have been using nsupdate (which is called as an external command within
> Perl) to update the SOA record, so how to commit the encoded email string?

So the real issue is the inflexible RR parsing in nsupdate.

The solution is to produce a single line complete SOA record without
the brackets and other clutter which so upsets nsupdate.
See script example below.

Dick
--

  #!/usr/bin/perl

  use Net::DNS 0.71;

  my $resolver = new Net::DNS::Resolver();

  my $example = 'nsbeta.info';
  my $reply = $resolver->send( $example, 'SOA' ) || die 'no reply';
  my ($soa) = grep { $_->type eq 'SOA' } $reply->answer;

  $soa->rname( 'Feng He <Feng.He at nsbeta.info>' );

  print $soa->rname, "\n";

  print unformat( $soa->string ), "\n";


  sub unformat {
      join ' ', grep defined && length, split
/("[^"]*")|;[^\n]*|[()]|\s+/, shift;
  }



More information about the net-dns-users mailing list