in reply to deconstructing tinydns(djbdns) SRV records

Could it be that this is just a raw SRV record as it would go over the wire?

Have you tried converting it to its binary representation and then parsing it with (say) Net::DNS?

my $data = "\000\012\000\144\023\304\003pbx\007example\003com\000:3600 +"; ( $rr, $next ) = decode Net::DNS::RR( \$data, $offset, @opaque );

Replies are listed 'Best First'.
Re^2: deconstructing tinydns(djbdns) SRV records
by VinsWorldcom (Prior) on Aug 25, 2017 at 10:49 UTC

    I believe that is the "raw" format as it would go over the wire, but it's only the SRV record part, not the whole packet or whole DNS layer. Your solution above requires at least the whole DNS layer (if using $offset = 0) - at least that's they way I interpret it and according to a quick test, seems likely:

    corrupt wire-format data at C:/Strawberry/perl/vendor/lib/Net/DNS/RR.p +m line 241.

    You can try the Net::Frame::Layer::DNS module and it's NFL::DNS::RR::SRV sub module - you'll need the Net::Frame and Net::Frame::Simple modules as well (they will auto-install if you do a 'cpan Net::Frame::Layer::DNS' install as they are listed as dependencies) and they have dependencies themselves - so it may get a bit bigger than you need, but this works:

    #!perl use strict; use warnings; use Net::Frame::Simple; my $data = "\000\012\000\144\023\304\003pbx\007example\003com\000"; my $info = Net::Frame::Simple->new( raw => $data, firstLayer => 'DNS::RR::SRV', ); print $info->print;
    Output:
    DNS::RR::SRV: priority:10 weight:100 port:5060 DNS::RR::SRV: target:pbx.example.com

    UPDATE: Note the ':3600' is *not* part of the of the SRV rdata. It is part of the DNS Answer section so the $data in the OP isn't exactly the raw wire format.

Re^2: deconstructing tinydns(djbdns) SRV records
by 0xdeadbad (Novice) on Aug 25, 2017 at 10:44 UTC
    Thanks for responding so quickly!

    I'm not very familiar with Net::DNS but I tried your suggestion:
    my $data = "\000\012\000\144\023\304\003pbx\007example\003com\000:3600 +"; $offset=0; ( $rr, $next ) = decode Net::DNS::RR( \$data, $offset); print "RR = $rr\n"; print "NEXT = $next\n"; exit;

    corrupt wire-format data at /usr/lib64/perl5/vendor_perl/Net/DNS/RR.pm line 242.

      So either the data is not a raw SRV record or we are handing it in the wrong way to Net::DNS.

      Maybe you can find out from the documentation what exactly is stored in your LDAP directory?