]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
auth LUA createForward: allow non-hex word prefix
authorPeter van Dijk <peter.van.dijk@powerdns.com>
Tue, 16 Jan 2024 14:08:36 +0000 (15:08 +0100)
committerPeter van Dijk <peter.van.dijk@powerdns.com>
Tue, 16 Jan 2024 14:08:36 +0000 (15:08 +0100)
pdns/lua-record.cc
regression-tests.auth-py/test_LuaRecords.py

index c3358044abb9689797cdc9f75061f70cacc900cb..9562abc06d9476753f63dda71bf247fafc0392ee 100644 (file)
@@ -738,6 +738,13 @@ static void setupLuaRecords(LuaContext& lua)
       } else if (parts.size() >= 1) {
         // either hex string, or 12-13-14-15
         vector<string> ip_parts;
+
+        // allow a word without - in front, as long as it does not contain anything that could be a number
+        size_t nonhexprefix = strcspn(parts[0].c_str(), "0123456789abcdef");
+        if (nonhexprefix > 0) {
+          parts[0] = parts[0].substr(nonhexprefix);
+        }
+
         stringtok(ip_parts, parts[0], "-");
         unsigned int x1, x2, x3, x4;
         if (ip_parts.size() >= 4) {
index e9df7c8ba7f4ffb0798c27f9cff2c9c11f25642e..3b1cc721dbeeecb427d7cef8f6ee6daed09bb7be 100644 (file)
@@ -964,6 +964,7 @@ createforward6.example.org.                 3600 IN NS   ns2.example.org.
                 "ip40414243": "64.65.66.67",
                 "ipp40414243": "64.65.66.67",
                 "ip4041424": "0.0.0.0",
+                "host64-22-33-44": "64.22.33.44",
                 "2.2.2.2": "0.0.0.0"   # filtered
             }),
             ".createreverse.example.org." : (dns.rdatatype.PTR, {