From fa552262a421b71e83a0f91b30b442ec5f1732a0 Mon Sep 17 00:00:00 2001 From: Charles-Henri Bruyand Date: Thu, 22 Mar 2018 02:29:34 +0100 Subject: [PATCH] auth: add support for MB and MG RR types --- docs/upgrading.rst | 11 ++++++++++ modules/ldapbackend/dnsdomain2.schema | 20 ++++++++++++++++++- modules/ldapbackend/ldapbackend.hh | 4 ++++ pdns/dnsrecords.cc | 5 +++++ pdns/dnsrecords.hh | 18 +++++++++++++++++ pdns/qtype.hh | 4 ++++ .../tests/basic-mb-resolution/command | 2 ++ .../tests/basic-mb-resolution/description | 2 ++ .../tests/basic-mb-resolution/expected_result | 3 +++ .../tests/basic-mg-resolution/command | 2 ++ .../tests/basic-mg-resolution/description | 2 ++ .../tests/basic-mg-resolution/expected_result | 4 ++++ .../tests/basic-mr-resolution/command | 2 ++ .../tests/basic-mr-resolution/description | 2 ++ .../tests/basic-mr-resolution/expected_result | 3 +++ regression-tests/zones/example.com | 6 ++++++ 16 files changed, 89 insertions(+), 1 deletion(-) create mode 100755 regression-tests/tests/basic-mb-resolution/command create mode 100644 regression-tests/tests/basic-mb-resolution/description create mode 100644 regression-tests/tests/basic-mb-resolution/expected_result create mode 100755 regression-tests/tests/basic-mg-resolution/command create mode 100644 regression-tests/tests/basic-mg-resolution/description create mode 100644 regression-tests/tests/basic-mg-resolution/expected_result create mode 100755 regression-tests/tests/basic-mr-resolution/command create mode 100644 regression-tests/tests/basic-mr-resolution/description create mode 100644 regression-tests/tests/basic-mr-resolution/expected_result diff --git a/docs/upgrading.rst b/docs/upgrading.rst index a9ae0de6c..fe332108d 100644 --- a/docs/upgrading.rst +++ b/docs/upgrading.rst @@ -8,6 +8,17 @@ Please upgrade to the PowerDNS Authoritative Server 4.0.0 from 3.4.2+. See the `3.X `__ upgrade notes if your version is older than 3.4.2. +4.1.X to 4.2.0 +-------------- + +- *Your LDAP schema might need to be updated*, because new record types + have been added (see below). +- The :doc:`LDAP Backend ` now supports additional Record types + + - MB + - MG + - MR + 4.1.0 to 4.1.1 -------------- diff --git a/modules/ldapbackend/dnsdomain2.schema b/modules/ldapbackend/dnsdomain2.schema index 2c88c341b..2a2812ea3 100644 --- a/modules/ldapbackend/dnsdomain2.schema +++ b/modules/ldapbackend/dnsdomain2.schema @@ -14,6 +14,24 @@ attributetype ( 1.3.6.1.4.1.2428.20.0.1 NAME 'dNSClass' EQUALITY caseIgnoreIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) +attributetype ( 1.3.6.1.4.1.2428.20.1.7 NAME 'mBRecord' + DESC 'Location of a given domain e-mail address, RFC 1035' + EQUALITY caseIgnoreIA5Match + SUBSTR caseIgnoreIA5SubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) + +attributetype ( 1.3.6.1.4.1.2428.20.1.8 NAME 'mGRecord' + DESC 'Defines mailbox names that are part of a mail group, RFC 1035' + EQUALITY caseIgnoreIA5Match + SUBSTR caseIgnoreIA5SubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) + +attributetype ( 1.3.6.1.4.1.2428.20.1.9 NAME 'mRRecord' + DESC 'Defines aliased mailbox, RFC 1035' + EQUALITY caseIgnoreIA5Match + SUBSTR caseIgnoreIA5SubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 ) + attributetype ( 1.3.6.1.4.1.2428.20.1.11 NAME 'wKSRecord' DESC 'a well known service description, RFC 1035' EQUALITY caseIgnoreIA5Match @@ -279,5 +297,5 @@ objectclass ( 1.3.6.1.4.1.2428.20.2 NAME 'dNSDomain2' TLSARecord $ CDSRecord $ CDNSKEYRecord $ OPENPGPKEYRecord $ SPFRecord $ EUI48Record $ EUI64Record $ TKEYRecord $ URIRecord $ CAARecord $ DLVRecord $ TYPE65226Record $ - TYPE65534Record + TYPE65534Record $ MBRecord $ MGRecord $ MRRecord ) ) diff --git a/modules/ldapbackend/ldapbackend.hh b/modules/ldapbackend/ldapbackend.hh index d836ce8a9..0eed3b8d0 100644 --- a/modules/ldapbackend/ldapbackend.hh +++ b/modules/ldapbackend/ldapbackend.hh @@ -59,6 +59,10 @@ static const char* ldap_attrany[] = { "nSRecord", "cNAMERecord", "sOARecord", + "mBRecord", + "mGRecord", + "mRRecord", + "mInfoRecord", "pTRRecord", "hInfoRecord", "mXRecord", diff --git a/pdns/dnsrecords.cc b/pdns/dnsrecords.cc index 39e662a56..6ee780f21 100644 --- a/pdns/dnsrecords.cc +++ b/pdns/dnsrecords.cc @@ -139,6 +139,8 @@ boilerplate_conv(PTR, QType::PTR, conv.xfrName(d_content, true)); boilerplate_conv(CNAME, QType::CNAME, conv.xfrName(d_content, true)); boilerplate_conv(ALIAS, QType::ALIAS, conv.xfrName(d_content, false)); boilerplate_conv(DNAME, QType::DNAME, conv.xfrName(d_content)); +boilerplate_conv(MB, QType::MB, conv.xfrName(d_madname, true)); +boilerplate_conv(MG, QType::MG, conv.xfrName(d_mgmname, true)); boilerplate_conv(MR, QType::MR, conv.xfrName(d_alias, true)); boilerplate_conv(MINFO, QType::MINFO, conv.xfrName(d_rmailbx, true); conv.xfrName(d_emailbx, true)); boilerplate_conv(TXT, QType::TXT, conv.xfrText(d_text, true)); @@ -589,6 +591,9 @@ void reportBasicTypes() void reportOtherTypes() { + MBRecordContent::report(); + MGRecordContent::report(); + MRRecordContent::report(); AFSDBRecordContent::report(); DNAMERecordContent::report(); ALIASRecordContent::report(); diff --git a/pdns/dnsrecords.hh b/pdns/dnsrecords.hh index 42204280b..d402227f3 100644 --- a/pdns/dnsrecords.hh +++ b/pdns/dnsrecords.hh @@ -256,6 +256,24 @@ public: }; +class MBRecordContent : public DNSRecordContent +{ +public: + includeboilerplate(MB) + +private: + DNSName d_madname; +}; + +class MGRecordContent : public DNSRecordContent +{ +public: + includeboilerplate(MG) + +private: + DNSName d_mgmname; +}; + class MRRecordContent : public DNSRecordContent { public: diff --git a/pdns/qtype.hh b/pdns/qtype.hh index 5d3577fcf..8c5b162c3 100644 --- a/pdns/qtype.hh +++ b/pdns/qtype.hh @@ -76,6 +76,8 @@ public: NS=2, CNAME=5, SOA=6, + MB=7, + MG=8, MR=9, WKS=11, PTR=12, @@ -169,6 +171,8 @@ private: qtype_insert("NS", 2); qtype_insert("CNAME", 5); qtype_insert("SOA", 6); + qtype_insert("MB", 7); + qtype_insert("MG", 8); qtype_insert("MR", 9); qtype_insert("PTR", 12); qtype_insert("HINFO", 13); diff --git a/regression-tests/tests/basic-mb-resolution/command b/regression-tests/tests/basic-mb-resolution/command new file mode 100755 index 000000000..80e122b6a --- /dev/null +++ b/regression-tests/tests/basic-mb-resolution/command @@ -0,0 +1,2 @@ +#!/bin/sh +cleandig phil.mb.example.com MB diff --git a/regression-tests/tests/basic-mb-resolution/description b/regression-tests/tests/basic-mb-resolution/description new file mode 100644 index 000000000..8c8f1f45d --- /dev/null +++ b/regression-tests/tests/basic-mb-resolution/description @@ -0,0 +1,2 @@ +This test tries to resolve a straight MB record that is directly available in +the database. diff --git a/regression-tests/tests/basic-mb-resolution/expected_result b/regression-tests/tests/basic-mb-resolution/expected_result new file mode 100644 index 000000000..35f673359 --- /dev/null +++ b/regression-tests/tests/basic-mb-resolution/expected_result @@ -0,0 +1,3 @@ +0 phil.mb.example.com. IN MB 120 pc.mb.example.com. +Rcode: 0 (No Error), RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0 +Reply to question for qname='phil.mb.example.com.', qtype=MB diff --git a/regression-tests/tests/basic-mg-resolution/command b/regression-tests/tests/basic-mg-resolution/command new file mode 100755 index 000000000..768b44299 --- /dev/null +++ b/regression-tests/tests/basic-mg-resolution/command @@ -0,0 +1,2 @@ +#!/bin/sh +cleandig hostmaster.mb.example.com MG diff --git a/regression-tests/tests/basic-mg-resolution/description b/regression-tests/tests/basic-mg-resolution/description new file mode 100644 index 000000000..48e7904c6 --- /dev/null +++ b/regression-tests/tests/basic-mg-resolution/description @@ -0,0 +1,2 @@ +This test tries to resolve a straight MG record that is directly available in +the database. diff --git a/regression-tests/tests/basic-mg-resolution/expected_result b/regression-tests/tests/basic-mg-resolution/expected_result new file mode 100644 index 000000000..0fc0b5905 --- /dev/null +++ b/regression-tests/tests/basic-mg-resolution/expected_result @@ -0,0 +1,4 @@ +0 hostmaster.mb.example.com. IN MG 120 phil.mb.example.com. +0 hostmaster.mb.example.com. IN MG 120 sheila.mb.example.com. +Rcode: 0 (No Error), RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0 +Reply to question for qname='hostmaster.mb.example.com.', qtype=MG diff --git a/regression-tests/tests/basic-mr-resolution/command b/regression-tests/tests/basic-mr-resolution/command new file mode 100755 index 000000000..8b31474bd --- /dev/null +++ b/regression-tests/tests/basic-mr-resolution/command @@ -0,0 +1,2 @@ +#!/bin/sh +cleandig philip.mb.example.com MR diff --git a/regression-tests/tests/basic-mr-resolution/description b/regression-tests/tests/basic-mr-resolution/description new file mode 100644 index 000000000..b546dcb39 --- /dev/null +++ b/regression-tests/tests/basic-mr-resolution/description @@ -0,0 +1,2 @@ +This test tries to resolve a straight MR record that is directly available in +the database. diff --git a/regression-tests/tests/basic-mr-resolution/expected_result b/regression-tests/tests/basic-mr-resolution/expected_result new file mode 100644 index 000000000..b0b3b9c47 --- /dev/null +++ b/regression-tests/tests/basic-mr-resolution/expected_result @@ -0,0 +1,3 @@ +0 philip.mb.example.com. IN MR 120 phil.mb.example.com. +Rcode: 0 (No Error), RD: 0, QR: 1, TC: 0, AA: 1, opcode: 0 +Reply to question for qname='philip.mb.example.com.', qtype=MR diff --git a/regression-tests/zones/example.com b/regression-tests/zones/example.com index c73d392e6..a7667c9ad 100644 --- a/regression-tests/zones/example.com +++ b/regression-tests/zones/example.com @@ -20193,3 +20193,9 @@ rhs-at-expansion IN CNAME @ google-alias IN ALIAS google-public-dns-a.google.com. ; host-for-auto-ptr IN A 192.0.2.1 +; +phil.mb IN MB pc.mb.example.com. +sheila.mb IN MB bill.mb.example.com. +hostmaster.mb IN MG phil.mb.example.com. + IN MG sheila.mb.example.com. +philip.mb IN MR phil.mb.example.com. -- 2.40.0