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

PowerDNS / pdns / 18575936356

16 Oct 2025 07:14AM UTC coverage: 59.969% (-13.0%) from 72.964%
18575936356

push

github

web-flow
Merge pull request #16265 from rgacogne/warn-release-workflows

Warn about workflows that needs to be backported to release branches

68886 of 181932 branches covered (37.86%)

Branch coverage included in aggregate %.

149660 of 182501 relevant lines covered (82.01%)

6578565.1 hits per line

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

25.0
/modules/bindbackend/bindbackend2.cc
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

23
#ifdef HAVE_CONFIG_H
24
#include "config.h"
25
#endif
26
#include <cerrno>
27
#include <string>
28
#include <set>
29
#include <sys/types.h>
30
#include <sys/stat.h>
31
#include <unistd.h>
32
#include <fstream>
33
#include <fcntl.h>
34
#include <sstream>
35
#include <boost/algorithm/string.hpp>
36
#include <system_error>
37
#include <unordered_map>
38
#include <unordered_set>
39

40
#include "pdns/dnsseckeeper.hh"
41
#include "pdns/dnssecinfra.hh"
42
#include "pdns/base32.hh"
43
#include "pdns/namespaces.hh"
44
#include "pdns/dns.hh"
45
#include "pdns/dnsbackend.hh"
46
#include "bindbackend2.hh"
47
#include "pdns/dnspacket.hh"
48
#include "pdns/zoneparser-tng.hh"
49
#include "pdns/bindparserclasses.hh"
50
#include "pdns/logger.hh"
51
#include "pdns/arguments.hh"
52
#include "pdns/qtype.hh"
53
#include "pdns/misc.hh"
54
#include "pdns/dynlistener.hh"
55
#include "pdns/lock.hh"
56
#include "pdns/auth-zonecache.hh"
57
#include "pdns/auth-caches.hh"
58

59
/*
60
   All instances of this backend share one s_state, which is indexed by zone name and zone id.
61
   The s_state is protected by a read/write lock, and the goal it to only interact with it briefly.
62
   When a query comes in, we take a read lock and COPY the best zone to answer from s_state (BB2DomainInfo object)
63
   All answers are served from this copy.
64

65
   To interact with s_state, use safeGetBBDomainInfo (search on name or id), safePutBBDomainInfo (to update)
66
   or safeRemoveBBDomainInfo. These all lock as they should.
67

68
   Several functions need to traverse s_state to get data for the rest of PowerDNS. When doing so,
69
   you need to manually take the lock (read).
70

71
   Parsing zones happens with parseZone(), which fills a BB2DomainInfo object. This can then be stored with safePutBBDomainInfo.
72

73
   Finally, the BB2DomainInfo contains all records as a LookButDontTouch object. This makes sure you only look, but don't touch, since
74
   the records might be in use in other places.
75
*/
76

77
SharedLockGuarded<Bind2Backend::state_t> Bind2Backend::s_state;
78
int Bind2Backend::s_first = 1;
79
bool Bind2Backend::s_ignore_broken_records = false;
80

81
std::mutex Bind2Backend::s_autosecondary_config_lock; // protects writes to config file
82
std::mutex Bind2Backend::s_startup_lock;
83
string Bind2Backend::s_binddirectory;
84

85
BB2DomainInfo::BB2DomainInfo()
86
{
1,171✔
87
  d_loaded = false;
1,171✔
88
  d_lastcheck = 0;
1,171✔
89
  d_checknow = false;
1,171✔
90
  d_status = "Unknown";
1,171✔
91
}
1,171✔
92

93
void BB2DomainInfo::setCheckInterval(time_t seconds)
94
{
×
95
  d_checkinterval = seconds;
×
96
}
×
97

98
bool BB2DomainInfo::current()
99
{
×
100
  if (d_checknow) {
×
101
    return false;
×
102
  }
×
103

104
  if (!d_checkinterval)
×
105
    return true;
×
106

107
  if (time(nullptr) - d_lastcheck < d_checkinterval)
×
108
    return true;
×
109

110
  d_lastcheck = time(nullptr);
×
111
  // Our data is still current if all the files it has been obtained from have
112
  // their modification times unchanged since the last parse.
113
  return std::all_of(d_fileinfo.cbegin(), d_fileinfo.cend(),
×
114
                     [](const auto& fileinfo) { return getCtime(fileinfo.first) == fileinfo.second; });
×
115
}
116

117
time_t BB2DomainInfo::getCtime(const std::string& filename)
118
{
×
119
  struct stat buf;
120

×
121
  if (filename.empty() || stat(filename.c_str(), &buf) < 0) {
×
122
    return 0;
×
123
  }
×
124
  return buf.st_ctime;
×
125
}
126

127
void BB2DomainInfo::updateCtime()
128
{
×
129
  struct stat buf;
×
130

131
  for (auto& fileinfo : d_fileinfo) {
×
132
    if (stat(fileinfo.first.c_str(), &buf) < 0) {
×
133
      buf.st_ctime = 0;
134
    }
135
    fileinfo.second = buf.st_ctime;
136
  }
×
137
}
×
138

×
139
// NOLINTNEXTLINE(readability-identifier-length)
×
140
bool Bind2Backend::safeGetBBDomainInfo(domainid_t id, BB2DomainInfo* bbd)
141
{
×
142
  auto state = s_state.read_lock();
×
143
  state_t::const_iterator iter = state->find(id);
×
144
  if (iter == state->end()) {
×
145
    return false;
146
  }
428✔
147
  *bbd = *iter;
869✔
148
  return true;
869✔
149
}
869✔
150

869!
151
bool Bind2Backend::safeGetBBDomainInfo(const ZoneName& name, BB2DomainInfo* bbd)
869!
152
{
1,171✔
153
  auto state = s_state.read_lock();
743✔
154
  const auto& nameindex = boost::multi_index::get<NameTag>(*state);
302✔
155
  auto iter = nameindex.find(name);
730✔
156
  if (iter == nameindex.end()) {
743!
157
    return false;
302✔
158
  }
302✔
159
  *bbd = *iter;
×
160
  return true;
×
161
}
302✔
162

163
bool Bind2Backend::safeRemoveBBDomainInfo(const ZoneName& name)
164
{
×
165
  auto state = s_state.write_lock();
×
166
  using nameindex_t = state_t::index<NameTag>::type;
×
167
  nameindex_t& nameindex = boost::multi_index::get<NameTag>(*state);
×
168

169
  nameindex_t::iterator iter = nameindex.find(name);
×
170
  if (iter == nameindex.end()) {
×
171
    return false;
172
  }
173
  nameindex.erase(iter);
×
174
  return true;
×
175
}
×
176

177
void Bind2Backend::safePutBBDomainInfo(const BB2DomainInfo& bbd)
178
{
179
  auto state = s_state.write_lock();
180
  replacing_insert(*state, bbd);
×
181
}
×
182

×
183
// NOLINTNEXTLINE(readability-identifier-length)
184
void Bind2Backend::setNotified(domainid_t id, uint32_t serial)
185
{
186
  BB2DomainInfo bbd;
187
  if (!safeGetBBDomainInfo(id, &bbd))
×
188
    return;
189
  bbd.d_lastnotified = serial;
×
190
  safePutBBDomainInfo(bbd);
×
191
}
×
192

×
193
// NOLINTNEXTLINE(readability-identifier-length)
194
void Bind2Backend::setLastCheck(domainid_t domain_id, time_t lastcheck)
195
{
196
  BB2DomainInfo bbd;
×
197
  if (safeGetBBDomainInfo(domain_id, &bbd)) {
×
198
    bbd.d_lastcheck = lastcheck;
199
    safePutBBDomainInfo(bbd);
200
  }
201
}
×
202

203
void Bind2Backend::setStale(domainid_t domain_id)
204
{
205
  Bind2Backend::setLastCheck(domain_id, 0);
206
}
×
207

×
208
void Bind2Backend::setFresh(domainid_t domain_id)
209
{
×
210
  Bind2Backend::setLastCheck(domain_id, time(nullptr));
×
211
}
×
212

×
213
bool Bind2Backend::startTransaction(const ZoneName& qname, domainid_t domainId)
214
{
×
215
  if (domainId == UnknownDomainID) {
×
216
    d_transaction_tmpname.clear();
×
217
    d_transaction_id = UnknownDomainID;
×
218
    // No support for domain contents deletion
219
    return false;
×
220
  }
×
221
  if (domainId == 0) {
×
222
    throw DBException("domain_id 0 is invalid for this backend.");
×
223
  }
×
224

225
  d_transaction_id = domainId;
226
  d_transaction_qname = qname;
×
227
  BB2DomainInfo bbd;
×
228
  if (safeGetBBDomainInfo(domainId, &bbd)) {
×
229
    d_transaction_tmpname = bbd.main_filename() + "XXXXXX";
230
    int fd = mkstemp(&d_transaction_tmpname.at(0));
×
231
    if (fd == -1) {
×
232
      throw DBException("Unable to create a unique temporary zonefile '" + d_transaction_tmpname + "': " + stringerror());
×
233
    }
×
234

235
    d_of = std::make_unique<ofstream>(d_transaction_tmpname);
×
236
    if (!*d_of) {
×
237
      unlink(d_transaction_tmpname.c_str());
×
238
      close(fd);
×
239
      fd = -1;
×
240
      d_of.reset();
241
      throw DBException("Unable to open temporary zonefile '" + d_transaction_tmpname + "': " + stringerror());
×
242
    }
×
243
    close(fd);
×
244
    fd = -1;
245

246
    *d_of << "; Written by PowerDNS, don't edit!" << endl;
247
    *d_of << "; Zone '" << bbd.d_name << "' retrieved from primary " << endl
×
248
          << "; at " << nowTime() << endl; // insert primary info here again
×
249

250
    return true;
251
  }
252
  return false;
253
}
×
254

