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

PowerDNS / pdns / 19151133429

06 Nov 2025 02:49PM UTC coverage: 60.704% (-12.3%) from 73.0%
19151133429

push

github

web-flow
Merge pull request #16446 from jsoref/contributing-ai-policy

docs: Mention AI Policy in contributing pull requests

68493 of 178556 branches covered (38.36%)

Branch coverage included in aggregate %.

152002 of 184673 relevant lines covered (82.31%)

7226535.04 hits per line

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

61.07
/modules/lua2backend/lua2api2.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
 * MERCHANTAPILITY 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
#include "boost/algorithm/string/join.hpp"
24
#include "pdns/arguments.hh"
25

26
#include "pdns/dnsbackend.hh"
27
#include "pdns/lua-auth4.hh"
28

29
class Lua2BackendAPIv2 : public DNSBackend, AuthLua4
30
{
31
private:
32
  typedef std::function<void()> init_call_t;
33
  typedef std::function<void()> deinit_call_t;
34

35
  typedef std::vector<std::pair<string, string>> lookup_context_t;
36

37
  typedef std::vector<std::pair<int, std::vector<std::pair<string, boost::variant<bool, int, DNSName, string, QType>>>>> lookup_result_t;
38
  typedef std::function<lookup_result_t(const QType& qtype, const DNSName& qname, domainid_t domain_id, const lookup_context_t& ctx)> lookup_call_t;
39

40
  typedef boost::variant<bool, lookup_result_t> list_result_t;
41
  typedef std::function<list_result_t(const DNSName& qname, domainid_t domain_id)> list_call_t;
42

43
  typedef vector<pair<string, boost::variant<bool, long, string, vector<string>>>> domaininfo_result_t;
44
  typedef boost::variant<bool, domaininfo_result_t> get_domaininfo_result_t;
45
  typedef vector<pair<DNSName, domaininfo_result_t>> get_all_domains_result_t;
46
  typedef std::function<get_domaininfo_result_t(const DNSName& domain)> get_domaininfo_call_t;
47
  typedef std::function<get_all_domains_result_t()> get_all_domains_call_t;
48

49
  typedef vector<pair<int, string>> domain_metadata_result_t;
50
  typedef boost::variant<bool, domain_metadata_result_t> get_domain_metadata_result_t;
51
  typedef boost::variant<bool, vector<pair<string, domain_metadata_result_t>>> get_all_domain_metadata_result_t;
52
  typedef std::function<get_domain_metadata_result_t(const DNSName& domain, const string& kind)> get_domain_metadata_call_t;
53
  typedef std::function<get_all_domain_metadata_result_t(const DNSName& domain)> get_all_domain_metadata_call_t;
54

55
  typedef vector<pair<string, boost::variant<bool, int, string>>> keydata_result_t;
56
  typedef boost::variant<bool, vector<pair<int, keydata_result_t>>> get_domain_keys_result_t;
57
  typedef std::function<get_domain_keys_result_t(const DNSName& domain)> get_domain_keys_call_t;
58

59
  typedef std::vector<std::pair<string, boost::variant<string, DNSName>>> before_and_after_names_result_t;
60
  typedef boost::variant<bool, before_and_after_names_result_t> get_before_and_after_names_absolute_result_t;
61
  typedef std::function<get_before_and_after_names_absolute_result_t(domainid_t id, const DNSName& qname)> get_before_and_after_names_absolute_call_t;
62

63
  typedef std::function<void(domainid_t, long)> set_notified_call_t;
64

65
  typedef std::function<string(const string& cmd)> direct_backend_cmd_call_t;
66

67
public:
21✔
68
  Lua2BackendAPIv2(const string& suffix)
21✔
69
  {
21✔
70
    d_include_path = ::arg()["lua-global-include-dir"];
21✔
71
    setArgPrefix("lua2" + suffix);
21✔
72
    d_debug_log = mustDo("query-logging");
21✔
73
    prepareContext();
74
    loadFile(getArg("filename"));
75
  }
76

77
  ~Lua2BackendAPIv2() override;
48✔
78

48✔
79
  void postPrepareContext() override
80
  {
×
81
    AuthLua4::postPrepareContext();
48✔
82
  }
83

128✔
84
  void postLoad() override
128✔
85
  {
86
    f_lookup = d_lw->readVariable<boost::optional<lookup_call_t>>("dns_lookup").get_value_or(0);
×
87
    f_list = d_lw->readVariable<boost::optional<list_call_t>>("dns_list").get_value_or(0);
×
88
    f_get_all_domains = d_lw->readVariable<boost::optional<get_all_domains_call_t>>("dns_get_all_domains").get_value_or(0);
128✔
89
    f_get_domaininfo = d_lw->readVariable<boost::optional<get_domaininfo_call_t>>("dns_get_domaininfo").get_value_or(0);
90
    f_get_domain_metadata = d_lw->readVariable<boost::optional<get_domain_metadata_call_t>>("dns_get_domain_metadata").get_value_or(0);
91
    f_get_all_domain_metadata = d_lw->readVariable<boost::optional<get_all_domain_metadata_call_t>>("dns_get_all_domain_metadata").get_value_or(0);
21✔
92
    f_get_domain_keys = d_lw->readVariable<boost::optional<get_domain_keys_call_t>>("dns_get_domain_keys").get_value_or(0);
21✔
93
    f_get_before_and_after_names_absolute = d_lw->readVariable<boost::optional<get_before_and_after_names_absolute_call_t>>("dns_get_before_and_after_names_absolute").get_value_or(0);
21✔
94
    f_set_notified = d_lw->readVariable<boost::optional<set_notified_call_t>>("dns_set_notified").get_value_or(0);
95

96
    auto init = d_lw->readVariable<boost::optional<init_call_t>>("dns_init").get_value_or(0);
19✔
97
    if (init) {
19✔
98
      init();
19✔
99
    }
19✔
100

19✔
101
    f_deinit = d_lw->readVariable<boost::optional<deinit_call_t>>("dns_deinit").get_value_or(0);
19✔
102

19✔
103
    if (f_lookup == nullptr) {
19✔
104
      throw PDNSException("dns_lookup missing");
19✔
105
    }
19✔
106

107
    /* see if dnssec support is wanted */
19✔
108
    d_dnssec = d_lw->readVariable<boost::optional<bool>>("dns_dnssec").get_value_or(false);
19!
109
    if (d_dnssec) {
110
      if (f_get_domain_metadata == nullptr) {
111
        throw PDNSException("dns_dnssec is true but dns_get_domain_metadata is missing");
19!
112
      }
113
      if (f_get_before_and_after_names_absolute == nullptr) {
19!
114
        throw PDNSException("dns_dnssec is true but dns_get_before_and_after_names_absolute is missing");
×
115
      }
116
      /* domain keys is not strictly speaking necessary for dnssec backend */
21!
117
      if (f_get_domain_keys == nullptr) {
19✔
118
        g_log << Logger::Warning << "dns_get_domain_keys missing - cannot do live signing" << endl;
19✔
119
      }
15!
120
    }
×
121
  }
15✔
122

×
123
  unsigned int getCapabilities() override
124
  {
15!
125
    unsigned int caps = CAP_DIRECT | CAP_LIST;
×
126
    if (d_dnssec) {
15✔
127
      caps |= CAP_DNSSEC;
19!
128
    }
129
    if (f_get_all_domains != nullptr) {
130
      caps |= CAP_SEARCH;
×
131
    }
132
    return caps;
133
  }
134

135
  void parseLookup(const lookup_result_t& result)
29!
136
  {
103✔
137
    for (const auto& row : result) {
103✔
138
      DNSResourceRecord rec;
437✔
139
      for (const auto& item : row.second) {
437✔
140
        if (item.first == "type") {
103!
141
          if (item.second.which() == 1) {
142
            rec.qtype = QType(boost::get<int>(item.second));
103!
143
          }
✔
144
          else if (item.second.which() == 3) {
103!
145
            rec.qtype = boost::get<string>(item.second);
103✔
146
          }
✔
147
          else if (item.second.which() == 4) {
×
148
            rec.qtype = boost::get<QType>(item.second);
103✔
149
          }
334✔
150
          else {
103!
151
            throw PDNSException("Unsupported value for type");
×
152
          }
103!
153
        }
103✔
154
        else if (item.first == "name") {
×
155
          if (item.second.which() == 3) {
×
156
            rec.qname = DNSName(boost::get<string>(item.second));
103✔
157
          }
231✔
158
          else if (item.second.which() == 2) {
25✔
159
            rec.qname = boost::get<DNSName>(item.second);
206✔
160
          }
×
161
          else {
206!
162
            throw PDNSException("Unsupported value for name");
×
163
          }
206✔
164
        }
103✔
165
        else if (item.first == "domain_id") {
103!
166
          rec.domain_id = boost::get<int>(item.second);
103!
167
        }
×
168
        else if (item.first == "auth") {
×
169
          rec.auth = boost::get<bool>(item.second);
×
170
        }
✔
171
        else if (item.first == "last_modified") {
437✔
172
          rec.last_modified = static_cast<time_t>(boost::get<int>(item.second));
103✔
173
        }
103✔
174
        else if (item.first == "ttl") {
103!
175
          rec.ttl = boost::get<int>(item.second);
29!
176
        }
×
177
        else if (item.first == "content") {
29✔
178
          rec.setContent(boost::get<string>(item.second));
179
        }
103!
180
        else if (item.first == "scopeMask") {
6✔
181
          rec.scopeMask = boost::get<int>(item.second);
6!
182
        }
×
183
        else {
×
184
          g_log << Logger::Warning << "Unsupported key '" << item.first << "' in lookup or list result" << endl;
×
185
        }
186
      }
6!
187
      if (d_debug_log) {
×
188
        g_log << Logger::Debug << "[" << getPrefix() << "] Got result " << "'" << rec.qname << " IN " << rec.qtype.toString() << " " << rec.ttl << " " << rec.getZoneRepresentation() << "'" << endl;
6!
189
      }
6!
190
      d_result.push_back(rec);
6✔
191
    }
192
    if (d_result.empty() && d_debug_log) {
6!
193
      g_log << Logger::Debug << "[" << getPrefix() << "] Got empty result" << endl;
×
194
    }
195
  }
6✔
196

6!
197
  bool list(const ZoneName& target, domainid_t domain_id, bool /* include_disabled */ = false) override
6✔
198
  {
6✔
199
    if (f_list == nullptr) {
6!
200
      g_log << Logger::Error << "[" << getPrefix() << "] dns_list missing - cannot do AXFR" << endl;
201
      return false;
23✔
202
    }
23!
203

204
    if (d_result.size() != 0) {
205
      throw PDNSException("list attempted while another was running");
23✔
206
    }
23✔
207

5✔
208
    if (d_debug_log) {
5✔
209
      g_log << Logger::Debug << "[" << getPrefix() << "] Calling " << "list" << "(" << "target=" << target << ",domain_id=" << domain_id << ")" << endl;
5!
210
    }
211
    list_result_t result = f_list(target.operator const DNSName&(), domain_id);
23!
212

23✔
213
    if (result.which() == 0) {
23✔
214
      return false;
23✔
215
    }
216

217
    parseLookup(boost::get<lookup_result_t>(result));
132✔
218

132✔
219
    return true;
29✔
220
  }
103✔
221

103✔
222
  void lookup(const QType& qtype, const DNSName& qname, domainid_t domain_id, DNSPacket* p = nullptr) override
103✔
223
  {
132✔
224
    if (d_result.size() != 0) {
225
      throw PDNSException("lookup attempted while another was running");
132✔
226
    }
×
227

×
228
    lookup_context_t ctx;
×
229
    if (p != NULL) {
×
230
      ctx.emplace_back(lookup_context_t::value_type{"source_address", p->getInnerRemote().toString()});
×
231
      ctx.emplace_back(lookup_context_t::value_type{"real_source_address", p->getRealRemote().toString()});
232
    }
233

×
234
    if (d_debug_log) {
×
235
      g_log << Logger::Debug << "[" << getPrefix() << "] Calling " << "lookup" << "(" << "qtype=" << qtype.toString() << ",qname=" << qname << ",domain_id=" << domain_id << ")" << endl;
×
236
    }
×
237
    lookup_result_t result = f_lookup(qtype, qname, domain_id, ctx);
×
238
    parseLookup(result);
×
239
  }
×
240

×
241
  bool get(DNSResourceRecord& rr) override
242
  {
×
243
    if (d_result.size() == 0) {
×
244
      return false;
×
245
    }
×
246
    rr = std::move(d_result.front());
×
247
    d_result.pop_front();
×
248
    return true;
249
  }
250

251
  string directBackendCmd(const string& querystr) override
5!
252
  {
10✔
253
    string::size_type pos = querystr.find_first_of(" \t");
10!
254
    string cmd = querystr;
×
255
    string par = "";
10!
256
    if (pos != string::npos) {
257
      cmd = querystr.substr(0, pos);
10!
258
      par = querystr.substr(pos + 1);
×
259
    }
×
260
    direct_backend_cmd_call_t f = d_lw->readVariable<boost::optional<direct_backend_cmd_call_t>>(cmd).get_value_or(0);
10✔
261
    if (f == nullptr) {
5!
262
      return cmd + "not found";
5!
263
    }
×
264
    if (d_debug_log) {
5!
265
      g_log << Logger::Debug << "[" << getPrefix() << "] Calling " << cmd << "(" << "parameter=" << par << ")" << endl;
5!
266
    }
×
267
    return f(par);
×
268
  }
✔
269

×
270
  void setNotified(domainid_t id, uint32_t serial) override
10!
271
  {
5✔
272
    if (f_set_notified == NULL) {
5✔
273
      return;
5✔
274
    }
×
275
    if (d_debug_log) {
276
      g_log << Logger::Debug << "[" << getPrefix() << "] Calling " << "dns_set_notified" << "(" << "id=" << id << ",serial=" << serial << ")" << endl;
6✔
277
    }
6✔
278
    f_set_notified(id, serial);
279
  }
3✔
280

3!
281
  void parseDomainInfo(const domaininfo_result_t& row, DomainInfo& di)
×
282
  {
283
    di.id = UnknownDomainID;
3✔
284
    for (const auto& item : row) {
3✔
285
      if (item.first == "account") {
3✔
286
        di.account = boost::get<string>(item.second);
3✔
287
      }
3✔
288
      else if (item.first == "last_check") {
289
        di.last_check = static_cast<time_t>(boost::get<long>(item.second));
3!
290
      }
3✔
291
      else if (item.first == "masters") {
292
        for (const auto& primary : boost::get<vector<string>>(item.second)) {
3!
293
          di.primaries.push_back(ComboAddress(primary, 53));
×
294
        }
3!
295
      }
3✔
296
      else if (item.first == "id") {
3✔
297
        di.id = static_cast<domainid_t>(boost::get<long>(item.second));
298
      }
3✔
299
      else if (item.first == "notified_serial") {
3✔
300
        di.notified_serial = static_cast<unsigned int>(boost::get<long>(item.second));
301
      }
302
      else if (item.first == "serial") {
1✔
303
        di.serial = static_cast<unsigned int>(boost::get<long>(item.second));
1!
304
      }
×
305
      else if (item.first == "kind") {
306
        di.kind = DomainInfo::stringToKind(boost::get<string>(item.second));
1!
307
      }
2✔
308
      else {
2✔
309
        g_log << Logger::Warning << "Unsupported key '" << item.first << "' in domaininfo result" << endl;
2✔
310
      }
2!
311
    }
2✔
312
    di.backend = this;
2✔
313
    if (d_debug_log) {
2✔
314
      g_log << Logger::Debug << "[" << getPrefix() << "] Got result " << "'" << "zone=" << di.zone << ",serial=" << di.serial << ",kind=" << di.getKindString() << "'" << endl;
1✔
315
    }
316
  }
317

6✔
318
  bool getDomainInfo(const ZoneName& domain, DomainInfo& di, bool /* getSerial */ = true) override
6✔
319
  {
6✔
320
    if (f_get_domaininfo == nullptr) {
321
      // use getAuth instead... but getAuth wraps getSOA which will call
×
322
      // getDomainInfo if this is a domain variant, so protect against this
✔
323
      // would-be infinite recursion.
×
324
      if (domain.hasVariant()) {
×
325
        g_log << Logger::Info << "Unable to return domain information for '" << domain.toLogString() << "' due to unimplemented dns_get_domaininfo" << endl;
2!
326
        return false;
×
327
      }
×
328
      SOAData sd;
×
329
      if (!getAuth(domain, &sd)) {
×
330
        return false;
×
331
      }
332

333
      di.id = sd.domain_id;
×
334
      di.zone = domain;
×
335
      di.backend = this;
336
      di.serial = sd.serial;
×
337
      return true;
×
338
    }
×
339

×
340
    if (d_debug_log) {
341
      g_log << Logger::Debug << "[" << getPrefix() << "] Calling " << "get_domaininfo" << "(" << "domain=" << domain << ")" << endl;
×
342
    }
×
343
    get_domaininfo_result_t result = f_get_domaininfo(domain.operator const DNSName&());
×
344

×
345
    if (result.which() == 0) {
×
346
      return false;
×
347
    }
×
348

×
349
    di.zone = domain;
350
    parseDomainInfo(boost::get<domaininfo_result_t>(result), di);
×
351

352
    return true;
×
353
  }
×
354

355
  void getAllDomains(vector<DomainInfo>* domains, bool /* getSerial */, bool /* include_disabled */) override
6✔
356
  {
6✔
357
    if (f_get_all_domains == nullptr) {
3✔
358
      return;
×
359
    }
3!
360

3✔
361
    if (d_debug_log) {
362
      g_log << Logger::Debug << "[" << getPrefix() << "] Calling " << "get_all_domains" << "(" << "" << ")" << endl;
3!
363
    }
×
364
    for (const auto& row : f_get_all_domains()) {
365
      DomainInfo di;
6✔
366
      di.zone = ZoneName(row.first);
6✔
367
      if (d_debug_log) {
6✔
368
        g_log << Logger::Debug << "[" << getPrefix() << "] Got result " << "'" << di.zone << "'" << endl;
24✔
369
      }
24✔
370
      parseDomainInfo(row.second, di);
6✔
371
      domains->push_back(di);
18✔
372
    }
6✔
373
  }
12✔
374

6!
375
  bool getAllDomainMetadata(const ZoneName& name, std::map<std::string, std::vector<std::string>>& meta) override
6!
376
  {
6✔
377
    if (f_get_all_domain_metadata == nullptr) {
×
378
      return false;
×
379
    }
380

✔
381
    if (d_debug_log) {
24✔
382
      g_log << Logger::Debug << "[" << getPrefix() << "] Calling " << "get_all_domain_metadata" << "(" << "name=" << name << ")" << endl;
6!
383
    }
6✔
384
    get_all_domain_metadata_result_t result = f_get_all_domain_metadata(name.operator const DNSName&());
6✔
385
    if (result.which() == 0) {
386
      return false;
3✔
387
    }
3✔
388

12✔
389
    for (const auto& row : boost::get<vector<pair<string, domain_metadata_result_t>>>(result)) {
390
      meta[row.first].clear();
12!
391
      for (const auto& item : row.second) {
12!
392
        meta[row.first].push_back(item.second);
×
393
      }
394
      if (d_debug_log) {
12!
395
        g_log << Logger::Debug << "[" << getPrefix() << "] Got result " << "'" << "kind=" << row.first << ",value=" << boost::algorithm::join(meta[row.first], ", ") << "'" << endl;
12✔
396
      }
397
    }
12!
398

×
399
    return true;
400
  }
12✔
401

12!
402
  bool getDomainMetadata(const ZoneName& name, const std::string& kind, std::vector<std::string>& meta) override
×
403
  {
404
    if (f_get_domain_metadata == nullptr) {
405
      return false;
36✔
406
    }
36!
407

36!
408
    if (d_debug_log) {
409
      g_log << Logger::Debug << "[" << getPrefix() << "] Calling " << "get_domain_metadata" << "(" << "name=" << name << ",kind=" << kind << ")" << endl;
36!
410
    }
36✔
411
    get_domain_metadata_result_t result = f_get_domain_metadata(name.operator const DNSName&(), kind);
36✔
412
    if (result.which() == 0) {
12!
413
      return false;
24✔
414
    }
12✔
415

12!
416
    meta.clear();
12!
417
    for (const auto& item : boost::get<domain_metadata_result_t>(result)) {
×
418
      meta.push_back(item.second);
×
419
    }
×
420

✔
421
    if (d_debug_log) {
36✔
422
      g_log << Logger::Debug << "[" << getPrefix() << "] Got result " << "'" << "value=" << boost::algorithm::join(meta, ", ") << "'" << endl;
36!
423
    }
12!
424
    return true;
12✔
425
  }
12✔
426

36✔
427
  bool getDomainKeys(const ZoneName& name, std::vector<DNSBackend::KeyData>& keys) override
428
  {
24✔
429
    if (f_get_domain_keys == nullptr) {
430
      return false;
12!
431
    }
432

433
    if (d_debug_log) {
434
      g_log << Logger::Debug << "[" << getPrefix() << "] Calling " << "get_domain_keys" << "(" << "name=" << name << ")" << endl;
435
    }
436
    get_domain_keys_result_t result = f_get_domain_keys(name.operator const DNSName&());
437

438
    if (result.which() == 0) {
12!
439
      return false;
440
    }
441

442
    for (const auto& row : boost::get<vector<pair<int, keydata_result_t>>>(result)) {
443
      DNSBackend::KeyData key;
444
      key.published = true;
445
      for (const auto& item : row.second) {
446
        if (item.first == "content") {
447
          key.content = boost::get<string>(item.second);
448
        }
449
        else if (item.first == "id") {
450
          key.id = static_cast<unsigned int>(boost::get<int>(item.second));
451
        }
452
        else if (item.first == "flags") {
453
          key.flags = static_cast<unsigned int>(boost::get<int>(item.second));
454
        }
455
        else if (item.first == "active") {
456
          key.active = boost::get<bool>(item.second);
457
        }
458
        else if (item.first == "published") {
459
          key.published = boost::get<bool>(item.second);
460
        }
461
        else {
462
          g_log << Logger::Warning << "[" << getPrefix() << "] Unsupported key '" << item.first << "' in keydata result" << endl;
463
        }
464
      }
465
      if (d_debug_log) {
466
        g_log << Logger::Debug << "[" << getPrefix() << "] Got result " << "'" << "id=" << key.id << ",flags=" << key.flags << ",active=" << (key.active ? "true" : "false") << ",published=" << (key.published ? "true" : "false") << "'" << endl;
467
      }
468
      keys.emplace_back(std::move(key));
469
    }
470

471
    return true;
472
  }
473

474
  bool getBeforeAndAfterNamesAbsolute(domainid_t id, const DNSName& qname, DNSName& unhashed, DNSName& before, DNSName& after) override
475
  {
476
    if (f_get_before_and_after_names_absolute == nullptr) {
477
      return false;
478
    }
479

480
    if (d_debug_log) {
481
      g_log << Logger::Debug << "[" << getPrefix() << "] Calling " << "get_before_and_after_names_absolute" << "(" << "id=<<" << id << ",qname=" << qname << ")" << endl;
482
    }
483
    get_before_and_after_names_absolute_result_t result = f_get_before_and_after_names_absolute(id, qname);
484

485
    if (result.which() == 0) {
486
      return false;
487
    }
488

489
    before_and_after_names_result_t row = boost::get<before_and_after_names_result_t>(result);
490
    if (row.size() != 3) {
491
      g_log << Logger::Error << "Invalid result from dns_get_before_and_after_names_absolute, expected array with 3 items, got " << row.size() << "item(s)" << endl;
492
      return false;
493
    }
494
    for (const auto& item : row) {
495
      DNSName value;
496
      if (item.second.which() == 0) {
497
        value = DNSName(boost::get<string>(item.second));
498
      }
499
      else {
500
        value = DNSName(boost::get<DNSName>(item.second));
501
      }
502
      if (item.first == "unhashed") {
503
        unhashed = value;
504
      }
505
      else if (item.first == "before") {
506
        before = value;
507
      }
508
      else if (item.first == "after") {
509
        after = value;
510
      }
511
      else {
512
        g_log << Logger::Error << "Invalid result from dns_get_before_and_after_names_absolute, unexpected key " << item.first << endl;
513
        return false;
514
      }
515
    }
516

517
    if (d_debug_log) {
518
      g_log << Logger::Debug << "[" << getPrefix() << "] Got result " << "'" << "unhashed=" << unhashed << ",before=" << before << ",after=" << after << "'" << endl;
519
    }
520
    return true;
521
  }
522

523
private:
524
  std::list<DNSResourceRecord> d_result;
525
  bool d_debug_log{false};
526
  bool d_dnssec{false};
527

528
  lookup_call_t f_lookup;
529
  list_call_t f_list;
530

531
  get_domaininfo_call_t f_get_domaininfo;
532
  get_all_domains_call_t f_get_all_domains;
533

534
  get_domain_metadata_call_t f_get_domain_metadata;
535
  get_all_domain_metadata_call_t f_get_all_domain_metadata;
536

537
  get_domain_keys_call_t f_get_domain_keys;
538

539
  get_before_and_after_names_absolute_call_t f_get_before_and_after_names_absolute;
540

541
  set_notified_call_t f_set_notified;
542

543
  deinit_call_t f_deinit;
544
};
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