diff --git a/pdns/pdnsutil.cc b/pdns/pdnsutil.cc index ed19662297cd..866a442d534b 100644 --- a/pdns/pdnsutil.cc +++ b/pdns/pdnsutil.cc @@ -2515,6 +2515,94 @@ static int addOrSetMeta(const DNSName& zone, const string& kind, const vector& cmds, DNSSECKeeper& dk) //NOLINT(readability-identifier-length) +{ + if(cmds.size() < 3 ) { + cerr << "Syntax: pdnsutil add-zone-key ZONE [zsk|ksk] [BITS] [active|inactive] [rsasha1|rsasha1-nsec3-sha1|rsasha256|rsasha512|ecdsa256|ecdsa384"; +#if defined(HAVE_LIBSODIUM) || defined(HAVE_LIBCRYPTO_ED25519) + cerr << "|ed25519"; +#endif +#if defined(HAVE_LIBCRYPTO_ED448) + cerr << "|ed448"; +#endif + cerr << "]"< 0) { + algorithm = tmp_algo; + } + else if (pdns_iequals(cmds.at(n), "active")) { + active=true; + } + else if (pdns_iequals(cmds.at(n), "inactive") || pdns_iequals(cmds.at(n), "passive")) { // 'passive' eventually needs to be removed + active=false; + } + else if (pdns_iequals(cmds.at(n), "published")) { + published = true; + } + else if (pdns_iequals(cmds.at(n), "unpublished")) { + published = false; + } + else if (pdns::checked_stoi(cmds.at(n)) != 0) { + pdns::checked_stoi_into(bits, cmds.at(n)); + } + else { + cerr << "Unknown algorithm, key flag or size '" << cmds.at(n) << "'" << endl; + return EXIT_FAILURE; + } + } + int64_t id{-1}; //NOLINT(readability-identifier-length) + if (!dk.addKey(zone, keyOrZone, algorithm, id, bits, active, published)) { + cerr<<"Adding key failed, perhaps DNSSEC not enabled in configuration?"< 0) { - algorithm = tmp_algo; - } - else if (pdns_iequals(cmds.at(n), "active")) { - active=true; - } - else if (pdns_iequals(cmds.at(n), "inactive") || pdns_iequals(cmds.at(n), "passive")) { // 'passive' eventually needs to be removed - active=false; - } - else if (pdns_iequals(cmds.at(n), "published")) { - published = true; - } - else if (pdns_iequals(cmds.at(n), "unpublished")) { - published = false; - } - else if (pdns::checked_stoi(cmds.at(n)) != 0) { - pdns::checked_stoi_into(bits, cmds.at(n)); - } - else { - cerr << "Unknown algorithm, key flag or size '" << cmds.at(n) << "'" << endl; - return EXIT_FAILURE; - } - } - int64_t id{-1}; - if (!dk.addKey(zone, keyOrZone, algorithm, id, bits, active, published)) { - cerr<<"Adding key failed, perhaps DNSSEC not enabled in configuration?"<