]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
More use of hasLabels
authorMiod Vallat <miod.vallat@powerdns.com>
Fri, 25 Jul 2025 12:59:06 +0000 (14:59 +0200)
committerMiod Vallat <miod.vallat@powerdns.com>
Fri, 25 Jul 2025 13:02:42 +0000 (15:02 +0200)
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
pdns/dnspacket.cc
pdns/nsec3dig.cc
pdns/resolver.cc
pdns/zone2ldap.cc

index 5f7407fa1e8bd6c14f26d2bd6ceff76bf45265e0..a5130988742208d84d83cfba1a3c3b4045b5d3f4 100644 (file)
@@ -333,8 +333,7 @@ void DNSPacket::wrapup(bool throwsOnTruncation)
     }
   }
 
-  if (d_trc.d_algoName.countLabels())
-  {
+  if (d_trc.d_algoName.hasLabels()) {
     // TSIG is not OPT, but we count it in optsize anyway
     optsize += d_trc.d_algoName.wirelength() + 3 + 1 + 2; // algo + time + fudge + maclen
     optsize += EVP_MAX_MD_SIZE + 2 + 2 + 2 + 0; // mac + origid + ercode + otherdatalen + no other data
@@ -400,8 +399,9 @@ void DNSPacket::wrapup(bool throwsOnTruncation)
     }
   }
 
-  if(d_trc.d_algoName.countLabels())
+  if(d_trc.d_algoName.hasLabels()) {
     addTSIG(pw, d_trc, d_tsigkeyname, d_tsigsecret, d_tsigprevious, d_tsigtimersonly);
+  }
 
   d_rawpacket.assign((char*)&packet[0], packet.size()); // XXX we could do this natively on a vector..
 
@@ -458,7 +458,7 @@ std::unique_ptr<DNSPacket> DNSPacket::replyPacket() const
   r->d_ednsrcode = 0;
   r->d_xfr = d_xfr;
 
-  if(d_tsigkeyname.countLabels()) {
+  if(d_tsigkeyname.hasLabels()) {
     r->d_tsigkeyname = d_tsigkeyname;
     r->d_tsigprevious = d_tsigprevious;
     r->d_trc = d_trc;
index a5d6dcb5ecd7bcc179b77bece4b5075d2e1a3a9a..1a7c04a011d3c98bf364b3ab142367d38310807b 100644 (file)
@@ -253,7 +253,7 @@ try
     }
     prev=shorter;
   }
-  if(encloser.countLabels() && nextcloser.countLabels())
+  if(encloser.hasLabels() && nextcloser.hasLabels())
   {
     if(denied.count(nextcloser))
     {
index 7baede556a7deb318c20ea3e4a5fa5662a669887..530a562ac5dbec5175caa8024e991e3cabce061e 100644 (file)
@@ -202,7 +202,7 @@ namespace pdns {
       if(mdp.d_header.rcode)
         return mdp.d_header.rcode;
 
-      if(origQname.countLabels()) {  // not AXFR
+      if(origQname.hasLabels()) {  // not AXFR
         if(mdp.d_header.id != id)
           throw ResolverException("Remote nameserver replied with wrong id");
         if(mdp.d_header.qdcount != 1)
index ae46bea350424b6b1b25a307e13264b381ff53b7..2277e6c7807451db102fd3172118f9de367dfac8 100644 (file)
@@ -91,11 +91,11 @@ static void callback_simple( unsigned int domain_id, const DNSName &domain, cons
         std::string stripped=stripDot(content);
         std::string rrvalue = stripped + ((stripped.empty() || stripped[stripped.size()-1]==' ') ? "." : "");
         std::string dn = "dc=";
-        if( host.countLabels() ) { dn += host.toStringNoDot() + ",dc="; }
+        if( host.hasLabels() ) { dn += host.toStringNoDot() + ",dc="; }
         dn += g_zonename.toStringNoDot() + "," + g_basedn;
         cout << "dn: " << dn << endl;
 
-        if( host.countLabels() == 0 ) { host = g_zonename.operator const DNSName&(); }
+        if( !host.hasLabels() ) { host = g_zonename.operator const DNSName&(); }
 
         if( !g_entries[dn] )
         {