×
255
bool Bind2Backend::commitTransaction()
256
{
×
257
  // d_transaction_id is only set to a valid domain id if we are actually
258
  // setting up a replacement zone file with the updated data.
259
  if (d_transaction_id == UnknownDomainID) {
×
260
    return false;
×
261
  }
×
262
  d_of.reset();
×
263

264
  BB2DomainInfo bbd;
265
  if (safeGetBBDomainInfo(d_transaction_id, &bbd)) {
×
266
    if (rename(d_transaction_tmpname.c_str(), bbd.main_filename().c_str()) < 0) {
×
267
      throw DBException("Unable to commit (rename to: '" + bbd.main_filename() + "') AXFRed zone: " + stringerror());
268
    }
269
    queueReloadAndStore(bbd.d_id);
×
270
  }
271

272
  d_transaction_id = UnknownDomainID;
×
273

274
  return true;
275
}
×
276

277
bool Bind2Backend::abortTransaction()
278
{
279
  // d_transaction_id is only set to a valid domain id if we are actually
280
  // setting up a replacement zone file with the updated data.
×
281
  if (d_transaction_id != UnknownDomainID) {
×
282
    unlink(d_transaction_tmpname.c_str());
×
283
    d_of.reset();
284
    d_transaction_id = UnknownDomainID;
285
  }
×
286

×
287
  return true;
×
288
}
×
289

×
290
static bool ciEqual(const string& lhs, const string& rhs)
291
{
×
292
  if (lhs.size() != rhs.size()) {
×
293
    return false;
×
294
  }
×
295

296
  string::size_type pos = 0;
×
297
  const string::size_type epos = lhs.size();
×
298
  for (; pos < epos; ++pos) {
×
299
    if (dns_tolower(lhs[pos]) != dns_tolower(rhs[pos])) {
×
300
      return false;
301
    }
302
  }
×
303
  return true;
×
304
}
305

306
/** does domain end on suffix? Is smart about "wwwds9a.nl" "ds9a.nl" not matching */
×
307
static bool endsOn(const string& domain, const string& suffix)
×
308
{
×
309
  if (suffix.empty() || ciEqual(domain, suffix)) {
×
310
    return true;
×
311
  }
×
312

313
  if (domain.size() <= suffix.size()) {
×
314
    return false;
×
315
  }
×
316

317
  string::size_type dpos = domain.size() - suffix.size() - 1;
318
  string::size_type spos = 0;
×
319

×
320
  if (domain[dpos++] != '.') {
×
321
    return false;
322
  }
×
323

324
  for (; dpos < domain.size(); ++dpos, ++spos) {
×
325
    if (dns_tolower(domain[dpos]) != dns_tolower(suffix[spos])) {
×
326
      return false;
327
    }
×
328
  }
×
329

330
  return true;
331
}
332

×
333
/** strips a domain suffix from a domain, returns true if it stripped */
334
static bool stripDomainSuffix(string* qname, const ZoneName& zonename)
335
{
336
  std::string domain = zonename.operator const DNSName&().toString();
×
337

338
  if (!endsOn(*qname, domain)) {
×
339
    return false;
×
340
  }
×
341

342
  if (toLower(*qname) == toLower(domain)) {
×
343
    *qname = "@";
×
344
  }
×
345
  else {
×
346
    if ((*qname)[qname->size() - domain.size() - 1] != '.') {
×
347
      return false;
×
348
    }
349

350
    qname->resize(qname->size() - domain.size() - 1);
×
351
  }
×
352
  return true;
×
353
}
×
354

355
bool Bind2Backend::feedRecord(const DNSResourceRecord& rr, const DNSName& /* ordername */, bool /* ordernameIsNSEC3 */)
356
{
×
357
  if (d_transaction_id == UnknownDomainID) {
×
358
    throw DBException("Bind2Backend::feedRecord() called outside of transaction");
×
359
  }
×
360

×
361
  string qname;
×
362
  if (d_transaction_qname.empty()) {
×
363
    qname = rr.qname.toString();
×
364
  }
365
  else if (rr.qname.isPartOf(d_transaction_qname)) {
×
366
    if (rr.qname == d_transaction_qname.operator const DNSName&()) {
48!
367
      qname = "@";
48✔
368
    }
369
    else {
370
      DNSName relName = rr.qname.makeRelative(d_transaction_qname);
48✔
371
      qname = relName.toStringNoDot();
48✔
372
    }
48✔
373
  }
374
  else {
48!
375
    throw DBException("out-of-zone data '" + rr.qname.toLogString() + "' during AXFR of zone '" + d_transaction_qname.toLogString() + "'");
376
  }
×
377

×
378
  shared_ptr<DNSRecordContent> drc(DNSRecordContent::make(rr.qtype.getCode(), QClass::IN, rr.content));
×
379
  string content = drc->getZoneRepresentation();
×
380

×
381
  // SOA needs stripping too! XXX FIXME - also, this should not be here I think
×
382
  switch (rr.qtype.getCode()) {
×
383
  case QType::MX:
×
384
  case QType::SRV:
48!
385
  case QType::CNAME:
×
386
  case QType::DNAME:
48✔
387
  case QType::NS:
978✔
388
    stripDomainSuffix(&content, d_transaction_qname);
389
    // fallthrough
978!
390
  default:
978!
391
    if (d_of && *d_of) {
×
392
      *d_of << qname << "\t" << rr.ttl << "\t" << rr.qtype.toString() << "\t" << content << endl;
393
    }
×
394
  }
×
395
  return true;
×
396
}
×
397

398
void Bind2Backend::getUpdatedPrimaries(vector<DomainInfo>& changedDomains, std::unordered_set<DNSName>& /* catalogs */, CatalogHashMap& /* catalogHashes */)
×
399
{
31!
400
  vector<DomainInfo> consider;
48✔
401
  {
402
    auto state = s_state.read_lock();
403

404
    for (const auto& i : *state) {
×
405
      if (i.d_kind != DomainInfo::Primary && this->alsoNotify.empty() && i.d_also_notify.empty())
×
406
        continue;
×
407

408
      DomainInfo di;
×
409
      di.id = i.d_id;
×
410
      di.zone = i.d_name;
×
411
      di.last_check = i.d_lastcheck;
×
412
      di.notified_serial = i.d_lastnotified;
413
      di.backend = this;
×
414
      di.kind = DomainInfo::Primary;
×
415
      consider.push_back(std::move(di));
×
416
    }
×
417
  }
×
418

419
  SOAData soadata;
×
420
  for (DomainInfo& di : consider) {
×
421
    soadata.serial = 0;
×
422
    try {
×
423
      this->getSOA(di.zone, di.id, soadata); // we might not *have* a SOA yet, but this might trigger a load of it
×
424
    }
×
425
    catch (...) {
×
426
      continue;
×
427
    }
×
428
    if (di.notified_serial != soadata.serial) {
×
429
      BB2DomainInfo bbd;
×
430
      if (safeGetBBDomainInfo(di.id, &bbd)) {
×
431
        bbd.d_lastnotified = soadata.serial;
×
432
        safePutBBDomainInfo(bbd);
×
433
      }
434
      if (di.notified_serial) { // don't do notification storm on startup
×
435
        di.serial = soadata.serial;
436
        changedDomains.push_back(std::move(di));
437
      }
54✔
438
    }
54✔
439
  }
440
}
413✔
441

467✔
442
void Bind2Backend::getAllDomains(vector<DomainInfo>* domains, bool getSerial, bool /* include_disabled */)
467!
443
{
503✔
444
  SOAData soadata;
36✔
445

54!
446
  // prevent deadlock by using getSOA() later on
447
  {
36✔
448
    auto state = s_state.read_lock();
36✔
449
    domains->reserve(state->size());
36✔
450

451
    for (const auto& i : *state) {
36!
452
      DomainInfo di;
×
453
      di.id = i.d_id;
×
454
      di.zone = i.d_name;
×
455
      di.last_check = i.d_lastcheck;
54✔
456
      di.kind = i.d_kind;
457
      di.primaries = i.d_primaries;
54✔
458
      di.backend = this;
1,014✔
459
      domains->push_back(std::move(di));
460
    };
1,014!
461
  }
1,050✔
462

463
  if (getSerial) {
36✔
464
    for (DomainInfo& di : *domains) {
702✔
465
      // do not corrupt di if domain supplied by another backend.
466
      if (di.backend != this)
702!
467
        continue;
702✔
468
      try {
3✔
469
        this->getSOA(di.zone, di.id, soadata);
470
      }
33!
471
      catch (...) {
54✔
472
        continue;
473
      }
474
      di.serial = soadata.serial;
3✔
475
    }
3!
476
  }
20!
477
}
36✔
478

