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

PowerDNS / pdns / 13494306182

24 Feb 2025 09:01AM UTC coverage: 60.607% (-1.6%) from 62.24%
13494306182

Pull #15203

github

web-flow
Merge 023bafd01 into 83beff6d6
Pull Request #15203: rec: switch back to serde_yaml

34838 of 90428 branches covered (38.53%)

Branch coverage included in aggregate %.

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

6482 existing lines in 72 files now uncovered.

120907 of 166548 relevant lines covered (72.6%)

4692544.6 hits per line

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

5.0
/pdns/recursordist/validate-recursor.cc
1
#include "validate.hh"
2
#include "validate-recursor.hh"
3
#include "syncres.hh"
4
#include "logger.hh"
5
#include "rec-lua-conf.hh"
6
#include "dnssecinfra.hh"
7
#include "dnsseckeeper.hh"
8
#include "zoneparser-tng.hh"
9
#include "rec-tcounters.hh"
10

11
DNSSECMode g_dnssecmode{DNSSECMode::ProcessNoValidate};
12
bool g_dnssecLogBogus;
13

14
bool checkDNSSECDisabled()
UNCOV
15
{
×
UNCOV
16
  return g_dnssecmode == DNSSECMode::Off;
×
UNCOV
17
}
×
18

19
bool warnIfDNSSECDisabled(const string& msg)
UNCOV
20
{
×
UNCOV
21
  if (g_dnssecmode == DNSSECMode::Off) {
×
22
    if (!msg.empty()) {
×
23
      auto log = g_slog->withName("config");
×
24
      SLOG(g_log << Logger::Warning << msg << endl,
×
25
           log->info(Logr::Warning, msg));
×
26
    }
×
27
    return true;
×
28
  }
×
UNCOV
29
  return false;
×
UNCOV
30
}
×
31

32
vState increaseDNSSECStateCounter(const vState& state)
33
{
2,225✔
34
  t_Counters.at(rec::DNSSECHistogram::dnssec).at(state)++;
2,225✔
35
  return state;
2,225✔
36
}
2,225✔
37

38
vState increaseXDNSSECStateCounter(const vState& state)
39
{
×
40
  t_Counters.at(rec::DNSSECHistogram::xdnssec).at(state)++;
×
41
  return state;
×
42
}
×
43

44
// Returns true if dsAnchors were modified
45
bool updateTrustAnchorsFromFile(const std::string& fname, map<DNSName, dsset_t>& dsAnchors, Logr::log_t log)
UNCOV
46
{
×
UNCOV
47
  map<DNSName, dsset_t> newDSAnchors;
×
UNCOV
48
  try {
×
UNCOV
49
    auto zoneParser = ZoneParserTNG(fname);
×
UNCOV
50
    zoneParser.disableGenerate();
×
UNCOV
51
    DNSResourceRecord resourceRecord;
×
UNCOV
52
    DNSRecord dnsrecord;
×
UNCOV
53
    while (zoneParser.get(resourceRecord)) {
×
UNCOV
54
      dnsrecord = DNSRecord(resourceRecord);
×
UNCOV
55
      if (resourceRecord.qtype == QType::DS) {
×
UNCOV
56
        auto dsr = getRR<DSRecordContent>(dnsrecord);
×
UNCOV
57
        if (dsr == nullptr) {
×
58
          throw PDNSException("Unable to parse DS record '" + resourceRecord.qname.toString() + " " + resourceRecord.getZoneRepresentation() + "'");
×
59
        }
×
UNCOV
60
        newDSAnchors[resourceRecord.qname].insert(*dsr);
×
UNCOV
61
      }
×
UNCOV
62
      if (resourceRecord.qtype == QType::DNSKEY) {
×
UNCOV
63
        auto dnskeyr = getRR<DNSKEYRecordContent>(dnsrecord);
×
UNCOV
64
        if (dnskeyr == nullptr) {
×
65
          throw PDNSException("Unable to parse DNSKEY record '" + resourceRecord.qname.toString() + " " + resourceRecord.getZoneRepresentation() + "'");
×
66
        }
×
UNCOV
67
        auto dsr = makeDSFromDNSKey(resourceRecord.qname, *dnskeyr, DNSSECKeeper::DIGEST_SHA256);
×
UNCOV
68
        newDSAnchors[resourceRecord.qname].insert(std::move(dsr));
×
UNCOV
69
      }
×
UNCOV
70
    }
×
UNCOV
71
    if (dsAnchors == newDSAnchors) {
×
72
      SLOG(g_log << Logger::Debug << "Read Trust Anchors from file, no changes detected" << endl,
×
73
           log->info(Logr::Debug, "Read Trust Anchors from file, no changes detected"));
×
74
      return false;
×
75
    }
×
UNCOV
76
    SLOG(g_log << Logger::Info << "Read changed Trust Anchors from file, updating" << endl,
×
UNCOV
77
         log->info(Logr::Info, "Read changed Trust Anchors from file, updating"));
×
UNCOV
78
    dsAnchors = std::move(newDSAnchors);
×
UNCOV
79
    return true;
×
UNCOV
80
  }
×
UNCOV
81
  catch (const std::exception& e) {
×
82
    throw PDNSException("Error while reading Trust Anchors from file '" + fname + "': " + e.what());
×
83
  }
×
UNCOV
84
  catch (...) {
×
85
    throw PDNSException("Error while reading Trust Anchors from file '" + fname + "'");
×
86
  }
×
UNCOV
87
}
×
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