]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
strip semicolon from import files
authorJamie (Bear) Murphy <git@jam.ie>
Wed, 16 Jul 2025 14:03:30 +0000 (15:03 +0100)
committerJamie (Bear) Murphy <git@jam.ie>
Wed, 16 Jul 2025 14:03:30 +0000 (15:03 +0100)
strip semicolon from import files

pdns/zoneparser-tng.cc

index a211b04455ee4dce62bb57eca8b5832bcc7473b6..c15e03ec649a98378efcde0139325e7f4c04154f 100644 (file)
@@ -368,8 +368,14 @@ bool ZoneParserTNG::get(DNSResourceRecord& rr, std::string* comment)
     }
     else if(pdns_iequals(command,"$INCLUDE") && d_parts.size() > 1 && d_fromfile) {
       string fname=unquotify(makeString(d_line, d_parts[1]));
-      if(!fname.empty() && fname[0]!='/' && !d_reldir.empty())
-        fname=d_reldir+"/"+fname;
+      // Find the first semicolon and remove everything after it, including the semicolon
+      size_t semicolon_pos = fname.find(';');
+      if (semicolon_pos != string::npos) {
+        fname.resize(semicolon_pos);
+      }
+      if (!fname.empty() && fname[0] != '/' && !d_reldir.empty()) {
+        fname = d_reldir + "/" + fname;
+      }
       stackFile(fname);
     }
     else if(pdns_iequals(command, "$ORIGIN") && d_parts.size() > 1) {