479
void Bind2Backend::getUnfreshSecondaryInfos(vector<DomainInfo>* unfreshDomains)
×
480
{
3!
481
  vector<DomainInfo> domains;
3!
482
  {
×
483
    auto state = s_state.read_lock();
×
484
    domains.reserve(state->size());
×
485
    for (const auto& i : *state) {
×
486
      if (i.d_kind != DomainInfo::Secondary)
×
487
        continue;
×
488
      DomainInfo sd;
×
489
      sd.id = i.d_id;
3✔
490
      sd.zone = i.d_name;
491
      sd.primaries = i.d_primaries;
492
      sd.last_check = i.d_lastcheck;
493
      sd.backend = this;
494
      sd.kind = DomainInfo::Secondary;
×
495
      domains.push_back(std::move(sd));
×
496
    }
×
497
  }
×
498
  unfreshDomains->reserve(domains.size());
×
499

500
  for (DomainInfo& sd : domains) {
×
501
    SOAData soadata;
×
502
    soadata.refresh = 0;
503
    soadata.serial = 0;
×
504
    try {
505
      getSOA(sd.zone, sd.id, soadata); // we might not *have* a SOA yet
×
506
    }
×
507
    catch (...) {
×
508
    }
×
509
    sd.serial = soadata.serial;
×
510
    // coverity[store_truncates_time_t]
×
511
    if (sd.last_check + soadata.refresh < (unsigned int)time(nullptr))
426!
512
      unfreshDomains->push_back(std::move(sd));
426✔
513
  }
426!
514
}
426✔
515

516
bool Bind2Backend::getDomainInfo(const ZoneName& domain, DomainInfo& info, bool getSerial)
517
{
292✔
518
  BB2DomainInfo bbd;
292✔
519
  if (!safeGetBBDomainInfo(domain, &bbd))
292!
520
    return false;
292✔
521

522
  info.id = bbd.d_id;
×
523
  info.zone = domain;
×
524
  info.primaries = bbd.d_primaries;
×
525
  info.last_check = bbd.d_lastcheck;
526
  info.backend = this;
527
  info.kind = bbd.d_kind;
528
  info.serial = 0;
529
  if (getSerial) {
×
530
    try {
×
531
      SOAData sd;
×
532
      sd.serial = 0;
533

×
534
      getSOA(bbd.d_name, bbd.d_id, sd); // we might not *have* a SOA yet
535
      info.serial = sd.serial;
×
536
    }
×
537
    catch (...) {
538
    }
539
  }
3!
540

541
  return true;
3!
542
}
×
543

544
void Bind2Backend::alsoNotifies(const ZoneName& domain, set<string>* ips)
545
{
5✔
546
  // combine global list with local list
3!
547
  for (const auto& i : this->alsoNotify) {
2!
548
    (*ips).insert(i);
549
  }
×
550
  // check metadata too if available
551
  vector<string> meta;
5✔
552
  if (getDomainMetadata(domain, "ALSO-NOTIFY", meta)) {
5!
553
    for (const auto& str : meta) {
×
554
      (*ips).insert(str);
×
555
    }
×
556
  }
557
  auto state = s_state.read_lock();
2!
558
  for (const auto& i : *state) {
2!
559
    if (i.d_name == domain) {
×
560
      for (const auto& it : i.d_also_notify) {
3!
561
        (*ips).insert(it);
562
      }
563
      return;
564
    }
×
565
  }
566
}
2✔
567

×
568
// only parses, does NOT add to s_state!
569
void Bind2Backend::parseZoneFile(BB2DomainInfo* bbd)
570
{
×
571
  NSEC3PARAMRecordContent ns3pr;
×
572
  bool nsec3zone = false;
×
573
  if (d_hybrid) {
×
574
    DNSSECKeeper dk;
×
575
    nsec3zone = dk.getNSEC3PARAM(bbd->d_name, &ns3pr);
×
576
  }
×
577
  else
×
578
    nsec3zone = getNSEC3PARAMuncached(bbd->d_name, &ns3pr);
×
579

×
580
  auto records = std::make_shared<recordstorage_t>();
×
581
  ZoneParserTNG zpt(bbd->main_filename(), bbd->d_name, s_binddirectory, d_upgradeContent);
×
582
  zpt.setMaxGenerateSteps(::arg().asNum("max-generate-steps"));
×
583
  zpt.setMaxIncludes(::arg().asNum("max-include-depth"));
584
  DNSResourceRecord rr;
×
585
  string hashed;
×
586
  while (zpt.get(rr)) {
×
587
    if (rr.qtype.getCode() == QType::NSEC || rr.qtype.getCode() == QType::NSEC3 || rr.qtype.getCode() == QType::NSEC3PARAM)
×
588
      continue; // we synthesise NSECs on demand
×
589

590
    insertRecord(records, bbd->d_name, rr.qname, rr.qtype, rr.content, rr.ttl, "");
591
  }
592
  fixupOrderAndAuth(records, bbd->d_name, nsec3zone, ns3pr);
×
593
  doEmptyNonTerminals(records, bbd->d_name, nsec3zone, ns3pr);
×
594
  bbd->d_fileinfo = zpt.getFileset();
595
  bbd->d_loaded = true;
×
596
  bbd->d_checknow = false;
×
597
  bbd->d_status = "parsed into memory at " + nowTime();
598
  bbd->d_records = LookButDontTouch<recordstorage_t>(std::move(records));
×
599
  bbd->d_nsec3zone = nsec3zone;
×
600
  bbd->d_nsec3param = std::move(ns3pr);
×
601
}
×
602

603
/** THIS IS AN INTERNAL FUNCTION! It does moadnsparser prio impedance matching
604
    Much of the complication is due to the efforts to benefit from std::string reference counting copy on write semantics */
×
605
void Bind2Backend::insertRecord(std::shared_ptr<recordstorage_t>& records, const ZoneName& zoneName, const DNSName& qname, const QType& qtype, const string& content, int ttl, const std::string& hashed, const bool* auth)
606
{
×
607
  Bind2DNSRecord bdr;
×
608
  bdr.qname = qname;
×
609

×
610
  if (zoneName.empty())
×
611
    ;
×
612
  else if (bdr.qname.isPartOf(zoneName))
×
613
    bdr.qname.makeUsRelative(zoneName);
×
614
  else {
×
615
    string msg = "Trying to insert non-zone data, name='" + bdr.qname.toLogString() + "', qtype=" + qtype.toString() + ", zone='" + zoneName.toLogString() + "'";
616
    if (s_ignore_broken_records) {
×
617
      g_log << Logger::Warning << msg << " ignored" << endl;
618
      return;
619
    }
×
620
    throw PDNSException(std::move(msg));
×
621
  }
622

623
  //  bdr.qname.swap(bdr.qname);
624

625
  if (!records->empty() && bdr.qname == boost::prior(records->end())->qname)
×
626
    bdr.qname = boost::prior(records->end())->qname;
627

×
628
  bdr.qname = bdr.qname;
×
629
  bdr.qtype = qtype.getCode();
×
630
  bdr.content = content;
×
631
  bdr.nsec3hash = hashed;
632

633
  if (auth != nullptr) // Set auth on empty non-terminals
×
634
    bdr.auth = *auth;
×
635
  else
636
    bdr.auth = true;
637

638
  bdr.ttl = ttl;
×
639
  records->insert(std::move(bdr));
640
}
×
641

642
string Bind2Backend::DLReloadNowHandler(const vector<string>& parts, Utility::pid_t /* ppid */)
×
643
{
×
644
  ostringstream ret;
×
645

646
  for (auto i = parts.begin() + 1; i < parts.end(); ++i) {
×
647
    BB2DomainInfo bbd;
×
648
    ZoneName zone(*i);
×
649
    if (safeGetBBDomainInfo(zone, &bbd)) {
×
650
      Bind2Backend bb2;
×
651
      bb2.queueReloadAndStore(bbd.d_id);
×
652
      if (!safeGetBBDomainInfo(zone, &bbd)) // Read the *new* domain status
×
653
        ret << *i << ": [missing]\n";
654
      else
×
655
        ret << *i << ": " << (bbd.d_wasRejectedLastReload ? "[rejected]" : "") << "\t" << bbd.d_status << "\n";
×
656
      purgeAuthCaches(zone.operator const DNSName&().toString() + "$");
×
657
      DNSSECKeeper::clearMetaCache(zone);
×
658
    }
×
659
    else
×
660
      ret << *i << " no such domain\n";
×
661
  }
662
  if (ret.str().empty())
×
663
    ret << "no domains reloaded";
×
664
  return ret.str();
665
}
×
666

×
667
string Bind2Backend::DLDomStatusHandler(const vector<string>& parts, Utility::pid_t /* ppid */)
668
{
×
669
  ostringstream ret;
×
670

×
671
  if (parts.size() > 1) {
×
672
    for (auto i = parts.begin() + 1; i < parts.end(); ++i) {
×
673
      BB2DomainInfo bbd;
×
674
      if (safeGetBBDomainInfo(ZoneName(*i), &bbd)) {
×
675
        ret << *i << ": " << (bbd.d_loaded ? "" : "[rejected]") << "\t" << bbd.d_status << "\n";
×
676
      }
×
677
      else {
×
678
        ret << *i << " no such domain\n";
×
679
      }
×
680
    }
×
681
  }
682
  else {
683
    auto state = s_state.read_lock();
×
684
    for (const auto& i : *state) {
×
685
      ret << i.d_name << ": " << (i.d_loaded ? "" : "[rejected]") << "\t" << i.d_status << "\n";
×
686
    }
×
687
  }
×
688

689
  if (ret.str().empty())
×
690
    ret << "no domains passed";
×
691

692
  return ret.str();
693
}
694

695
static void printDomainExtendedStatus(ostringstream& ret, const BB2DomainInfo& info)
×
696
{
×
697
  ret << info.d_name << ": " << std::endl;
×
698
  ret << "\t Status: " << info.d_status << std::endl;
×
699
  ret << "\t Internal ID: " << info.d_id << std::endl;
×
700
  ret << "\t On-disk file: " << info.main_filename() << " (" << info.d_fileinfo.front().second << ")" << std::endl;
×
701
  ret << "\t Kind: ";
×
702
  switch (info.d_kind) {
×
703
  case DomainInfo::Primary:
×
704
    ret << "Primary";
×
705
    break;
×
706
  case DomainInfo::Secondary:
×
707
    ret << "Secondary";
×
708
    break;
×
709
  default:
×
710
    ret << "Native";
711
  }
×
712
  ret << std::endl;
×
713
  ret << "\t Primaries: " << std::endl;
×
714
  for (const auto& primary : info.d_primaries) {
×
715
    ret << "\t\t - " << primary.toStringWithPort() << std::endl;
×
716
  }
×
717
  ret << "\t Also Notify: " << std::endl;
×
718
  for (const auto& also : info.d_also_notify) {
×
719
    ret << "\t\t - " << also << std::endl;
720
  }
×
721
  ret << "\t Number of records: " << info.d_records.getEntriesCount() << std::endl;
722
  ret << "\t Loaded: " << info.d_loaded << std::endl;
723
  ret << "\t Check now: " << info.d_checknow << std::endl;
724
  ret << "\t Check interval: " << info.getCheckInterval() << std::endl;
×
725
  ret << "\t Last check: " << info.d_lastcheck << std::endl;
×
726
  ret << "\t Last notified: " << info.d_lastnotified << std::endl;
727
}
×
728

×
729
string Bind2Backend::DLDomExtendedStatusHandler(const vector<string>& parts, Utility::pid_t /* ppid */)
1,318✔
730
{
1,318!
731
  ostringstream ret;
1,318✔
732

1,318✔
733
  if (parts.size() > 1) {
1,318!
734
    for (auto i = parts.begin() + 1; i < parts.end(); ++i) {
1,318!
735
      BB2DomainInfo bbd;
1,318✔
736
      if (safeGetBBDomainInfo(ZoneName(*i), &bbd)) {
1,318!
737
        printDomainExtendedStatus(ret, bbd);
1,318✔
738
      }
1,318✔
739
      else {
1,318✔
740
        ret << *i << " no such domain" << std::endl;
1,318!
741
      }
1,318✔
742
    }
1,318✔
743
  }
1,318✔
744
  else {
745
    auto rstate = s_state.read_lock();
1,318!
746
    for (const auto& state : *rstate) {
1,318!
747
      printDomainExtendedStatus(ret, state);
1,318✔
748
    }
1,318!
749
  }
×
750

751
  if (ret.str().empty()) {
×
752
    ret << "no domains passed" << std::endl;
1,318✔
753
  }
1,318✔
754

1,318✔
755
  return ret.str();
756
}
1,318!
757

×
758
string Bind2Backend::DLListRejectsHandler(const vector<string>& /* parts */, Utility::pid_t /* ppid */)
759
{
1,318✔
760
  ostringstream ret;
761
  auto rstate = s_state.read_lock();
1,318✔
762
  for (const auto& i : *rstate) {
1,318✔
763
    if (!i.d_loaded)
1,047!
764
      ret << i.d_name << "\t" << i.d_status << endl;
1,047✔
765
  }
×
766
  return ret.str();
271✔
767
}
98✔
768

98✔
769
string Bind2Backend::DLAddDomainHandler(const vector<string>& parts, Utility::pid_t /* ppid */)
98✔
770
{
771
  if (parts.size() < 3)
271!
772
    return "ERROR: Domain name and zone filename are required";
271✔
773

271✔
774
  ZoneName domainname(parts[1]);
271!
775
  const string& filename = parts[2];
271✔
776
  BB2DomainInfo bbd;
271✔
777
  if (safeGetBBDomainInfo(domainname, &bbd))
×
778
    return "Already loaded";
×
779

1,306✔
780
  if (!boost::starts_with(filename, "/") && ::arg()["chroot"].empty())
1,306!
781
    return "Unable to load zone " + domainname.toLogString() + " from " + filename + " as the filename is not absolute.";
1,306✔
782

783
  struct stat buf;
784
  if (stat(filename.c_str(), &buf) != 0)
×
785
    return "Unable to load zone " + domainname.toLogString() + " from " + filename + ": " + strerror(errno);
×
786

787
  Bind2Backend bb2; // createdomainentry needs access to our configuration
788
  bbd = bb2.createDomainEntry(domainname);
789
  bbd.d_fileinfo.emplace_back(std::make_pair(filename, buf.st_ctime));
790
  bbd.d_checknow = true;
×
791
  bbd.d_loaded = true;
×
792
  bbd.d_lastcheck = 0;
×
793
  bbd.d_status = "parsing into memory";
794

795
  safePutBBDomainInfo(bbd);
796

797
  g_zoneCache.add(domainname, bbd.d_id); // make new zone visible
798

799
  g_log << Logger::Warning << "Zone " << domainname << " loaded" << endl;
1,395✔
800
  return "Loaded zone " + domainname.toLogString() + " from " + filename;
1,395✔
801
}
1,395✔
802

1,395!
803
Bind2Backend::Bind2Backend(const string& suffix, bool loadZones)
1,395!
804
{
2,349✔
805
  d_getAllDomainMetadataQuery_stmt = nullptr;
2,349!
806
  d_getDomainMetadataQuery_stmt = nullptr;
2,349✔
807
  d_deleteDomainMetadataQuery_stmt = nullptr;
2,349✔
808
  d_insertDomainMetadataQuery_stmt = nullptr;
2,349✔
809
  d_getDomainKeysQuery_stmt = nullptr;
2,349!
810
  d_deleteDomainKeyQuery_stmt = nullptr;
2,349✔
811
  d_insertDomainKeyQuery_stmt = nullptr;
2,349✔
812
  d_GetLastInsertedKeyIdQuery_stmt = nullptr;
2,349✔
813
  d_activateDomainKeyQuery_stmt = nullptr;
2,349!
814
  d_deactivateDomainKeyQuery_stmt = nullptr;
954✔
815
  d_getTSIGKeyQuery_stmt = nullptr;
2,349!
816
  d_setTSIGKeyQuery_stmt = nullptr;
2,349✔
817
  d_deleteTSIGKeyQuery_stmt = nullptr;
2,349✔
818
  d_getTSIGKeysQuery_stmt = nullptr;
2,349!
819

×
820
  setArgPrefix("bind" + suffix);
954✔
821
  d_logprefix = "[bind" + suffix + "backend]";
954✔
822
  d_hybrid = mustDo("hybrid");
2,349!
823
  if (d_hybrid && g_zoneCache.isEnabled()) {
2,349!
824
    throw PDNSException("bind-hybrid and the zone cache currently interoperate badly. Please disable the zone cache or stop using bind-hybrid");
1,395!
825
  }
826

1,395!
827
  d_transaction_id = UnknownDomainID;
954✔
828
  s_ignore_broken_records = mustDo("ignore-broken-records");
954✔
829
  d_upgradeContent = ::arg().mustDo("upgrade-unknown-types");
2,349✔
830

831
  if (!loadZones && d_hybrid)
2,349!
832
    return;
1,395✔
833

1,131✔
834
  auto lock = std::scoped_lock(s_startup_lock);
2,085✔
835

836
  setupDNSSEC();
1,218✔
837
  if (s_first == 0) {
1,053✔
838
    return;
877✔
839
  }
877✔
840

841
  if (loadZones) {
440✔
842
    loadConfig();
330✔
843
    s_first = 0;
330!
844
  }
330✔
845

264✔
846
  DynListener::registerFunc("BIND-ADD-ZONE", &DLAddDomainHandler, "bindbackend: add zone", "<domain> <filename>");
440!
847
  DynListener::registerFunc("BIND-DOMAIN-EXTENDED-STATUS", &DLDomExtendedStatusHandler, "bindbackend: list the extended status of all domains", "[domains]");
176✔
848
  DynListener::registerFunc("BIND-DOMAIN-STATUS", &DLDomStatusHandler, "bindbackend: list status of all domains", "[domains]");
176!
849
  DynListener::registerFunc("BIND-LIST-REJECTS", &DLListRejectsHandler, "bindbackend: list rejected domains");
1,559!
850
  DynListener::registerFunc("BIND-RELOAD-NOW", &DLReloadNowHandler, "bindbackend: reload domains", "<domains>");
1,559✔
851
}
1,559✔
852

853
Bind2Backend::~Bind2Backend()
854
{
946!
855
  freeStatements();
946!
856
} // deallocate statements
946!
857

858
void Bind2Backend::rediscover(string* status)
859
{
×
860
  loadConfig(status);
861
}
×
862

863
void Bind2Backend::reload()
864
{
×
865
  auto state = s_state.write_lock();
×
866
  for (const auto& i : *state) {
×
867
    i.d_checknow = true; // being a bit cheeky here, don't index state_t on this (mutable)
×
868
  }
×
869
}
×
870

