From: Remi Gacogne Date: Thu, 31 Jan 2019 13:59:29 +0000 (+0100) Subject: Remove trailing whitespaces X-Git-Tag: dnsdist-1.4.0-alpha1~27^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=488bcb3985ee7064e52468f67ae939dd1271c35f;p=thirdparty%2Fpdns.git Remove trailing whitespaces --- diff --git a/ext/ipcrypt/ipcrypt.h b/ext/ipcrypt/ipcrypt.h index 5d07614a13..76b94f58d0 100644 --- a/ext/ipcrypt/ipcrypt.h +++ b/ext/ipcrypt/ipcrypt.h @@ -16,9 +16,9 @@ int ipcrypt_encrypt(unsigned char out[IPCRYPT_BYTES], int ipcrypt_decrypt(unsigned char out[IPCRYPT_BYTES], const unsigned char in[IPCRYPT_BYTES], const unsigned char key[IPCRYPT_KEYBYTES]); - + #ifdef __cplusplus } /* End of the 'extern "C"' block */ #endif - + #endif diff --git a/pdns/Makefile.am b/pdns/Makefile.am index acfc9d5c74..e1b6e1b207 100644 --- a/pdns/Makefile.am +++ b/pdns/Makefile.am @@ -895,7 +895,7 @@ dnswasher_SOURCES = \ statbag.cc \ unix_utility.cc -dnswasher_LDFLAGS = $(AM_LDFLAGS) $(BOOST_PROGRAM_OPTIONS_LDFLAGS) $(LIBCRYPTO_LDFLAGS) +dnswasher_LDFLAGS = $(AM_LDFLAGS) $(BOOST_PROGRAM_OPTIONS_LDFLAGS) $(LIBCRYPTO_LDFLAGS) dnswasher_LDADD = $(BOOST_PROGRAM_OPTIONS_LIBS) $(LIBCRYPTO_LIBS) dnsbulktest_SOURCES = \ diff --git a/pdns/dnsdist-lua-bindings.cc b/pdns/dnsdist-lua-bindings.cc index b7702c0fcd..ba1e49b3f0 100644 --- a/pdns/dnsdist-lua-bindings.cc +++ b/pdns/dnsdist-lua-bindings.cc @@ -183,7 +183,7 @@ void setupLuaBindings(bool client) return makeIPCipherKey(password); }); #endif /* HAVE_LIBCRYPTO */ - + /* DNSName */ g_lua.registerFunction("isPartOf", &DNSName::isPartOf); g_lua.registerFunction("chopOff", [](DNSName&dn ) { return dn.chopOff(); }); diff --git a/pdns/dnsdistdist/docs/reference/comboaddress.rst b/pdns/dnsdistdist/docs/reference/comboaddress.rst index ca1262df20..7ecdfa6545 100644 --- a/pdns/dnsdistdist/docs/reference/comboaddress.rst +++ b/pdns/dnsdistdist/docs/reference/comboaddress.rst @@ -31,9 +31,9 @@ ComboAddresses can be IPv4 or IPv6, and unless you want to know, you don't need .. method:: ComboAddress:ipencrypt(key) -> ComboAddress Encrypt this IP address as described in https://powerdns.org/ipcipher - + :param string key: A 16 byte key. Note that this can be derived from a passphrase with the standalone function `makeIPCipherKey` - + .. method:: ComboAddress:isIPv4() -> bool Returns true if the address is an IPv4, false otherwise diff --git a/pdns/dnswasher.cc b/pdns/dnswasher.cc index 0f81c385be..3ae3ea7ee3 100644 --- a/pdns/dnswasher.cc +++ b/pdns/dnswasher.cc @@ -72,7 +72,7 @@ public: { return std::unique_ptr(new IPSeqObfuscator()); } - + uint32_t obf4(uint32_t orig) override { if(d_romap.count(orig)) @@ -132,7 +132,7 @@ public: { return std::unique_ptr(new IPCipherObfuscator(key, decrypt)); } - + uint32_t obf4(uint32_t orig) override { ComboAddress ca; @@ -172,7 +172,7 @@ try ("key,k", po::value(), "base64 encoded 128 bit key for ipcipher") ("passphrase,p", po::value(), "passphrase for ipcipher (will be used to derive key)") ("decrypt,d", "decrypt IP addresses with ipcipher"); - + po::options_description alloptions; po::options_description hidden("hidden options"); hidden.add_options() @@ -206,7 +206,7 @@ try } bool doDecrypt = g_vm.count("decrypt"); - + PcapPacketWriter pw(g_vm["outfile"].as()); std::unique_ptr ipo; @@ -222,7 +222,7 @@ try } else if(!g_vm.count("key") && g_vm.count("passphrase")) { string key = makeIPCipherKey(g_vm["passphrase"].as()); - + ipo = IPCipherObfuscator::make(key, doDecrypt); } else { @@ -237,21 +237,21 @@ try while(pr.getUDPPacket()) { if(ntohs(pr.d_udp->uh_dport)==53 || (ntohs(pr.d_udp->uh_sport)==53 && pr.d_len > sizeof(dnsheader))) { dnsheader* dh=(dnsheader*)pr.d_payload; - + if (pr.d_ip->ip_v == 4){ uint32_t *src=(uint32_t*)&pr.d_ip->ip_src; uint32_t *dst=(uint32_t*)&pr.d_ip->ip_dst; - + if(dh->qr) *dst=ipo->obf4(*dst); else *src=ipo->obf4(*src); - + pr.d_ip->ip_sum=0; } else if (pr.d_ip->ip_v == 6) { auto src=&pr.d_ip6->ip6_src; auto dst=&pr.d_ip6->ip6_dst; - + if(dh->qr) *dst=ipo->obf6(*dst); else diff --git a/pdns/ipcipher.cc b/pdns/ipcipher.cc index 745fe4721f..57a2aa3f8a 100644 --- a/pdns/ipcipher.cc +++ b/pdns/ipcipher.cc @@ -22,7 +22,7 @@ static ComboAddress encryptCA4(const ComboAddress& ca, const std::string &key) { if(key.size() != 16) throw std::runtime_error("Need 128 bits of key for ipcrypt"); - + ComboAddress ret=ca; // always returns 0, has no failure mode @@ -36,7 +36,7 @@ static ComboAddress decryptCA4(const ComboAddress& ca, const std::string &key) { if(key.size() != 16) throw std::runtime_error("Need 128 bits of key for ipcrypt"); - + ComboAddress ret=ca; // always returns 0, has no failure mode @@ -57,7 +57,7 @@ static ComboAddress encryptCA6(const ComboAddress& ca, const std::string &key) AES_KEY wctx; AES_set_encrypt_key((const unsigned char*)key.c_str(), 128, &wctx); AES_encrypt((const unsigned char*)&ca.sin6.sin6_addr.s6_addr, - (unsigned char*)&ret.sin6.sin6_addr.s6_addr, &wctx); + (unsigned char*)&ret.sin6.sin6_addr.s6_addr, &wctx); return ret; } @@ -66,13 +66,13 @@ static ComboAddress decryptCA6(const ComboAddress& ca, const std::string &key) { if(key.size() != 16) throw std::runtime_error("Need 128 bits of key for ipcrypt"); - + ComboAddress ret=ca; AES_KEY wctx; AES_set_decrypt_key((const unsigned char*)key.c_str(), 128, &wctx); AES_decrypt((const unsigned char*)&ca.sin6.sin6_addr.s6_addr, - (unsigned char*)&ret.sin6.sin6_addr.s6_addr, &wctx); - + (unsigned char*)&ret.sin6.sin6_addr.s6_addr, &wctx); + return ret; } diff --git a/pdns/pdnsutil.cc b/pdns/pdnsutil.cc index ffad92e75b..1a93fd1d51 100644 --- a/pdns/pdnsutil.cc +++ b/pdns/pdnsutil.cc @@ -77,7 +77,7 @@ void loadMainConfig(const std::string& configdir) exit(0); } - if(::arg()["config-name"]!="") + if(::arg()["config-name"]!="") s_programname+="-"+::arg()["config-name"]; string configname=::arg()["config-dir"]+"/"+s_programname+".conf"; @@ -113,22 +113,22 @@ void loadMainConfig(const std::string& configdir) g_log.toConsole(Logger::Error); // so we print any errors BackendMakers().launch(::arg()["launch"]); // vrooooom! if(::arg().asNum("loglevel") >= 3) // so you can't kill our errors - g_log.toConsole((Logger::Urgency)::arg().asNum("loglevel")); + g_log.toConsole((Logger::Urgency)::arg().asNum("loglevel")); //cerr<<"Backend: "<<::arg()["launch"]<<", '" << ::arg()["gmysql-dbname"] <<"'" <getBits()).length() >= 8) ? 1 : 8 - std::to_string(key.first.getKey()->getBits()).length(); if (key.first.getKey()->getBits() < 1) { cout<<"invalid "<getBits()<get(rr)) { if(rr.qtype.getCode()) { - if ( (rr.qtype.getCode() == QType::NS || rr.qtype.getCode() == QType::SRV || rr.qtype.getCode() == QType::MX || rr.qtype.getCode() == QType::CNAME) && !rr.content.empty() && rr.content[rr.content.size()-1] != '.') + if ( (rr.qtype.getCode() == QType::NS || rr.qtype.getCode() == QType::SRV || rr.qtype.getCode() == QType::MX || rr.qtype.getCode() == QType::CNAME) && !rr.content.empty() && rr.content[rr.content.size()-1] != '.') rr.content.append(1, '.'); - + cout<startTransaction(zone, di.id)) { cerr<<"Unable to start transaction for load of zone '"<feedRecord(rr, DNSName()); } - + di.backend->commitTransaction(); return EXIT_SUCCESS; @@ -1159,7 +1159,7 @@ int addOrReplaceRecord(bool addOrReplace, const vector& cmds) { DNSName name; if(cmds[2]=="@") name=zone; - else + else name=DNSName(cmds[2])+zone; rr.qtype = DNSRecordContent::TypeToNumber(cmds[3]); @@ -1227,7 +1227,7 @@ int addOrReplaceRecord(bool addOrReplace, const vector& cmds) { newrrs.push_back(rr); } - + di.backend->replaceRRSet(di.id, name, rr.qtype, newrrs); // need to be explicit to bypass the ueberbackend cache! di.backend->lookup(rr.qtype, name, 0, di.id); @@ -1239,7 +1239,7 @@ int addOrReplaceRecord(bool addOrReplace, const vector& cmds) { } // delete-rrset zone name type -int deleteRRSet(const std::string& zone_, const std::string& name_, const std::string& type_) +int deleteRRSet(const std::string& zone_, const std::string& name_, const std::string& type_) { UeberBackend B; DomainInfo di; @@ -1252,7 +1252,7 @@ int deleteRRSet(const std::string& zone_, const std::string& name_, const std::s DNSName name; if(name_=="@") name=zone; - else + else name=DNSName(name_)+zone; QType qt(QType::chartocode(type_.c_str())); @@ -1317,16 +1317,16 @@ void testSpeed(DNSSECKeeper& dk, const DNSName& zone, const string& remote, int rr.ttl=3600; rr.auth=1; rr.qclass = QClass::IN; - + UeberBackend db("key-only"); - + if ( ! db.backends.size() ) { throw runtime_error("No backends available for DNSSEC key storage"); } ChunkedSigningPipe csp(DNSName(zone), 1, cores); - + vector signatures; uint32_t rnd; unsigned char* octets = (unsigned char*)&rnd; @@ -1335,10 +1335,10 @@ void testSpeed(DNSSECKeeper& dk, const DNSName& zone, const string& remote, int dt.set(); for(unsigned int n=0; n < 100000; ++n) { rnd = dns_random(UINT32_MAX); - snprintf(tmp, sizeof(tmp), "%d.%d.%d.%d", + snprintf(tmp, sizeof(tmp), "%d.%d.%d.%d", octets[0], octets[1], octets[2], octets[3]); rr.content=tmp; - + snprintf(tmp, sizeof(tmp), "r-%u", rnd); rr.qname=DNSName(tmp)+zone; DNSZoneRecord dzr; @@ -1384,7 +1384,7 @@ void verifyCrypto(const string& zone) toSign.push_back(DNSRecordContent::mastermake(rr.qtype.getCode(), 1, rr.content)); } } - + string msg = getMessageForRRSET(qname, rrc, toSign); cerr<<"Verify: "<verify(msg, rrc.d_signature)<& int main(int argc, char** argv) try -{ +{ po::options_description desc("Allowed options"); desc.add_options() ("help,h", "produce help message") @@ -1964,14 +1964,14 @@ try #ifdef HAVE_P11KIT1 cout<<"hsm assign ZONE ALGORITHM {ksk|zsk} MODULE SLOT PIN LABEL"<convertToISC() < key(DNSCryptoKeyEngine::makeFromPEMString(drc, raw)); dpk.setKey(key); - + dpk.d_algorithm = pdns_stou(cmds[3]); - + if(dpk.d_algorithm == DNSSECKeeper::RSASHA1NSEC3SHA1) dpk.d_algorithm = DNSSECKeeper::RSASHA1; - + cerr<<(int)dpk.d_algorithm< 4) { if(pdns_iequals(cmds[4], "ZSK")) dpk.d_flags = 256; @@ -2695,7 +2695,7 @@ try } else { cout< key(DNSCryptoKeyEngine::makeFromISCFile(drc, fname.c_str())); dpk.setKey(key); dpk.d_algorithm = drc.d_algorithm; - + if(dpk.d_algorithm == DNSSECKeeper::RSASHA1NSEC3SHA1) dpk.d_algorithm = DNSSECKeeper::RSASHA1; - - dpk.d_flags = 257; + + dpk.d_flags = 257; bool active=true; for(unsigned int n = 3; n < cmds.size(); ++n) { @@ -2725,10 +2725,10 @@ try active = 1; else if(pdns_iequals(cmds[n], "passive") || pdns_iequals(cmds[n], "inactive")) // passive eventually needs to be removed active = 0; - else { + else { cerr<<"Unknown key flag '"<create(bits); - dspk.setKey(dpk); - dspk.d_algorithm = algorithm; - dspk.d_flags = keyOrZone ? 257 : 256; + dpk->create(bits); + dspk.setKey(dpk); + dspk.d_algorithm = algorithm; + dspk.d_flags = keyOrZone ? 257 : 256; - // print key to stdout - cout << "Flags: " << dspk.d_flags << endl << - dspk.getKey()->convertToISC() << endl; + // print key to stdout + cout << "Flags: " << dspk.d_flags << endl << + dspk.getKey()->convertToISC() << endl; } else if (cmds[0]=="generate-tsig-key") { string usage = "Syntax: " + cmds[0] + " name (hmac-md5|hmac-sha1|hmac-sha224|hmac-sha256|hmac-sha384|hmac-sha512)"; if (cmds.size() < 3) { @@ -2896,7 +2896,7 @@ try return 1; } UeberBackend B("default"); - std::vector meta; + std::vector meta; if (!B.getDomainMetadata(zname, metaKey, meta)) { cerr << "Failure enabling TSIG key " << name << " for " << zname << endl; return 1; @@ -2978,7 +2978,7 @@ try for(const auto& each_meta: meta) { cout << each_meta.first << " = " << boost::join(each_meta.second, ", ") << endl; } - } + } return 0; } else if (cmds[0]=="set-meta" || cmds[0]=="add-meta") { @@ -3044,11 +3044,11 @@ try pub_label = label; std::ostringstream iscString; - iscString << "Private-key-format: v1.2" << std::endl << - "Algorithm: " << algorithm << std::endl << + iscString << "Private-key-format: v1.2" << std::endl << + "Algorithm: " << algorithm << std::endl << "Engine: " << module << std::endl << "Slot: " << slot << std::endl << - "PIN: " << pin << std::endl << + "PIN: " << pin << std::endl << "Label: " << label << std::endl << "PubLabel: " << pub_label << std::endl; @@ -3103,19 +3103,19 @@ try cerr << "Unable to create key for unknown zone '" << zone << "'" << std::endl; return 1; } - + id = pdns_stou(cmds[3]); - std::vector keys; + std::vector keys; if (!B.getDomainKeys(zone, keys)) { cerr << "No keys found for zone " << zone << std::endl; return 1; - } + } std::shared_ptr dke = nullptr; - // lookup correct key + // lookup correct key for(DNSBackend::KeyData &kd : keys) { if (kd.id == id) { - // found our key. + // found our key. DNSKEYRecordContent dkrc; dke = DNSCryptoKeyEngine::makeFromISCString(dkrc, kd.content); } @@ -3144,7 +3144,7 @@ try } #else cerr<<"PKCS#11 support not enabled"<