• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

PowerDNS / pdns / 18679017918

21 Oct 2025 09:15AM UTC coverage: 69.743% (+2.0%) from 67.713%
18679017918

Pull #16307

github

web-flow
Merge ba88af487 into da98764c6
Pull Request #16307: rec: explicit disabling/enabling of tls-gnutls for full and least configs and packages

26192 of 45526 branches covered (57.53%)

Branch coverage included in aggregate %.

6 of 6 new or added lines in 1 file covered. (100.0%)

2282 existing lines in 57 files now uncovered.

86265 of 115719 relevant lines covered (74.55%)

4323875.05 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

23.08
/pdns/zonemd.hh
1
/*
2
 * This file is part of PowerDNS or dnsdist.
3
 * Copyright -- PowerDNS.COM B.V. and its contributors
4
 *
5
 * This program is free software; you can redistribute it and/or modify
6
 * it under the terms of version 2 of the GNU General Public License as
7
 * published by the Free Software Foundation.
8
 *
9
 * In addition, for the avoidance of any doubt, permission is granted to
10
 * link this program with OpenSSL and to (re)distribute the binaries
11
 * produced as the result of such linking.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21
 */
22
#pragma once
23

24
#ifdef HAVE_CONFIG_H
25
#include "config.h"
26
#endif
27

28
#include "dnsname.hh"
29
#include "qtype.hh"
30
#include "dnsrecords.hh"
31
#include "validate.hh"
32

33
class ZoneParserTNG;
34

35
namespace pdns
36
{
37
class ZoneMD
38
{
39
public:
40
  enum class Config : uint8_t
41
  {
42
    Ignore,
43
    Validate,
44
    Require
45
  };
46
  enum class Result : uint8_t
47
  {
48
    OK,
49
    NoValidationDone,
50
    ValidationFailure
51
  };
52

53
  ZoneMD(ZoneName zone) :
54
    d_zone(std::move(zone))
55
  {}
13✔
56
  void readRecords(ZoneParserTNG& zpt);
57
  void readRecords(const std::vector<DNSRecord>& records);
58
  void readRecord(const DNSRecord& record);
59
  void processRecord(const DNSRecord& record);
60
  void verify(bool& validationDone, bool& validationOK);
61

62
  // Return the zone's apex DNSKEYs
63
  [[nodiscard]] const std::set<shared_ptr<const DNSKEYRecordContent>>& getDNSKEYs() const
UNCOV
64
  {
×
UNCOV
65
    return d_dnskeys;
×
UNCOV
66
  }
×
67

68
  // Return the zone's apex RRSIGs
69
  [[nodiscard]] const std::vector<shared_ptr<const RRSIGRecordContent>>& getRRSIGs(QType requestedType)
UNCOV
70
  {
×
UNCOV
71
    if (d_rrsigs.count(requestedType) == 0) {
×
UNCOV
72
      d_rrsigs[requestedType] = {};
×
UNCOV
73
    }
×
UNCOV
74
    return d_rrsigs[requestedType];
×
UNCOV
75
  }
×
76

77
  // Return the zone's apex ZONEMDs
78
  [[nodiscard]] std::vector<shared_ptr<const ZONEMDRecordContent>> getZONEMDs() const
UNCOV
79
  {
×
UNCOV
80
    std::vector<shared_ptr<const ZONEMDRecordContent>> ret;
×
UNCOV
81
    ret.reserve(d_zonemdRecords.size());
×
UNCOV
82
    for (const auto& zonemd : d_zonemdRecords) {
×
UNCOV
83
      ret.emplace_back(zonemd.second.record);
×
UNCOV
84
    }
×
UNCOV
85
    return ret;
×
UNCOV
86
  }
×
87

88
  // Return the zone's apex NSECs with signatures
89
  [[nodiscard]] const ContentSigPair& getNSECs() const
90
  {
×
91
    return d_nsecs;
×
92
  }
×
93

94
  // Return the zone's apex NSEC3s with signatures
95
  [[nodiscard]] const ContentSigPair& getNSEC3s() const
96
  {
×
97
    const auto item = d_nsec3s.find(d_nsec3label);
×
98
    return item == d_nsec3s.end() ? empty : d_nsec3s.at(d_nsec3label);
×
99
  }
×
100

101
  [[nodiscard]] const DNSName& getNSEC3Label() const
102
  {
×
103
    return d_nsec3label;
×
104
  }
×
105

106
  [[nodiscard]] const std::vector<shared_ptr<const NSEC3PARAMRecordContent>>& getNSEC3Params() const
107
  {
×
108
    return d_nsec3params;
×
109
  }
×
110

111
private:
112
  using RRSetKey_t = std::pair<DNSName, QType>;
113
  using RRVector_t = std::vector<std::shared_ptr<const DNSRecordContent>>;
114

115
  struct CanonRRSetKeyCompare
116
  {
117
    bool operator()(const RRSetKey_t& lhs, const RRSetKey_t& rhs) const
118
    {
1,038✔
119
      if (int rc = lhs.first.canonCompare_three_way(rhs.first); rc != 0) {
1,038✔
120
        return rc < 0;
639✔
121
      }
639✔
122
      return lhs.second < rhs.second;
399✔
123
    }
1,038✔
124
  };
125

126
  using RRSetMap_t = std::map<RRSetKey_t, RRVector_t, CanonRRSetKeyCompare>;
127

128
  struct ZoneMDAndDuplicateFlag
129
  {
130
    const std::shared_ptr<const ZONEMDRecordContent> record;
131
    bool duplicate;
132
  };
133

134
  // scheme,hashalgo -> zonemdrecord,duplicate
135
  std::map<pair<uint8_t, uint8_t>, ZoneMDAndDuplicateFlag> d_zonemdRecords;
136

137
  RRSetMap_t d_resourceRecordSets;
138
  std::map<RRSetKey_t, uint32_t> d_resourceRecordSetTTLs;
139

140
  std::shared_ptr<const SOARecordContent> d_soaRecordContent;
141
  std::set<shared_ptr<const DNSKEYRecordContent>> d_dnskeys;
142
  std::map<QType, std::vector<shared_ptr<const RRSIGRecordContent>>> d_rrsigs;
143
  std::vector<shared_ptr<const NSEC3PARAMRecordContent>> d_nsec3params;
144
  ContentSigPair d_nsecs;
145
  map<DNSName, ContentSigPair> d_nsec3s;
146
  DNSName d_nsec3label;
147
  const ZoneName d_zone;
148
  const ContentSigPair empty;
149
};
150

151
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc