From: Fred Morcos Date: Mon, 9 May 2022 07:58:19 +0000 (+0200) Subject: Whitespace X-Git-Tag: auth-4.8.0-alpha0~63^2~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b35fe8609f6f96995b39163ed85138bce576421d;p=thirdparty%2Fpdns.git Whitespace --- diff --git a/Makefile.am b/Makefile.am index d5bb1f0bc3..db54310797 100644 --- a/Makefile.am +++ b/Makefile.am @@ -30,4 +30,3 @@ dvi: # do nothing to build dvi format-code: ./build-scripts/format-code `find . -type f -name '*.[ch][ch]' | LANG=C sort | LANG=C comm -23 - .not-formatted` - diff --git a/pdns/dnsrecords.cc b/pdns/dnsrecords.cc index be749b7a8f..66e29f1a07 100644 --- a/pdns/dnsrecords.cc +++ b/pdns/dnsrecords.cc @@ -91,17 +91,17 @@ bool DNSResourceRecord::operator==(const DNSResourceRecord& rhs) boilerplate_conv(A, conv.xfrIP(d_ip)); -ARecordContent::ARecordContent(uint32_t ip) +ARecordContent::ARecordContent(uint32_t ip) { d_ip = ip; } -ARecordContent::ARecordContent(const ComboAddress& ca) +ARecordContent::ARecordContent(const ComboAddress& ca) { d_ip = ca.sin4.sin_addr.s_addr; } -AAAARecordContent::AAAARecordContent(const ComboAddress& ca) +AAAARecordContent::AAAARecordContent(const ComboAddress& ca) { d_ip6.assign((const char*)ca.sin6.sin6_addr.s6_addr, 16); } @@ -130,7 +130,7 @@ ComboAddress AAAARecordContent::getCA(int port) const void ARecordContent::doRecordCheck(const DNSRecord& dr) -{ +{ if(dr.d_clen!=4) throw MOADNSException("Wrong size for A record ("+std::to_string(dr.d_clen)+")"); } @@ -157,7 +157,7 @@ boilerplate_conv(SPF, conv.xfrText(d_text, true)); boilerplate_conv(HINFO, conv.xfrText(d_cpu); conv.xfrText(d_host)); boilerplate_conv(RP, - conv.xfrName(d_mbox); + conv.xfrName(d_mbox); conv.xfrName(d_info) ); @@ -209,7 +209,7 @@ boilerplate_conv(TSIG, conv.xfr16BitInt(d_origID); conv.xfr16BitInt(d_eRcode); size=d_otherData.size(); - conv.xfr16BitInt(size); + conv.xfr16BitInt(size); if (size>0) conv.xfrBlobNoSpaces(d_otherData, size); ); @@ -231,7 +231,7 @@ boilerplate_conv(IPSECKEY, conv.xfr8BitInt(d_preference); conv.xfr8BitInt(d_gatewaytype); conv.xfr8BitInt(d_algorithm); - + // now we need to determine values switch(d_gatewaytype) { case 0: // NO KEY @@ -243,7 +243,7 @@ boilerplate_conv(IPSECKEY, conv.xfrIP6(d_ip6); break; case 3: // DNS label - conv.xfrName(d_gateway, false); + conv.xfrName(d_gateway, false); break; default: throw MOADNSException("Parsing record content: invalid gateway type"); @@ -259,7 +259,7 @@ boilerplate_conv(IPSECKEY, default: throw MOADNSException("Parsing record content: invalid algorithm type"); } -) +) boilerplate_conv(DHCID, conv.xfrBlob(d_content); @@ -279,16 +279,16 @@ boilerplate_conv(NAPTR, ) -SRVRecordContent::SRVRecordContent(uint16_t preference, uint16_t weight, uint16_t port, DNSName target) +SRVRecordContent::SRVRecordContent(uint16_t preference, uint16_t weight, uint16_t port, DNSName target) : d_weight(weight), d_port(port), d_target(std::move(target)), d_preference(preference) {} boilerplate_conv(SRV, conv.xfr16BitInt(d_preference); conv.xfr16BitInt(d_weight); conv.xfr16BitInt(d_port); - conv.xfrName(d_target); + conv.xfrName(d_target); ) -SOARecordContent::SOARecordContent(DNSName mname, DNSName rname, const struct soatimes& st) +SOARecordContent::SOARecordContent(DNSName mname, DNSName rname, const struct soatimes& st) : d_mname(std::move(mname)), d_rname(std::move(rname)), d_st(st) { } @@ -304,9 +304,9 @@ boilerplate_conv(SOA, ); #undef KEY boilerplate_conv(KEY, - conv.xfr16BitInt(d_flags); - conv.xfr8BitInt(d_protocol); - conv.xfr8BitInt(d_algorithm); + conv.xfr16BitInt(d_flags); + conv.xfr8BitInt(d_protocol); + conv.xfr8BitInt(d_algorithm); conv.xfrBlob(d_certificate); ); @@ -318,21 +318,21 @@ boilerplate_conv(ZONEMD, ); boilerplate_conv(CERT, - conv.xfr16BitInt(d_type); + conv.xfr16BitInt(d_type); if (d_type == 0) throw MOADNSException("CERT type 0 is reserved"); - conv.xfr16BitInt(d_tag); - conv.xfr8BitInt(d_algorithm); + conv.xfr16BitInt(d_tag); + conv.xfr8BitInt(d_algorithm); conv.xfrBlob(d_certificate); ) boilerplate_conv(TLSA, - conv.xfr8BitInt(d_certusage); - conv.xfr8BitInt(d_selector); - conv.xfr8BitInt(d_matchtype); + conv.xfr8BitInt(d_certusage); + conv.xfr8BitInt(d_selector); + conv.xfr8BitInt(d_matchtype); conv.xfrHexBlob(d_cert, true); - ) - + ) + boilerplate_conv(OPENPGPKEY, conv.xfrBlob(d_keyring); ) @@ -362,69 +362,69 @@ boilerplate_conv(SMIMEA, DSRecordContent::DSRecordContent() {} boilerplate_conv(DS, - conv.xfr16BitInt(d_tag); - conv.xfr8BitInt(d_algorithm); - conv.xfr8BitInt(d_digesttype); + conv.xfr16BitInt(d_tag); + conv.xfr8BitInt(d_algorithm); + conv.xfr8BitInt(d_digesttype); conv.xfrHexBlob(d_digest, true); // keep reading across spaces ) CDSRecordContent::CDSRecordContent() {} boilerplate_conv(CDS, - conv.xfr16BitInt(d_tag); - conv.xfr8BitInt(d_algorithm); - conv.xfr8BitInt(d_digesttype); + conv.xfr16BitInt(d_tag); + conv.xfr8BitInt(d_algorithm); + conv.xfr8BitInt(d_digesttype); conv.xfrHexBlob(d_digest, true); // keep reading across spaces ) DLVRecordContent::DLVRecordContent() {} boilerplate_conv(DLV, - conv.xfr16BitInt(d_tag); - conv.xfr8BitInt(d_algorithm); - conv.xfr8BitInt(d_digesttype); + conv.xfr16BitInt(d_tag); + conv.xfr8BitInt(d_algorithm); + conv.xfr8BitInt(d_digesttype); conv.xfrHexBlob(d_digest, true); // keep reading across spaces ) boilerplate_conv(SSHFP, - conv.xfr8BitInt(d_algorithm); - conv.xfr8BitInt(d_fptype); + conv.xfr8BitInt(d_algorithm); + conv.xfr8BitInt(d_fptype); conv.xfrHexBlob(d_fingerprint, true); ) boilerplate_conv(RRSIG, - conv.xfrType(d_type); - conv.xfr8BitInt(d_algorithm); - conv.xfr8BitInt(d_labels); - conv.xfr32BitInt(d_originalttl); - conv.xfrTime(d_sigexpire); - conv.xfrTime(d_siginception); - conv.xfr16BitInt(d_tag); + conv.xfrType(d_type); + conv.xfr8BitInt(d_algorithm); + conv.xfr8BitInt(d_labels); + conv.xfr32BitInt(d_originalttl); + conv.xfrTime(d_sigexpire); + conv.xfrTime(d_siginception); + conv.xfr16BitInt(d_tag); conv.xfrName(d_signer); conv.xfrBlob(d_signature); ) - + RRSIGRecordContent::RRSIGRecordContent() {} boilerplate_conv(DNSKEY, - conv.xfr16BitInt(d_flags); - conv.xfr8BitInt(d_protocol); - conv.xfr8BitInt(d_algorithm); + conv.xfr16BitInt(d_flags); + conv.xfr8BitInt(d_protocol); + conv.xfr8BitInt(d_algorithm); conv.xfrBlob(d_key); ) DNSKEYRecordContent::DNSKEYRecordContent() {} boilerplate_conv(CDNSKEY, - conv.xfr16BitInt(d_flags); - conv.xfr8BitInt(d_protocol); - conv.xfr8BitInt(d_algorithm); + conv.xfr16BitInt(d_flags); + conv.xfr8BitInt(d_protocol); + conv.xfr8BitInt(d_algorithm); conv.xfrBlob(d_key); ) CDNSKEYRecordContent::CDNSKEYRecordContent() {} boilerplate_conv(RKEY, - conv.xfr16BitInt(d_flags); - conv.xfr8BitInt(d_protocol); - conv.xfr8BitInt(d_algorithm); + conv.xfr16BitInt(d_flags); + conv.xfr8BitInt(d_protocol); + conv.xfr8BitInt(d_algorithm); conv.xfrBlob(d_key); ) RKEYRecordContent::RKEYRecordContent() {} @@ -463,9 +463,9 @@ std::shared_ptr EUI48RecordContent::make(const string& zone) { // try to parse auto ret=std::make_shared(); - // format is 6 hex bytes and dashes - if (sscanf(zone.c_str(), "%2hhx-%2hhx-%2hhx-%2hhx-%2hhx-%2hhx", - ret->d_eui48, ret->d_eui48+1, ret->d_eui48+2, + // format is 6 hex bytes and dashes + if (sscanf(zone.c_str(), "%2hhx-%2hhx-%2hhx-%2hhx-%2hhx-%2hhx", + ret->d_eui48, ret->d_eui48+1, ret->d_eui48+2, ret->d_eui48+3, ret->d_eui48+4, ret->d_eui48+5) != 6) { throw MOADNSException("Asked to encode '"+zone+"' as an EUI48 address, but does not parse"); } @@ -474,13 +474,13 @@ std::shared_ptr EUI48RecordContent::make(const string& zone) void EUI48RecordContent::toPacket(DNSPacketWriter& pw) { string blob(d_eui48, d_eui48+6); - pw.xfrBlob(blob); + pw.xfrBlob(blob); } string EUI48RecordContent::getZoneRepresentation(bool noDot) const { - char tmp[18]; + char tmp[18]; snprintf(tmp,sizeof(tmp),"%02x-%02x-%02x-%02x-%02x-%02x", - d_eui48[0], d_eui48[1], d_eui48[2], + d_eui48[0], d_eui48[1], d_eui48[2], d_eui48[3], d_eui48[4], d_eui48[5]); return tmp; } @@ -507,7 +507,7 @@ std::shared_ptr EUI64RecordContent::make(const string& zone) // try to parse auto ret=std::make_shared(); // format is 8 hex bytes and dashes - if (sscanf(zone.c_str(), "%2hhx-%2hhx-%2hhx-%2hhx-%2hhx-%2hhx-%2hhx-%2hhx", + if (sscanf(zone.c_str(), "%2hhx-%2hhx-%2hhx-%2hhx-%2hhx-%2hhx-%2hhx-%2hhx", ret->d_eui64, ret->d_eui64+1, ret->d_eui64+2, ret->d_eui64+3, ret->d_eui64+4, ret->d_eui64+5, ret->d_eui64+6, ret->d_eui64+7) != 8) { @@ -522,7 +522,7 @@ void EUI64RecordContent::toPacket(DNSPacketWriter& pw) } string EUI64RecordContent::getZoneRepresentation(bool noDot) const { - char tmp[24]; + char tmp[24]; snprintf(tmp,sizeof(tmp),"%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x", d_eui64[0], d_eui64[1], d_eui64[2], d_eui64[3], d_eui64[4], d_eui64[5], @@ -837,7 +837,7 @@ static uint16_t makeTag(const std::string& data) unsigned long ac; /* assumed to be 32 bits or larger */ unsigned int i; /* loop index */ - + for ( ac = 0, i = 0; i < keysize; ++i ) ac += (i & 1) ? key[i] : key[i] << 8; ac += (ac >> 16) & 0xFFFF; @@ -850,7 +850,7 @@ uint16_t DNSKEYRecordContent::getTag() const return makeTag(tmp.serialize(DNSName())); // this can't be const for some reason } -uint16_t DNSKEYRecordContent::getTag() +uint16_t DNSKEYRecordContent::getTag() { return makeTag(this->serialize(DNSName())); } diff --git a/pdns/dnsrecords.hh b/pdns/dnsrecords.hh index 3dc3efae42..4201448757 100644 --- a/pdns/dnsrecords.hh +++ b/pdns/dnsrecords.hh @@ -368,7 +368,7 @@ public: string d_key; bool operator<(const DNSKEYRecordContent& rhs) const { - return std::tie(d_flags, d_protocol, d_algorithm, d_key) < + return std::tie(d_flags, d_protocol, d_algorithm, d_key) < std::tie(rhs.d_flags, rhs.d_protocol, rhs.d_algorithm, rhs.d_key); } }; @@ -552,7 +552,7 @@ public: class RRSIGRecordContent : public DNSRecordContent { public: - RRSIGRecordContent(); + RRSIGRecordContent(); includeboilerplate(RRSIG) uint16_t d_type{0}; @@ -564,7 +564,7 @@ public: }; //namespace { - struct soatimes + struct soatimes { uint32_t serial; uint32_t refresh; @@ -891,7 +891,7 @@ private: DNSName d_fqdn; }; -class EUI48RecordContent : public DNSRecordContent +class EUI48RecordContent : public DNSRecordContent { public: EUI48RecordContent() {}; @@ -903,7 +903,7 @@ public: uint16_t getType() const override { return QType::EUI48; } private: // storage for the bytes - uint8_t d_eui48[6]; + uint8_t d_eui48[6]; }; class EUI64RecordContent : public DNSRecordContent @@ -1031,8 +1031,8 @@ string RNAME##RecordContent::getZoneRepresentation(bool noDot) const RecordTextWriter rtw(ret, noDot); \ const_cast(this)->xfrPacket(rtw); \ return ret; \ -} - +} + #define boilerplate_conv(RNAME, CONV) \ boilerplate(RNAME) \ diff --git a/pdns/test-iputils_hh.cc b/pdns/test-iputils_hh.cc index 36e65779c4..0d358023df 100644 --- a/pdns/test-iputils_hh.cc +++ b/pdns/test-iputils_hh.cc @@ -21,16 +21,16 @@ BOOST_AUTO_TEST_CASE(test_ComboAddress) { ComboAddress remote("130.161.33.15", 53); BOOST_CHECK(!(local == remote)); BOOST_CHECK_EQUAL(remote.sin4.sin_port, htons(53)); - + ComboAddress withport("213.244.168.210:53"); BOOST_CHECK_EQUAL(withport.sin4.sin_port, htons(53)); - + ComboAddress withportO("213.244.168.210:53", 5300); BOOST_CHECK_EQUAL(withportO.sin4.sin_port, htons(53)); - + withport = ComboAddress("[::]:53"); BOOST_CHECK_EQUAL(withport.sin4.sin_port, htons(53)); - + withport = ComboAddress("[::]:5300", 53); BOOST_CHECK_EQUAL(withport.sin4.sin_port, htons(5300)); @@ -112,7 +112,7 @@ BOOST_AUTO_TEST_CASE(test_ComboAddressTruncate) { ca4.truncate(29); BOOST_CHECK_EQUAL(ca4.toString(), "130.161.252.24"); - + ca4.truncate(23); BOOST_CHECK_EQUAL(ca4.toString(), "130.161.252.0"); @@ -139,7 +139,7 @@ BOOST_AUTO_TEST_CASE(test_ComboAddressTruncate) { BOOST_CHECK_EQUAL(ca6.toString(), "2001::"); ca6.truncate(8); BOOST_CHECK_EQUAL(ca6.toString(), "2000::"); - + orig=ca6=ComboAddress("2001:888:2000:1d::2"); for(int n=128; n; --n) { @@ -171,7 +171,7 @@ BOOST_AUTO_TEST_CASE(test_Mapping) BOOST_AUTO_TEST_CASE(test_Netmask) { ComboAddress local("127.0.0.1", 53); ComboAddress remote("130.161.252.29", 53); - + Netmask nm("127.0.0.1/24"); BOOST_CHECK(nm.getBits() == 24); BOOST_CHECK(nm.match(local));