From 2330c421cb27d1d98321f223bdf8b8b0e16e9a45 Mon Sep 17 00:00:00 2001 From: Aki Tuomi Date: Mon, 14 Dec 2015 12:58:16 +0200 Subject: [PATCH] Compare TSIG algorithm as DNSName --- pdns/misc.cc | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/pdns/misc.cc b/pdns/misc.cc index 25b2f5105..c6a18ebad 100644 --- a/pdns/misc.cc +++ b/pdns/misc.cc @@ -1122,20 +1122,19 @@ uint64_t udpErrorStats(const std::string& str) bool getTSIGHashEnum(const DNSName& algoName, TSIGHashEnum& algoEnum) { - string strAlgoName = algoName.toString(); - if (strAlgoName == "hmac-md5.sig-alg.reg.int." || strAlgoName == "hmac-md5.") // FIXME400 + if (algoName == DNSName("hmac-md5.sig-alg.reg.int") || algoName == DNSName("hmac-md5")) algoEnum = TSIG_MD5; - else if (strAlgoName == "hmac-sha1.") + else if (algoName == DNSName("hmac-sha1")) algoEnum = TSIG_SHA1; - else if (strAlgoName == "hmac-sha224.") + else if (algoName == DNSName("hmac-sha224")) algoEnum = TSIG_SHA224; - else if (strAlgoName == "hmac-sha256.") + else if (algoName == DNSName("hmac-sha256")) algoEnum = TSIG_SHA256; - else if (strAlgoName == "hmac-sha384.") + else if (algoName == DNSName("hmac-sha384")) algoEnum = TSIG_SHA384; - else if (strAlgoName == "hmac-sha512.") + else if (algoName == DNSName("hmac-sha512")) algoEnum = TSIG_SHA512; - else if (strAlgoName == "gss-tsig.") + else if (algoName == DNSName("gss-tsig")) algoEnum = TSIG_GSS; else { return false; -- 2.40.0