Skip to content

Commit

Permalink
Rec: Adapt to QType class changes
Browse files Browse the repository at this point in the history
  • Loading branch information
fredmorcos committed Jul 4, 2024
1 parent 49414ec commit 47792d6
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pdns/recursordist/rec-lua-conf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ static void parseProtobufOptions(const boost::optional<protobufOptions_t>& vars,
qtype = std::stoul(type);
}
catch (const std::exception& ex) {
qtype = QType::chartocode(type.c_str());
qtype = QType::fromString(type);
if (qtype == 0) {
throw std::runtime_error("Unknown QType '" + type + "' in protobuf's export types");
}
Expand Down
2 changes: 1 addition & 1 deletion pdns/recursordist/rec_channel_rec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2350,7 +2350,7 @@ RecursorControlChannel::Answer RecursorControlParser::getAnswer(int socket, cons
if (begin == end) {
return {1, "Need a qtype\n"};
}
uint16_t qtype = QType::chartocode(begin->c_str());
uint16_t qtype = QType::fromString(*begin);
if (qtype == 0) {
return {1, "Unknown qtype " + *begin + "\n"};
}
Expand Down
8 changes: 4 additions & 4 deletions pdns/recursordist/settings/cxxsupport.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1095,7 +1095,7 @@ void fromRustToLuaConfig(const pdns::rust::settings::rec::ProtobufServer& pbServ
exp.enabled = true;
exp.exportTypes.clear();
for (const auto& type : pbServer.exportTypes) {
exp.exportTypes.emplace(QType::chartocode(std::string(type).c_str()));
exp.exportTypes.emplace(QType::fromString(std::string(type)));
}
for (const auto& server : pbServer.servers) {
exp.servers.emplace_back(std::string(server));
Expand Down Expand Up @@ -1253,10 +1253,10 @@ void fromRustToLuaConfig(const rust::Vec<pdns::rust::settings::rec::SortList>& s
void fromRustToLuaConfig(const rust::Vec<pdns::rust::settings::rec::AllowedAdditionalQType>& alloweds, std::map<QType, std::pair<std::set<QType>, AdditionalMode>>& lua)
{
for (const auto& allowed : alloweds) {
QType qtype(QType::chartocode(std::string(allowed.qtype).c_str()));
QType qtype = QType::fromString(std::string(allowed.qtype));
std::set<QType> set;
for (const auto& target : allowed.targets) {
set.emplace(QType::chartocode(std::string(target).c_str()));
set.emplace(QType::fromString(std::string(target)));
}
AdditionalMode mode = AdditionalMode::CacheOnlyRequireAuth;
mode = cvtAdditional(std::string(allowed.mode));
Expand Down Expand Up @@ -1384,7 +1384,7 @@ pdns::settings::rec::YamlSettingsStatus pdns::settings::rec::tryReadYAML(const s
uint16_t pdns::rust::settings::rec::qTypeStringToCode(::rust::Str str)
{
std::string tmp(str.data(), str.length());
return QType::chartocode(tmp.c_str());
return QType::fromString(std::string(tmp));
}

bool pdns::rust::settings::rec::isValidHostname(::rust::Str str)
Expand Down
2 changes: 1 addition & 1 deletion pdns/recursordist/syncres.cc
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ bool SyncRes::doSpecialNamesResolve(const DNSName& qname, const QType qtype, con
static const DNSName negativetrustanchorserver("negativetrustanchor.server.");

bool handled = false;
vector<pair<QType::typeenum, string>> answers;
vector<pair<QType::QTypeEnum, string>> answers;

if ((qname == arpa || qname == ip6_arpa) && qclass == QClass::IN) {
handled = true;
Expand Down
2 changes: 1 addition & 1 deletion pdns/recursordist/ws-recursor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ static void apiServerCacheFlush(HttpRequest* req, HttpResponse* resp)
bool subtree = req->getvars.count("subtree") > 0 && req->getvars["subtree"] == "true";
uint16_t qtype = 0xffff;
if (req->getvars.count("type") != 0) {
qtype = QType::chartocode(req->getvars["type"].c_str());
qtype = QType::fromString(req->getvars["type"]);
}

struct WipeCacheResult res = wipeCaches(canon, subtree, qtype);
Expand Down

0 comments on commit 47792d6

Please sign in to comment.