[continued from previous message]
- if (d_getcursor->next(d_currentKey, d_currentVal) || d_currentKey.getNoStripHeader<StringView>().rfind(d_matchkey, 0) != 0) {
+ if (d_getcursor->next(d_currentKey, d_currentVal) != 0) {
// cerr<<"resetting d_getcursor 2"<<endl;
d_getcursor.reset();
}
@@ -2423,7 +2420,7 @@
auto cursor = txn->txn->getCursor(txn->db->dbi);
MDBOutVal key, val;
- if (cursor.lower_bound(matchkey, key, val)) {
+ if (cursor.prefix(matchkey, key, val) != 0) {
// cout << "Could not find anything"<<endl;
return false;
}
@@ -2431,7 +2428,7 @@
bool hasOrderName = !ordername.empty();
bool needNSEC3 = hasOrderName;
- for (; key.getNoStripHeader<StringView>().rfind(matchkey, 0) == 0;) {
+ do {
vector<LMDBResourceRecord> lrrs;
if (co.getQType(key.getNoStripHeader<StringView>()) != QType::NSEC3) { @@ -2456,9 +2453,7 @@
}
}
- if (cursor.next(key, val))
- break;
- }
+ } while (cursor.next(key, val) == 0);
bool del = false;
LMDBResourceRecord lrr;
diff -Nru pdns-4.9.4/modules/lmdbbackend/lmdbbackend.hh pdns-4.9.7/modules/lmdbbackend/lmdbbackend.hh
--- pdns-4.9.4/modules/lmdbbackend/lmdbbackend.hh 2025-02-06 16:17:38.000000000 +0100
+++ pdns-4.9.7/modules/lmdbbackend/lmdbbackend.hh 2025-07-07 09:42:15.000000000 +0200
@@ -333,4 +333,5 @@
bool d_random_ids;
bool d_handle_dups;
DTime d_dtime; // used only for logging
+ uint64_t d_mapsize;
};
diff -Nru pdns-4.9.4/pdns/credentials.hh pdns-4.9.7/pdns/credentials.hh
--- pdns-4.9.4/pdns/credentials.hh 2025-02-06 16:17:38.000000000 +0100
+++ pdns-4.9.7/pdns/credentials.hh 2025-07-07 09:42:15.000000000 +0200
@@ -21,7 +21,7 @@
*/
#pragma once
-#include <memory>
+#include <cstdint>
#include <string>
class SensitiveData
diff -Nru pdns-4.9.4/pdns/dnssecinfra.cc pdns-4.9.7/pdns/dnssecinfra.cc
--- pdns-4.9.4/pdns/dnssecinfra.cc 2025-02-06 16:17:38.000000000 +0100
+++ pdns-4.9.7/pdns/dnssecinfra.cc 2025-07-07 09:42:15.000000000 +0200
@@ -782,7 +782,7 @@
DNSPacketWriter dw(signVect, DNSName(), 0);
auto pos=signVect.size();
if(!timersonly) {
- dw.xfrName(tsigKeyName, false);
+ dw.xfrName(tsigKeyName.makeLowerCase(), false);
dw.xfr16BitInt(QClass::ANY); // class
dw.xfr32BitInt(0); // TTL
dw.xfrName(trc.d_algoName.makeLowerCase(), false);
diff -Nru pdns-4.9.4/pdns/lua-record.cc pdns-4.9.7/pdns/lua-record.cc
--- pdns-4.9.4/pdns/lua-record.cc 2025-02-06 16:17:38.000000000 +0100
+++ pdns-4.9.7/pdns/lua-record.cc 2025-07-07 09:42:15.000000000 +0200
@@ -915,81 +915,87 @@
return std::string("error");
});
lua.writeFunction("createForward", []() {
- static string allZerosIP("0.0.0.0");
- DNSName rel=s_lua_record_ctx->qname.makeRelative(s_lua_record_ctx->zone);
- // parts is something like ["1", "2", "3", "4", "static"] or
- // ["1", "2", "3", "4"] or ["ip40414243", "ip-addresses", ...]
- auto parts = rel.getRawLabels();
- // Yes, this still breaks if an 1-2-3-4.XXXX is nested too deeply...
- if(parts.size()>=4) {
- try {
- ComboAddress ca(parts[0]+"."+parts[1]+"."+parts[2]+"."+parts[3]); - return ca.toString();
- } catch (const PDNSException &e) {
- return allZerosIP;
- }
- } else if (!parts.empty()) {
- auto& input = parts.at(0);
-
- // allow a word without - in front, as long as it does not contain anything that could be a number
- size_t nonhexprefix = strcspn(input.c_str(), "0123456789abcdefABCDEF");
- if (nonhexprefix > 0) {
- input = input.substr(nonhexprefix);
- }
-
- // either hex string, or 12-13-14-15
- vector<string> ip_parts;
-
- stringtok(ip_parts, input, "-");
- unsigned int x1, x2, x3, x4;
- if (ip_parts.size() >= 4) {
- // 1-2-3-4 with any prefix (e.g. ip-foo-bar-1-2-3-4)
- string ret;
- for (size_t index=4; index > 0; index--) {
- auto octet = ip_parts[ip_parts.size() - index];
- try {
- auto octetVal = std::stol(octet);
+ static string allZerosIP{"0.0.0.0"};
+ try {
+ DNSName rel{s_lua_record_ctx->qname.makeRelative(s_lua_record_ctx->zone)};
+
+ // parts is something like ["1", "2", "3", "4", "static"] or
+ // ["1", "2", "3", "4"] or ["ip40414243", "ip-addresses", ...]
+ auto parts = rel.getRawLabels();
+ // Yes, this still breaks if an 1-2-3-4.XXXX is nested too deeply... + if (parts.size() >= 4) {
+ ComboAddress address(parts[0]+"."+parts[1]+"."+parts[2]+"."+parts[3]);
+ return address.toString();
+ }
+ if (!parts.empty()) {
+ auto& input = parts.at(0);
+
+ // allow a word without - in front, as long as it does not contain anything that could be a number
+ size_t nonhexprefix = strcspn(input.c_str(), "0123456789abcdefABCDEF");
+ if (nonhexprefix > 0) {
+ input = input.substr(nonhexprefix);
+ }
+
+ // either hex string, or 12-13-14-15
+ vector<string> ip_parts;
+
+ stringtok(ip_parts, input, "-");
+ if (ip_parts.size() >= 4) {
+ // 1-2-3-4 with any prefix (e.g. ip-foo-bar-1-2-3-4)
+ string ret;
+ for (size_t index=4; index > 0; index--) {
+ auto octet = ip_parts.at(ip_parts.size() - index);
+ auto octetVal = std::stol(octet); // may throw
if (octetVal >= 0 && octetVal <= 255) {
- ret += ip_parts.at(ip_parts.size() - index) + ".";
+ ret += octet + ".";
} else {
return allZerosIP;
}
- } catch (const std::exception &e) {
- return allZerosIP;
}
+ ret.resize(ret.size() - 1); // remove trailing dot after last octet
+ return ret;
}
- ret.resize(ret.size() - 1); // remove trailing dot after last octet
- return ret;
- }
- if(input.length() >= 8) {
- auto last8 = input.substr(input.length()-8);
- if(sscanf(last8.c_str(), "%02x%02x%02x%02x", &x1, &x2, &x3, &x4)==4) {
- return std::to_string(x1) + "." + std::to_string(x2) + "." + std::to_string(x3) + "." + std::to_string(x4);
+ if (input.length() >= 8) {
+ auto last8 = input.substr(input.length()-8);
+ unsigned int part1{0};
+ unsigned int part2{0};
+ unsigned int part3{0};
+ unsigned int part4{0};
+ if (sscanf(last8.c_str(), "%02x%02x%02x%02x", &part1, &part2, &part3, &part4) == 4) {
+ ComboAddress address(std::to_string(part1) + "." + std::to_string(part2) + "." + std::to_string(part3) + "." + std::to_string(part4));
+ return address.toString();
+ }
}
}
+ return allZerosIP;
+ } catch (const PDNSException &e) {
+ return allZerosIP;
}
- return allZerosIP;
});
[continued in next message]
--- SoupGate-Win32 v1.05
* Origin: you cannot sedate... all the things you hate (1:229/2)