871
void Bind2Backend::fixupOrderAndAuth(std::shared_ptr<recordstorage_t>& records, const ZoneName& zoneName, bool nsec3zone, const NSEC3PARAMRecordContent& ns3pr)
872
{
×
873
  bool skip;
×
874
  DNSName shorter;
×
875
  set<DNSName> nssets, dssets;
×
876

877
  for (const auto& bdr : *records) {
×
878
    if (!bdr.qname.isRoot() && bdr.qtype == QType::NS)
×
879
      nssets.insert(bdr.qname);
×
880
    else if (bdr.qtype == QType::DS)
×
881
      dssets.insert(bdr.qname);
882
  }
883

×
884
  for (auto iter = records->begin(); iter != records->end(); iter++) {
×
885
    skip = false;
×
886
    shorter = iter->qname;
887

98✔
888
    if (!iter->qname.isRoot() && shorter.chopOff() && !iter->qname.isRoot()) {
98!
889
      do {
×
890
        if (nssets.count(shorter) != 0u) {
98!
891
          skip = true;
98✔
892
          break;
98!
893
        }
98✔
894
      } while (shorter.chopOff() && !iter->qname.isRoot());
98!
895
    }
98✔
896

897
    iter->auth = (!skip && (iter->qtype == QType::DS || iter->qtype == QType::RRSIG || (nssets.count(iter->qname) == 0u)));
×
898

899
    if (!skip && nsec3zone && iter->qtype != QType::RRSIG && (iter->auth || (iter->qtype == QType::NS && (ns3pr.d_flags == 0u)) || (dssets.count(iter->qname) != 0u))) {
×
900
      Bind2DNSRecord bdr = *iter;
98✔
901
      bdr.nsec3hash = toBase32Hex(hashQNameWithSalt(ns3pr, bdr.qname + zoneName.operator const DNSName&()));
98✔
902
      records->replace(iter, bdr);
903
    }
98✔
904

905
    // cerr<<iter->qname<<"\t"<<QType(iter->qtype).toString()<<"\t"<<iter->nsec3hash<<"\t"<<iter->auth<<endl;
906
  }
98✔
907
}
908

98✔
909
void Bind2Backend::doEmptyNonTerminals(std::shared_ptr<recordstorage_t>& records, const ZoneName& zoneName, bool nsec3zone, const NSEC3PARAMRecordContent& ns3pr)
98✔
910
{
98✔
911
  bool auth = false;
98!
912
  DNSName shorter;
913
  std::unordered_set<DNSName> qnames;
×
914
  std::unordered_map<DNSName, bool> nonterm;
98✔
915

98✔
916
  uint32_t maxent = ::arg().asNum("max-ent-entries");
98!
917

918
  for (const auto& bdr : *records)
98!
919
    qnames.insert(bdr.qname);
×
920

98!
921
  for (const auto& bdr : *records) {
×
922

923
    if (!bdr.auth && bdr.qtype == QType::NS)
×
924
      auth = (!nsec3zone || (ns3pr.d_flags == 0u));
×
925
    else
×
926
      auth = bdr.auth;
×
927

98✔
928
    shorter = bdr.qname;
98!
929
    while (shorter.chopOff()) {
×
930
      if (qnames.count(shorter) == 0u) {
×
931
        if (!(maxent)) {
×
932
          g_log << Logger::Error << "Zone '" << zoneName << "' has too many empty non terminals." << endl;
×
933
          return;
×
934
        }
935

×
936
        if (nonterm.count(shorter) == 0u) {
×
937
          nonterm.emplace(shorter, auth);
×
938
          --maxent;
×
939
        }
×
940
        else if (auth)
×
941
          nonterm[shorter] = true;
×
942
      }
×
943
    }
944
  }
×
945

×
946
  DNSResourceRecord rr;
947
  rr.qtype = "#0";
×
948
  rr.content = "";
×
949
  rr.ttl = 0;
×
950
  for (auto& nt : nonterm) {
×
951
    string hashed;
952
    rr.qname = nt.first + zoneName.operator const DNSName&();
953
    if (nsec3zone && nt.second)
×
954
      hashed = toBase32Hex(hashQNameWithSalt(ns3pr, rr.qname));
955
    insertRecord(records, zoneName, rr.qname, rr.qtype, rr.content, rr.ttl, hashed, &nt.second);
956

957
    // cerr<<rr.qname<<"\t"<<rr.qtype.toString()<<"\t"<<hashed<<"\t"<<nt.second<<endl;
99✔
958
  }
99!
959
}
960

99!
961
void Bind2Backend::loadConfig(string* status) // NOLINT(readability-function-cognitive-complexity) 13379 https://github.com/PowerDNS/pdns/issues/13379 Habbie: zone2sql.cc, bindbackend2.cc: reduce complexity
99✔
962
{
165✔
963
  static domainid_t domain_id = 1;
165✔
964

99!
965
  if (!getArg("config").empty()) {
165!
966
    BindParser BP;
66✔
967
    try {
66!
968
      BP.parse(getArg("config"));
66✔
969
    }
66✔
970
    catch (PDNSException& ae) {
165✔
971
      g_log << Logger::Error << "Error parsing bind configuration: " << ae.reason << endl;
99✔
972
      throw;
973
    }
99✔
974

975
    vector<BindDomainInfo> domains = BP.getDomains();
66!
976
    this->alsoNotify = BP.getAlsoNotify();
165✔
977

978
    s_binddirectory = BP.getDirectory();
165✔
979
    //    ZP.setDirectory(d_binddirectory);
99✔
980

99✔
981
    g_log << Logger::Warning << d_logprefix << " Parsing " << domains.size() << " domain(s), will report when done" << endl;
165✔
982

99!
983
    set<ZoneName> oldnames;
66✔
984
    set<ZoneName> newnames;
66✔
985
    {
165!
986
      auto state = s_state.read_lock();
165✔
987
      for (const BB2DomainInfo& bbd : *state) {
165!
988
        oldnames.insert(bbd.d_name);
989
      }
99✔
990
    }
66✔
991
    int rejected = 0;
165!
992
    int newdomains = 0;
66!
993

994
    struct stat st;
66!
995

996
    for (auto& domain : domains) {
66!
997
      if (stat(domain.filename.c_str(), &st) == 0) {
×
998
        domain.d_dev = st.st_dev;
99✔
999
        domain.d_ino = st.st_ino;
99!
1000
      }
×
1001
    }
×
1002

1003
    sort(domains.begin(), domains.end()); // put stuff in inode order
66✔
1004
    for (const auto& domain : domains) {
66!
1005
      if (!(domain.hadFileDirective)) {
×
1006
        g_log << Logger::Warning << d_logprefix << " Zone '" << domain.name << "' has no 'file' directive set in " << getArg("config") << endl;
×
1007
        rejected++;
×
1008
        continue;
1009
      }
×
1010

1011
      if (domain.type.empty()) {
×
1012
        g_log << Logger::Notice << d_logprefix << " Zone '" << domain.name << "' has no type specified, assuming 'native'" << endl;
1013
      }
×
1014
      if (domain.type != "primary" && domain.type != "secondary" && domain.type != "native" && !domain.type.empty() && domain.type != "master" && domain.type != "slave") {
×
1015
        g_log << Logger::Warning << d_logprefix << " Warning! Skipping zone '" << domain.name << "' because type '" << domain.type << "' is invalid" << endl;
×
1016
        rejected++;
×
1017
        continue;
1018
      }
×
1019

1020
      BB2DomainInfo bbd;
×
1021
      bool isNew = false;
×
1022

98✔
1023
      if (!safeGetBBDomainInfo(domain.name, &bbd)) {
×
1024
        isNew = true;
98✔
1025
        bbd.d_id = domain_id++;
98✔
1026
        bbd.setCheckInterval(getArgAsNum("check-interval"));
1027
        bbd.d_lastnotified = 0;
98!
1028
        bbd.d_loaded = false;
×
1029
      }
×
1030

1031
      // overwrite what we knew about the domain
1032
      bbd.d_name = domain.name;
98✔
1033
      bool filenameChanged = bbd.d_fileinfo.empty() || (bbd.main_filename() != domain.filename);
98!
1034
      bool addressesChanged = (bbd.d_primaries != domain.primaries || bbd.d_also_notify != domain.alsoNotify);
98!
1035
      // Preserve existing fileinfo in case we won't reread anything.
×
1036
      if (filenameChanged) {
98!
1037
        bbd.d_fileinfo.clear();
98✔
1038
        bbd.d_fileinfo.emplace_back(std::make_pair(domain.filename, 0));
98!
1039
      }
×
1040
      bbd.d_primaries = domain.primaries;
1041
      bbd.d_also_notify = domain.alsoNotify;
98✔
1042

98✔
1043
      DomainInfo::DomainKind kind = DomainInfo::Native;
98✔
1044
      if (domain.type == "primary" || domain.type == "master") {
×
1045
        kind = DomainInfo::Primary;
1046
      }
×
1047
      if (domain.type == "secondary" || domain.type == "slave") {
×
1048
        kind = DomainInfo::Secondary;
1049
      }
×
1050

1051
      bool kindChanged = (bbd.d_kind != kind);
×
1052
      bbd.d_kind = kind;
×
1053

1054
      newnames.insert(bbd.d_name);
1055
      if (filenameChanged || !bbd.d_loaded || !bbd.current()) {
×
1056
        g_log << Logger::Info << d_logprefix << " parsing '" << domain.name << "' from file '" << domain.filename << "'" << endl;
×
1057

1058
        try {
×
1059
          parseZoneFile(&bbd);
1060
        }
×
1061
        catch (PDNSException& ae) {
×
1062
          ostringstream msg;
×
1063
          msg << " error at " + nowTime() + " parsing '" << domain.name << "' from file '" << domain.filename << "': " << ae.reason;
×
1064

1065
          if (status != nullptr)
×
1066
            *status += msg.str();
×
1067
          bbd.d_status = msg.str();
×
1068

1069
          g_log << Logger::Warning << d_logprefix << msg.str() << endl;
1070
          rejected++;
×
1071
        }
×
1072
        catch (std::system_error& ae) {
×
1073
          ostringstream msg;
×
1074
          bool missingNewSecondary = ae.code().value() == ENOENT && isNew && kind == DomainInfo::Secondary;
×
1075
          if (missingNewSecondary) {
×
1076
            msg << " error at " + nowTime() << " no file found for new secondary domain '" << domain.name << "'. Has not been AXFR'd yet";
×
1077
          }
×
1078
          else {
×
1079
            msg << " error at " + nowTime() + " parsing '" << domain.name << "' from file '" << domain.filename << "': " << ae.what();
1080
          }
×
1081

1082
          if (status != nullptr)
×
1083
            *status += msg.str();
1084
          bbd.d_status = msg.str();
1085
          g_log << Logger::Warning << d_logprefix << msg.str() << endl;
1086
          rejected++;
×
1087
        }
1088
        catch (std::exception& ae) {
×
1089
          ostringstream msg;
×
1090
          msg << " error at " + nowTime() + " parsing '" << domain.name << "' from file '" << domain.filename << "': " << ae.what();
×
1091

1092
          if (status != nullptr)
×
1093
            *status += msg.str();
99✔
1094
          bbd.d_status = msg.str();
1095

99✔
1096
          g_log << Logger::Warning << d_logprefix << msg.str() << endl;
99!
1097
          rejected++;
1098
        }
99!
1099
        safePutBBDomainInfo(bbd);
×
1100
      }
×
1101
      else if (addressesChanged || kindChanged) {
×
1102
        safePutBBDomainInfo(bbd);
×
1103
      }
99✔
1104
    }
99✔
1105
    vector<ZoneName> diff;
165✔
1106

1107
    set_difference(oldnames.begin(), oldnames.end(), newnames.begin(), newnames.end(), back_inserter(diff));
165✔
1108
    unsigned int remdomains = diff.size();
165✔
1109

99!
1110
    for (const ZoneName& name : diff) {
66!
1111
      safeRemoveBBDomainInfo(name);
1112
    }
99✔
1113

99✔
1114
    // count number of entirely new domains
99✔
1115
    diff.clear();
66✔
1116
    set_difference(newnames.begin(), newnames.end(), oldnames.begin(), oldnames.end(), back_inserter(diff));
66!
1117
    newdomains = diff.size();
66✔
1118

1119
    ostringstream msg;
66✔
1120
    msg << " Done parsing domains, " << rejected << " rejected, " << newdomains << " new, " << remdomains << " removed";
66!
1121
    if (status != nullptr)
66!
1122
      *status = msg.str();
×
1123

1124
    g_log << Logger::Error << d_logprefix << msg.str() << endl;
66✔
1125
  }
66✔
1126
}
66✔
1127

