Skip to content

Commit

Permalink
Merge pull request PowerDNS#15194 from omoerbeek/rec-zf-file-syntax
Browse files Browse the repository at this point in the history
rec: document file extension of zone forward file and do not accept empty list of forwards
  • Loading branch information
omoerbeek authored Feb 21, 2025
2 parents d085ca6 + b287e57 commit 1d19e1a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions pdns/recursordist/rec-rust-lib/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -1140,6 +1140,7 @@
''',
'doc-new' : '''
Same as :ref:`setting-forward-zones`, parsed from a file as a sequence of `Forward Zone`_.
The filename MUST end in ``.yml`` for the content to be parsed as YAML.
.. code-block:: yaml
Expand Down
6 changes: 6 additions & 0 deletions pdns/recursordist/reczones.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ static void convertServersForAD(const std::string& zone, const std::string& inpu
{
vector<string> servers;
stringtok(servers, input, sepa);
if (servers.empty()) {
throw PDNSException("empty list of forwarders for domain '" + zone + '"');
}
authDomain.d_servers.clear();

vector<string> addresses;
Expand Down Expand Up @@ -413,6 +416,9 @@ static void processForwardZonesFile(shared_ptr<SyncRes::domainmap_t>& newMap, sh
try {
convertServersForAD(domain, instructions, authDomain, ",; ", log, false);
}
catch (const PDNSException& e) {
throw PDNSException(e.reason + "on line " + std::to_string(linenum) + " of " + filename);
}
catch (...) {
throw PDNSException("Conversion error parsing line " + std::to_string(linenum) + " of " + filename);
}
Expand Down

0 comments on commit 1d19e1a

Please sign in to comment.