return ret;
});
- d_lw->registerFunction<const ProxyProtocolValue, std::string()>("getContent", [](const ProxyProtocolValue& value) { return value.content; });
+ d_lw->registerFunction<const ProxyProtocolValue, std::string()>("getContent", [](const ProxyProtocolValue& value) -> std::string { return value.content; });
d_lw->registerFunction<const ProxyProtocolValue, uint8_t()>("getType", [](const ProxyProtocolValue& value) { return value.type; });
d_lw->registerFunction<void(DNSRecord::*)(const std::string&)>("changeContent", [](DNSRecord& dr, const std::string& newContent) { dr.setContent(DNSRecordContent::make(dr.d_type, QClass::IN, newContent)); });
auto ret = d_gettag(remote, ednssubnet, local, qname, qtype, ednsOptions, tcp, proxyProtocolValuesMap);
- if (policyTags) {
+ if (policyTags != nullptr) {
const auto& tags = std::get<1>(ret);
if (tags) {
policyTags->reserve(policyTags->size() + tags->size());
}
}
}
- const auto dataret = std::get<2>(ret);
+ const auto& dataret = std::get<2>(ret);
if (dataret) {
data = *dataret;
}
- const auto reqIdret = std::get<3>(ret);
+ const auto& reqIdret = std::get<3>(ret);
if (reqIdret) {
requestorId = *reqIdret;
}
- const auto deviceIdret = std::get<4>(ret);
+ const auto& deviceIdret = std::get<4>(ret);
if (deviceIdret) {
deviceId = *deviceIdret;
}
- const auto deviceNameret = std::get<5>(ret);
+ const auto& deviceNameret = std::get<5>(ret);
if (deviceNameret) {
deviceName = *deviceNameret;
}
- const auto routingTarget = std::get<6>(ret);
+ const auto& routingTarget = std::get<6>(ret);
if (routingTarget) {
routingTag = *routingTarget;
}
else if (dq.followupFunction == "udpQueryResponse") {
PacketBuffer p = GenUDPQueryResponse(dq.udpQueryDest, dq.udpQuery);
dq.udpAnswer = std::string(reinterpret_cast<const char*>(p.data()), p.size());
- auto cbFunc = d_lw->readVariable<boost::optional<luacall_t>>(dq.udpCallback).get_value_or(0);
+ // coverity[auto_causes_copy] not copying produces a dangling ref
+ const auto cbFunc = d_lw->readVariable<boost::optional<luacall_t>&>(dq.udpCallback).get_value_or(nullptr);
if (!cbFunc) {
SLOG(g_log << Logger::Error << "Attempted callback for Lua UDP Query/Response which could not be found" << endl,
g_slog->withName("lua")->info(Logr::Error, "Attempted callback for Lua UDP Query/Response which could not be found"));
sr = getRR<SOARecordContent>(dr);
domain = dr.d_name;
zone->setDomain(domain);
- soaRecord = dr;
+ soaRecord = std::move(dr);
}
else if (dr.d_type == QType::NS) {
continue;
if (sr != nullptr) {
zone->setRefresh(sr->d_st.refresh);
- zone->setSOA(soaRecord);
+ zone->setSOA(std::move(soaRecord));
setRPZZoneNewState(zone->getName(), sr->d_st.serial, zone->size(), true, false);
}
return sr;
auto tempSR = getRR<SOARecordContent>(rr);
// g_log<<Logger::Info<<"New SOA serial for "<<zoneName<<": "<<currentSR->d_st.serial<<endl;
if (tempSR) {
- currentSR = tempSR;
+ currentSR = std::move(tempSR);
}
}
else {
/* only update sr now that all changes have been converted */
if (currentSR) {
- sr = currentSR;
+ sr = std::move(currentSR);
}
SLOG(g_log << Logger::Info << "Had " << totremove << " RPZ removal" << addS(totremove) << ", " << totadd << " addition" << addS(totadd) << " for " << zoneName << " New serial: " << sr->d_st.serial << endl,
logger->info(Logr::Info, "RPZ mutations", "removals", Logging::Loggable(totremove), "additions", Logging::Loggable(totadd), "newserial", Logging::Loggable(sr->d_st.serial)));