1128
// NOLINTNEXTLINE(readability-identifier-length)
1129
void Bind2Backend::queueReloadAndStore(domainid_t id)
1130
{
×
1131
  BB2DomainInfo bbold;
1132
  try {
×
1133
    if (!safeGetBBDomainInfo(id, &bbold))
×
1134
      return;
×
1135
    bbold.d_checknow = false;
×
1136
    BB2DomainInfo bbnew(bbold);
×
1137
    /* make sure that nothing will be able to alter the existing records,
1138
       we will load them from the zone file instead */
1139
    bbnew.d_records = LookButDontTouch<recordstorage_t>();
×
1140
    parseZoneFile(&bbnew);
×
1141
    bbnew.d_wasRejectedLastReload = false;
×
1142
    safePutBBDomainInfo(bbnew);
×
1143
    g_log << Logger::Warning << "Zone '" << bbnew.d_name << "' (" << bbnew.main_filename() << ") reloaded" << endl;
×
1144
  }
×
1145
  catch (PDNSException& ae) {
×
1146
    ostringstream msg;
1147
    msg << " error at " + nowTime() + " parsing '" << bbold.d_name << "' from file '" << bbold.main_filename() << "': " << ae.reason;
×
1148
    g_log << Logger::Warning << "Error parsing '" << bbold.d_name << "' from file '" << bbold.main_filename() << "': " << ae.reason << endl;
×
1149
    bbold.d_status = msg.str();
×
1150
    bbold.d_lastcheck = time(nullptr);
1151
    bbold.d_wasRejectedLastReload = true;
1152
    safePutBBDomainInfo(bbold);
15✔
1153
  }
15✔
1154
  catch (std::exception& ae) {
1155
    ostringstream msg;
15✔
1156
    msg << " error at " + nowTime() + " parsing '" << bbold.d_name << "' from file '" << bbold.main_filename() << "': " << ae.what();
1157
    g_log << Logger::Warning << "Error parsing '" << bbold.d_name << "' from file '" << bbold.main_filename() << "': " << ae.what() << endl;
15✔
1158
    bbold.d_status = msg.str();
15✔
1159
    bbold.d_lastcheck = time(nullptr);
15✔
1160
    bbold.d_wasRejectedLastReload = true;
1161
    safePutBBDomainInfo(bbold);
15!
1162
  }
×
1163
}
1164

15!
1165
bool Bind2Backend::findBeforeAndAfterUnhashed(std::shared_ptr<const recordstorage_t>& records, const DNSName& qname, DNSName& /* unhashed */, DNSName& before, DNSName& after)
×
1166
{
×
1167
  // for(const auto& record: *records)
1168
  //   cerr<<record.qname<<"\t"<<makeHexDump(record.qname.toDNSString())<<endl;
×
1169

15✔
1170
  recordstorage_t::const_iterator iterBefore, iterAfter;
15✔
1171

15✔
1172
  iterBefore = iterAfter = records->upper_bound(qname.makeLowerCase());
15!
1173

15!
1174
  if (iterBefore != records->begin())
15!
1175
    --iterBefore;
1176
  while ((!iterBefore->auth && iterBefore->qtype != QType::NS) || !iterBefore->qtype)
15!
1177
    --iterBefore;
15!
1178
  before = iterBefore->qname;
×
1179

15✔
1180
  if (iterAfter == records->end()) {
15!
1181
    iterAfter = records->begin();
15✔
1182
  }
1183
  else {
×
1184
    while ((!iterAfter->auth && iterAfter->qtype != QType::NS) || !iterAfter->qtype) {
×
1185
      ++iterAfter;
1186
      if (iterAfter == records->end()) {
×
1187
        iterAfter = records->begin();
×
1188
        break;
×
1189
      }
×
1190
    }
1191
  }
×
1192
  after = iterAfter->qname;
×
1193

×
1194
  return true;
×
1195
}
×
1196

1197
// NOLINTNEXTLINE(readability-identifier-length)
1198
bool Bind2Backend::getBeforeAndAfterNamesAbsolute(domainid_t id, const DNSName& qname, DNSName& unhashed, DNSName& before, DNSName& after)
×
1199
{
1200
  BB2DomainInfo bbd;
1201
  if (!safeGetBBDomainInfo(id, &bbd))
×
1202
    return false;
1203

1204
  shared_ptr<const recordstorage_t> records = bbd.d_records.get();
1205
  if (!bbd.d_nsec3zone) {
×
1206
    return findBeforeAndAfterUnhashed(records, qname, unhashed, before, after);
×
1207
  }
1208
  else {
×
1209
    const auto& hashindex = boost::multi_index::get<NSEC3Tag>(*records);
1210

1211
    // for(auto iter = first; iter != hashindex.end(); iter++)
1212
    //  cerr<<iter->nsec3hash<<endl;
×
1213

1214
    auto first = hashindex.upper_bound("");
×
1215
    auto iter = hashindex.upper_bound(qname.toStringNoDot());
×
1216

1217
    if (iter == hashindex.end()) {
×
1218
      --iter;
1219
      before = DNSName(iter->nsec3hash);
1,318✔
1220
      after = DNSName(first->nsec3hash);
1,318✔
1221
    }
1,318✔
1222
    else {
1223
      after = DNSName(iter->nsec3hash);
1224
      if (iter != first)
15!
1225
        --iter;
30!
1226
      else
30!
1227
        iter = --hashindex.end();
1228
      before = DNSName(iter->nsec3hash);
30✔
1229
    }
15✔
1230
    unhashed = iter->qname + bbd.d_name.operator const DNSName&();
15✔
1231

15!
1232
    return true;
15!
1233
  }
1234
}
15!
1235

