From: Miod Vallat Date: Mon, 13 Oct 2025 11:52:48 +0000 (+0200) Subject: In zone copy, proceed anyway if --force even if target doesn't support comments. X-Git-Tag: auth-5.0.1~5^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a2027ef1d3e1ba9a77a7e00090a3aa4a9d4998f;p=thirdparty%2Fpdns.git In zone copy, proceed anyway if --force even if target doesn't support comments. Signed-off-by: Miod Vallat (cherry picked from commit 516d38c2037c39fcc1833f49c8aa4e2fe263e12a) --- diff --git a/pdns/pdnsutil.cc b/pdns/pdnsutil.cc index 4482b4effa..08417c52bf 100644 --- a/pdns/pdnsutil.cc +++ b/pdns/pdnsutil.cc @@ -5056,23 +5056,29 @@ static int B2BMigrate(vector& cmds, const std::string_view synopsis) nc=0; if (src->listComments(di.id)) { bool firstComment{true}; + bool copyComments{true}; Comment comm; while (src->getComment(comm)) { if (firstComment) { firstComment = false; if ((tgt->getCapabilities() & DNSBackend::CAP_COMMENTS) == 0) { - // TODO: consider simply warning about comments not being copied, and - // skip them, rather than abort everything? - tgt->abortTransaction(); - throw PDNSException("Target backend does not support comments - remove them first"); + if (g_force) { + copyComments = false; + } + else { + tgt->abortTransaction(); + throw PDNSException("Target backend does not support comments - remove them first"); + } } } - comm.domain_id = di_new.id; - if (!tgt->feedComment(comm)) { - tgt->abortTransaction(); - throw PDNSException("Failed to feed zone comments"); + if (copyComments) { + comm.domain_id = di_new.id; + if (!tgt->feedComment(comm)) { + tgt->abortTransaction(); + throw PDNSException("Failed to feed zone comments"); + } + nc++; } - nc++; } } // move metadata