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

PowerDNS / pdns / 18743945403

23 Oct 2025 09:29AM UTC coverage: 65.845% (+0.02%) from 65.829%
18743945403

Pull #16356

github

web-flow
Merge 8a2027ef1 into efa3637e8
Pull Request #16356: auth 5.0: backport "pdnsutil: fix b2b-migrate to from sql to non-sql"

42073 of 92452 branches covered (45.51%)

Branch coverage included in aggregate %.

128008 of 165855 relevant lines covered (77.18%)

6379935.17 hits per line

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

63.75
/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()
15
{
1✔
16
  return g_dnssecmode == DNSSECMode::Off;
1✔
17
}
1✔
18

19
bool warnIfDNSSECDisabled(const string& msg)
20
{
3✔
21
  if (g_dnssecmode == DNSSECMode::Off) {
3!
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
  }
×
29
  return false;
3✔
30
}
3✔
31

32
vState increaseDNSSECStateCounter(const vState& state)
33
{
3,290✔
34
  t_Counters.at(rec::DNSSECHistogram::dnssec).at(state)++;
3,290✔
35
  return state;
3,290✔
36
}
3,290✔
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)
46
{
1✔
47
  map<DNSName, dsset_t> newDSAnchors;
1✔
48
  try {
1✔
49
    auto zoneParser = ZoneParserTNG(fname);
1✔
50
    zoneParser.disableGenerate();
1✔
51
    DNSResourceRecord resourceRecord;
1✔
52
    DNSRecord dnsrecord;
1✔
53
    while (zoneParser.get(resourceRecord)) {
4✔
54
      dnsrecord = DNSRecord(resourceRecord);
3✔
55
      if (resourceRecord.qtype == QType::DS) {
3✔
56
        auto dsr = getRR<DSRecordContent>(dnsrecord);
1✔
57
        if (dsr == nullptr) {
1!
58
          throw PDNSException("Unable to parse DS record '" + resourceRecord.qname.toString() + " " + resourceRecord.getZoneRepresentation() + "'");
×
59
        }
×
60
        newDSAnchors[resourceRecord.qname].insert(*dsr);
1✔
61
      }
1✔
62
      if (resourceRecord.qtype == QType::DNSKEY) {
3✔
63
        auto dnskeyr = getRR<DNSKEYRecordContent>(dnsrecord);
1✔
64
        if (dnskeyr == nullptr) {
1!
65
          throw PDNSException("Unable to parse DNSKEY record '" + resourceRecord.qname.toString() + " " + resourceRecord.getZoneRepresentation() + "'");
×
66
        }
×
67
        auto dsr = makeDSFromDNSKey(resourceRecord.qname, *dnskeyr, DNSSECKeeper::DIGEST_SHA256);
1✔
68
        newDSAnchors[resourceRecord.qname].insert(std::move(dsr));
1✔
69
      }
1✔
70
    }
3✔
71
    if (dsAnchors == newDSAnchors) {
1!
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
    }
×
76
    SLOG(g_log << Logger::Info << "Read changed Trust Anchors from file, updating" << endl,
1✔
77
         log->info(Logr::Info, "Read changed Trust Anchors from file, updating"));
1✔
78
    dsAnchors = std::move(newDSAnchors);
1✔
79
    return true;
1✔
80
  }
1✔
81
  catch (const std::exception& e) {
1✔
82
    throw PDNSException("Error while reading Trust Anchors from file '" + fname + "': " + e.what());
×
83
  }
×
84
  catch (...) {
1✔
85
    throw PDNSException("Error while reading Trust Anchors from file '" + fname + "'");
×
86
  }
×
87
}
1✔
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