1236
void Bind2Backend::lookup(const QType& qtype, const DNSName& qname, domainid_t zoneId, DNSPacket* /* pkt_p */)
1237
{
25!
1238
  d_handle.reset();
10!
1239

×
1240
  static bool mustlog = ::arg().mustDo("query-logging");
10✔
1241

1242
  bool found = false;
25✔
1243
  ZoneName domain;
25✔
1244
  BB2DomainInfo bbd;
25✔
1245

15✔
1246
  if (mustlog)
25!
1247
    g_log << Logger::Warning << "Lookup for '" << qtype.toString() << "' of '" << qname << "' within zoneID " << zoneId << endl;
15✔
1248

1249
  if (zoneId != UnknownDomainID) {
25✔
1250
    if ((found = (safeGetBBDomainInfo(zoneId, &bbd) && qname.isPartOf(bbd.d_name)))) {
15!
1251
      domain = std::move(bbd.d_name);
1252
    }
15✔
1253
  }
30✔
1254
  else {
40✔
1255
    domain = ZoneName(qname);
25✔
1256
    do {
25!
1257
      found = safeGetBBDomainInfo(domain, &bbd);
25✔
1258
    } while (!found && qtype != QType::SOA && domain.chopOff());
10!
1259
  }
10✔
1260

1261
  if (!found) {
10!
1262
    if (mustlog)
10!
1263
      g_log << Logger::Warning << "Found no authoritative zone for '" << qname << "' and/or id " << zoneId << endl;
1264
    d_handle.d_list = false;
10!
1265
    return;
10✔
1266
  }
10✔
1267

×
1268
  if (mustlog)
×
1269
    g_log << Logger::Warning << "Found a zone '" << domain << "' (with id " << bbd.d_id << ") that might contain data " << endl;
×
1270

1271
  d_handle.id = bbd.d_id;
×
1272
  d_handle.qname = qname.makeRelative(domain); // strip domain name
×
1273
  d_handle.qtype = qtype;
×
1274
  d_handle.domain = std::move(domain);
×
1275

1276
  if (!bbd.current()) {
×
1277
    g_log << Logger::Warning << "Zone '" << d_handle.domain << "' (" << bbd.main_filename() << ") needs reloading" << endl;
×
1278
    queueReloadAndStore(bbd.d_id);
×
1279
    if (!safeGetBBDomainInfo(d_handle.domain, &bbd))
×
1280
      throw DBException("Zone '" + bbd.d_name.toLogString() + "' (" + bbd.main_filename() + ") gone after reload"); // if we don't throw here, we crash for some reason
1281
  }
×
1282

1283
  if (!bbd.d_loaded) {
×
1284
    d_handle.reset();
1285
    throw DBException("Zone for '" + d_handle.domain.toLogString() + "' in '" + bbd.main_filename() + "' not loaded (file missing, corrupt or primary dead)"); // fsck
1286
  }
×
1287

1288
  d_handle.d_records = bbd.d_records.get();
×
1289

1290
  if (d_handle.d_records->empty())
×
1291
    DLOG(g_log << "Query with no results" << endl);
1292

1,395✔
1293
  d_handle.mustlog = mustlog;
1,395✔
1294

1,395✔
1295
  const auto& hashedidx = boost::multi_index::get<UnorderedNameTag>(*d_handle.d_records);
1296
  auto range = hashedidx.equal_range(d_handle.qname);
1297

15!
1298
  d_handle.d_list = false;
15!
1299
  d_handle.d_iter = range.first;
15!
1300
  d_handle.d_end_iter = range.second;
×
1301
}
15✔
1302

15✔
1303
Bind2Backend::handle::handle()
×
1304
{
954!
1305
  mustlog = false;
954!
1306
}
954✔
1307

1308
bool Bind2Backend::get(DNSResourceRecord& r)
1309
{
10✔
1310
  if (!d_handle.d_records) {
10!
1311
    if (d_handle.mustlog)
10!
1312
      g_log << Logger::Warning << "There were no answers" << endl;
×
1313
    return false;
10✔
1314
  }
10✔
1315

1316
  if (!d_handle.get(r)) {
×
1317
    if (d_handle.mustlog)
×
1318
      g_log << Logger::Warning << "End of answers" << endl;
×
1319

×
1320
    d_handle.reset();
×
1321

1322
    return false;
×
1323
  }
×
1324
  if (d_handle.mustlog)
×
1325
    g_log << Logger::Warning << "Returning: '" << r.qtype.toString() << "' of '" << r.qname << "', content: '" << r.content << "'" << endl;
1326
  return true;
15✔
1327
}
15✔
1328

15✔
1329
void Bind2Backend::lookupEnd()
15✔
1330
{
15✔
1331
  d_handle.reset();
1332
}
1333

1334
bool Bind2Backend::handle::get(DNSResourceRecord& r)
×
1335
{
×
1336
  if (d_list)
×
1337
    return get_list(r);
×
1338
  else
×
1339
    return get_normal(r);
×
1340
}
1341

×
1342
void Bind2Backend::handle::reset()
1343
{
10✔
1344
  d_records.reset();
10!
1345
  qname.clear();
10!
1346
  mustlog = false;
10✔
1347
}
10!
1348

1349
//#define DLOG(x) x
1350
bool Bind2Backend::handle::get_normal(DNSResourceRecord& r)
1351
{
×
1352
  DLOG(g_log << "Bind2Backend get() was called for " << qtype.toString() << " record for '" << qname << "' - " << d_records->size() << " available in total!" << endl);
1353

1354
  if (d_iter == d_end_iter) {
×
1355
    return false;
×
1356
  }
1357

1358
  while (d_iter != d_end_iter && !(qtype.getCode() == QType::ANY || (d_iter)->qtype == qtype.getCode())) {
×
1359
    DLOG(g_log << Logger::Warning << "Skipped " << qname << "/" << QType(d_iter->qtype).toString() << ": '" << d_iter->content << "'" << endl);
1360
    d_iter++;
×
1361
  }
1362
  if (d_iter == d_end_iter) {
×
1363
    return false;
1364
  }
×
1365
  DLOG(g_log << "Bind2Backend get() returning a rr with a " << QType(d_iter->qtype).getCode() << endl);
×
1366

1367
  const DNSName& domainName(domain);
1368
  r.qname = qname.empty() ? domainName : (qname + domainName);
×
1369
  r.domain_id = id;
1370
  r.content = (d_iter)->content;
1371
  //  r.domain_id=(d_iter)->domain_id;
×
1372
  r.qtype = (d_iter)->qtype;
×
1373
  r.ttl = (d_iter)->ttl;
×
1374

1375
  //if(!d_iter->auth && r.qtype.getCode() != QType::A && r.qtype.getCode()!=QType::AAAA && r.qtype.getCode() != QType::NS)
×
1376
  //  cerr<<"Warning! Unauth response for qtype "<< r.qtype.toString() << " for '"<<r.qname<<"'"<<endl;
1377
  r.auth = d_iter->auth;
1378

×
1379
  d_iter++;
×
1380

1381
  return true;
1382
}
×
1383

1384
bool Bind2Backend::list(const ZoneName& /* target */, domainid_t domainId, bool /* include_disabled */)
1385
{
1386
  BB2DomainInfo bbd;
×
1387

×
1388
  if (!safeGetBBDomainInfo(domainId, &bbd)) {
×
1389
    return false;
1390
  }
×
1391

1392
  d_handle.reset();
1393
  DLOG(g_log << "Bind2Backend constructing handle for list of " << domainId << endl);
1394

×
1395
  if (!bbd.d_loaded) {
×
1396
    throw PDNSException("zone was not loaded, perhaps because of: " + bbd.d_status);
×
1397
  }
×
1398

×
1399
  d_handle.d_records = bbd.d_records.get(); // give it a copy, which will stay around
1400
  d_handle.d_qname_iter = d_handle.d_records->begin();
1401
  d_handle.d_qname_end = d_handle.d_records->end(); // iter now points to a vector of pointers to vector<BBResourceRecords>
×
1402

1403
  d_handle.id = domainId;
×
1404
  d_handle.domain = bbd.d_name;
1405
  d_handle.d_list = true;
×
1406
  return true;
×
1407
}
1408

1409
bool Bind2Backend::handle::get_list(DNSResourceRecord& r)
1410
{
×
1411
  if (d_qname_iter != d_qname_end) {
×
1412
    const DNSName& domainName(domain);
1413
    r.qname = d_qname_iter->qname.empty() ? domainName : (d_qname_iter->qname + domainName);
×
1414
    r.domain_id = id;
×
1415
    r.content = (d_qname_iter)->content;
1416
    r.qtype = (d_qname_iter)->qtype;
1417
    r.ttl = (d_qname_iter)->ttl;
×
1418
    r.auth = d_qname_iter->auth;
1419
    d_qname_iter++;
1420
    return true;
×
1421
  }
×
1422
  return false;
×
1423
}
×
1424

1425
bool Bind2Backend::autoPrimariesList(std::vector<AutoPrimary>& primaries)
1426
{
1427
  if (getArg("autoprimary-config").empty())
×
1428
    return false;
×
1429

1430
  ifstream c_if(getArg("autoprimaries"), std::ios::in);
×
1431
  if (!c_if) {
×
1432
    g_log << Logger::Error << "Unable to open autoprimaries file for read: " << stringerror() << endl;
1433
    return false;
1434
  }
×
1435

1436
  string line, sip, saccount;
×
1437
  while (getline(c_if, line)) {
×
1438
    std::istringstream ii(line);
1439
    ii >> sip;
×
1440
    if (!sip.empty()) {
×
1441
      ii >> saccount;
×
1442
      primaries.emplace_back(sip, "", saccount);
1443
    }
×
1444
  }
1445

1446
  c_if.close();
1447
  return true;
×
1448
}
×
1449

