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

PowerDNS / pdns / 18679017918

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

Pull #16307

github

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

26192 of 45526 branches covered (57.53%)

Branch coverage included in aggregate %.

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

2282 existing lines in 57 files now uncovered.

86265 of 115719 relevant lines covered (74.55%)

4323875.05 hits per line

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

32.35
/pdns/ednsextendederror.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
#include <limits>
23

24
#include "ednsextendederror.hh"
25

26
static bool getEDNSExtendedErrorOptFromStringView(const std::string_view& option, EDNSExtendedError& eee)
UNCOV
27
{
×
UNCOV
28
  if (option.size() < sizeof(uint16_t)) {
×
UNCOV
29
    return false;
×
UNCOV
30
  }
×
UNCOV
31
  eee.infoCode = static_cast<uint8_t>(option.at(0)) * 256 + static_cast<uint8_t>(option.at(1));
×
32

UNCOV
33
  if (option.size() > sizeof(uint16_t)) {
×
UNCOV
34
    eee.extraText = std::string(&option.at(sizeof(uint16_t)), option.size() - sizeof(uint16_t));
×
UNCOV
35
  }
×
36

UNCOV
37
  return true;
×
UNCOV
38
}
×
39

40
bool getEDNSExtendedErrorOptFromString(const string& option, EDNSExtendedError& eee)
UNCOV
41
{
×
UNCOV
42
  return getEDNSExtendedErrorOptFromStringView(std::string_view(option), eee);
×
UNCOV
43
}
×
44

45
bool getEDNSExtendedErrorOptFromString(const char* option, unsigned int len, EDNSExtendedError& eee)
46
{
×
47
  return getEDNSExtendedErrorOptFromStringView(std::string_view(option, len), eee);
×
48
}
×
49

50
string makeEDNSExtendedErrorOptString(const EDNSExtendedError& eee)
51
{
26✔
52
  if (eee.extraText.size() > static_cast<size_t>(std::numeric_limits<uint16_t>::max() - 2)) {
26!
UNCOV
53
    throw std::runtime_error("Trying to create an EDNS Extended Error option with an extra text of size " + std::to_string(eee.extraText.size()));
×
UNCOV
54
  }
×
55

56
  string ret;
26✔
57
  ret.reserve(sizeof(uint16_t) + eee.extraText.size());
26✔
58
  ret.resize(sizeof(uint16_t));
26✔
59

60
  ret[0] = static_cast<char>(static_cast<uint16_t>(eee.infoCode) / 256);
26✔
61
  ret[1] = static_cast<char>(static_cast<uint16_t>(eee.infoCode) % 256);
26✔
62
  ret.append(eee.extraText);
26✔
63

64
  return ret;
26✔
65
}
26✔
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