]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Apply suggestions from code review
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 15 Dec 2021 13:29:59 +0000 (14:29 +0100)
committerOtto <otto.moerbeek@open-xchange.com>
Wed, 15 Dec 2021 13:32:13 +0000 (14:32 +0100)
Co-authored-by: Remi Gacogne <github@coredump.fr>
pdns/pdnsutil.cc
pdns/sha.hh
pdns/zonemd.cc

index 48f767a0454802fd2cef76ea7ba8a6390dcdbb59..25fb93c4336c2a5e9cad7f0b51019a2d67945b75 100644 (file)
@@ -3200,7 +3200,7 @@ try
   }
   else if (cmds.at(0) == "unset-nsec3") {
     if(cmds.size() < 2) {
-      cerr<<"Syntax: pdnsutil unset-nsec3 ZON"<<endl;
+      cerr<<"Syntax: pdnsutil unset-nsec3 ZONE"<<endl;
       return 0;
     }
     if (!dk.unsetNSEC3PARAM(DNSName(cmds.at(1)))) {
index 18c445ee286a836d0fe65d5eda4e4d2936f5878d..077b1db2cb46b0abd2b46a3b5d7878308cbb9ee4 100644 (file)
@@ -58,11 +58,11 @@ namespace pdns
 class SHADigest
 {
 public:
-  SHADigest(int bits)
+  SHADigest(unsigned int bits)
   {
     mdctx = EVP_MD_CTX_new();
     if (mdctx == nullptr) {
-      throw std::runtime_error("VSHADigest: P_MD_CTX_new failed");
+      throw std::runtime_error("SHADigest: EVP_MD_CTX_new failed");
     }
     switch (bits) {
     case 256:
@@ -90,7 +90,7 @@ public:
     }
   }
 
-  void process(const std::string& msg, size_t sz)
+  void process(const std::string& msg)
   {
     if (EVP_DigestUpdate(mdctx, msg.data(), msg.size()) == 0) {
       throw std::runtime_error("SHADigest: update error");
@@ -106,7 +106,7 @@ public:
       throw std::runtime_error("SHADigest: finalize error");
     }
     if (md_len != md_value.size()) {
-      throw std::runtime_error("SHADigest: inconsisten size");
+      throw std::runtime_error("SHADigest: inconsistent size");
     }
     return md_value;
   }
index afebdfc1dd7338403c173caf8af4eff71697d2ed..c48357cdfee063352f4628b46eb40e45e1ff07e4 100644 (file)
@@ -30,7 +30,7 @@ void pdns::zonemdVerify(const DNSName& zone, ZoneParserTNG& zpt, bool& validatio
   validationDone = false;
   validationOK = false;
 
-  // scheme,hasalgo -> duplicate,zonemdrecord
+  // scheme,hashalgo -> duplicate,zonemdrecord
   struct ZoneMDAndDuplicateFlag
   {
     std::shared_ptr<ZONEMDRecordContent> record;
@@ -117,10 +117,10 @@ void pdns::zonemdVerify(const DNSName& zone, ZoneParserTNG& zpt, bool& validatio
   // A little helper
   auto hash = [&sha384digest, &sha512digest](const std::string& msg) {
     if (sha384digest) {
-      sha384digest->process(msg, msg.size());
+      sha384digest->process(msg);
     }
     if (sha512digest) {
-      sha512digest->process(msg, msg.size());
+      sha512digest->process(msg);
     }
   };