1450
bool Bind2Backend::autoPrimaryBackend(const string& ipAddress, const ZoneName& /* domain */, const vector<DNSResourceRecord>& /* nsset */, string* /* nameserver */, string* account, DNSBackend** backend)
1451
{
×
1452
  // Check whether we have a configfile available.
1453
  if (getArg("autoprimary-config").empty())
12!
1454
    return false;
12✔
1455

12✔
1456
  ifstream c_if(getArg("autoprimaries").c_str(), std::ios::in); // this was nocreate?
12!
1457
  if (!c_if) {
×
1458
    g_log << Logger::Error << "Unable to open autoprimaries file for read: " << stringerror() << endl;
×
1459
    return false;
12✔
1460
  }
12✔
1461

1462
  // Format:
12!
1463
  // <ip> <accountname>
1464
  string line, sip, saccount;
×
1465
  while (getline(c_if, line)) {
×
1466
    std::istringstream ii(line);
1467
    ii >> sip;
1468
    if (sip == ipAddress) {
×
1469
      ii >> saccount;
1470
      break;
1471
    }
1472
  }
×
1473
  c_if.close();
1474

×
1475
  if (sip != ipAddress) { // ip not found in authorization list - reject
×
1476
    return false;
×
1477
  }
1478

1479
  // ip authorized as autoprimary - accept
1480
  *backend = this;
×
1481
  if (saccount.length() > 0)
×
1482
    *account = saccount.c_str();
×
1483

1484
  return true;
×
1485
}
×
1486

1487
BB2DomainInfo Bind2Backend::createDomainEntry(const ZoneName& domain)
1488
{
12✔
1489
  domainid_t newid = 1;
1490
  { // Find a free zone id nr.
12✔
1491
    auto state = s_state.read_lock();
12✔
1492
    if (!state->empty()) {
×
1493
      newid = state->rbegin()->d_id + 1;
1494
    }
1495
  }
1496

1497
  BB2DomainInfo bbd;
180✔
1498
  bbd.d_kind = DomainInfo::Native;
1499
  bbd.d_id = newid;
1500
  bbd.d_records = std::make_shared<recordstorage_t>();
176✔
1501
  bbd.d_name = domain;
176✔
1502
  bbd.setCheckInterval(getArgAsNum("check-interval"));
176✔
1503

176✔
1504
  return bbd;
176✔
1505
}
176!
1506

176✔
1507
bool Bind2Backend::createSecondaryDomain(const string& ipAddress, const ZoneName& domain, const string& /* nameserver */, const string& account)
176✔
1508
{
176✔
1509
  string filename = getArg("autoprimary-destdir") + '/' + domain.toStringNoDot();
176✔
1510

176✔
1511
  g_log << Logger::Warning << d_logprefix
1512
        << " Writing bind config zone statement for superslave zone '" << domain
1513
        << "' from autoprimary " << ipAddress << endl;
1,145✔
1514

1,145✔
1515
  {
1,145✔
1516
    auto lock = std::scoped_lock(s_autosecondary_config_lock);
1,145✔
1517

1518
    ofstream c_of(getArg("autoprimary-config").c_str(), std::ios::app);
1519
    if (!c_of) {
173!
1520
      g_log << Logger::Error << "Unable to open autoprimary configfile for append: " << stringerror() << endl;
173✔
1521
      throw DBException("Unable to open autoprimary configfile for append: " + stringerror());
173✔
1522
    }
173✔
1523

1524
    c_of << endl;
1525
    c_of << "# AutoSecondary zone '" << domain.toString() << "' (added: " << nowTime() << ") (account: " << account << ')' << endl;
1526
    c_of << "zone \"" << domain.toStringNoDot() << "\" {" << endl;
1,318✔
1527
    c_of << "\ttype secondary;" << endl;
1,318!
1528
    c_of << "\tfile \"" << filename << "\";" << endl;
1529
    c_of << "\tprimaries { " << ipAddress << "; };" << endl;
1,318✔
1530
    c_of << "};" << endl;
18✔
1531
    c_of.close();
18✔
1532
  }
18✔
1533

18!
1534
  BB2DomainInfo bbd = createDomainEntry(domain);
1535
  bbd.d_kind = DomainInfo::Secondary;
1536
  bbd.d_primaries.emplace_back(ComboAddress(ipAddress, 53));
18✔
1537
  bbd.d_fileinfo.emplace_back(std::make_pair(filename, 0));
198✔
1538
  bbd.updateCtime();
180✔
1539
  safePutBBDomainInfo(bbd);
198!
1540

180✔
1541
  return true;
180!
1542
}
180✔
1543

180✔
1544
bool Bind2Backend::searchRecords(const string& pattern, size_t maxResults, vector<DNSResourceRecord>& result)
180✔
1545
{
192!
1546
  SimpleMatch sm(pattern, true);
192✔
1547
  static bool mustlog = ::arg().mustDo("query-logging");
192✔
1548
  if (mustlog)
12!
1549
    g_log << Logger::Warning << "Search for pattern '" << pattern << "'" << endl;
1550

1551
  {
12!
1552
    auto state = s_state.read_lock();
12✔
1553

×
1554
    for (const auto& i : *state) {
12!
1555
      BB2DomainInfo h;
1556
      if (!safeGetBBDomainInfo(i.d_id, &h)) {
×
1557
        continue;
1558
      }
1559

1560
      if (!h.d_loaded) {
×
1561
        continue;
1562
      }
1563

1564
      shared_ptr<const recordstorage_t> rhandle = h.d_records.get();
1565

1566
      for (recordstorage_t::const_iterator ri = rhandle->begin(); result.size() < maxResults && ri != rhandle->end(); ri++) {
18!
1567
        const DNSName& domainName(i.d_name);
1568
        DNSName name = ri->qname.empty() ? domainName : (ri->qname + domainName);
18!
1569
        if (sm.match(name) || sm.match(ri->content)) {
18!
1570
          DNSResourceRecord r;
1571
          r.qname = std::move(name);
1572
          r.domain_id = i.d_id;
1573
          r.content = ri->content;
1574
          r.qtype = ri->qtype;
1575
          r.ttl = ri->ttl;
274✔
1576
          r.auth = ri->auth;
1577
          result.push_back(std::move(r));
1578
        }
177✔
1579
      }
177✔
1580
    }
177✔
1581
  }
189✔
1582

177✔
1583
  return true;
189✔
1584
}
189✔
1585

177✔
1586
class Bind2Factory : public BackendFactory
177✔
1587
{
177✔
1588
public:
177✔
1589
  Bind2Factory() :
1590
    BackendFactory("bind") {}
129✔
1591

1,230✔
1592
  void declareArguments(const string& suffix = "") override
1,230✔
1593
  {
1,348✔
1594
    declare(suffix, "ignore-broken-records", "Ignore records that are out-of-bound for the zone.", "no");
1,348✔
1595
    declare(suffix, "config", "Location of named.conf", "");
118✔
1596
    declare(suffix, "check-interval", "Interval for zonefile changes", "0");
118✔
1597
    declare(suffix, "autoprimary-config", "Location of (part of) named.conf where pdns can write zone-statements to", "");
283✔
1598
    declare(suffix, "autoprimaries", "List of IP-addresses of autoprimaries", "");
283✔
1599
    declare(suffix, "autoprimary-destdir", "Destination directory for newly added secondary zones", ::arg()["config-dir"]);
283✔
1600
    declare(suffix, "dnssec-db", "Filename to store & access our DNSSEC metadatabase, empty for none", "");
283✔
1601
    declare(suffix, "dnssec-db-journal-mode", "SQLite3 journal mode", "WAL");
118✔
1602
    declare(suffix, "hybrid", "Store DNSSEC metadata in other backend", "no");
118✔
1603
  }
118✔
1604

1,395✔
1605
  DNSBackend* make(const string& suffix = "") override
1,395!
1606
  {
844✔
1607
    assertEmptySuffix(suffix);
2,239✔
1608
    return new Bind2Backend(suffix);
844✔
1609
  }
844✔
1610

1611
  DNSBackend* makeMetadataOnly(const string& suffix = "") override
1612
  {
110✔
1613
    assertEmptySuffix(suffix);
110✔
1614
    return new Bind2Backend(suffix, false);
110✔
1615
  }
384✔
1616

274✔
1617
private:
274✔
1618
  void assertEmptySuffix(const string& suffix)
274✔
1619
  {
1,228✔
1620
    if (!suffix.empty())
1,228!
1621
      throw PDNSException("launch= suffixes are not supported on the bindbackend");
274✔
1622
  }
1,228✔
1623
};
274✔
1624

274✔
1625
//! Magic class that is activated when the dynamic library is loaded
274✔
1626
class Bind2Loader
1627
{
1628
public:
1629
  Bind2Loader()
1630
  {
129✔
1631
    BackendMakers().report(std::make_unique<Bind2Factory>());
129✔
1632
    g_log << Logger::Info << "[bind2backend] This is the bind backend version " << VERSION
129✔
1633
#ifndef REPRODUCIBLE
129✔
1634
          << " (" __DATE__ " " __TIME__ ")"
129✔
1635
#endif
129✔
1636
#ifdef HAVE_SQLITE3
129✔
1637
          << " (with bind-dnssec-db support)"
129✔
1638
#endif
129✔
1639
          << " reporting" << endl;
129✔
1640
  }
129✔
1641
};
1642
static Bind2Loader bind2loader;
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