diff options
author | Jannis Hoffmann <jannis@fehcom.de> | 2024-07-03 23:33:05 +0200 |
---|---|---|
committer | Jannis Hoffmann <jannis@fehcom.de> | 2024-07-03 23:33:05 +0200 |
commit | cb9bff92107d168ff6dd0c12dc34bc7bacc8eb7d (patch) | |
tree | 189cf862c6f0b5ca7151c91642ae8d00b0ae9f4a /src/dkimverify.cpp | |
parent | 4ff4d753e04dc044cbe5a7a581d9a47a7ad488b2 (diff) |
remove "using namespace std" from cpp headers
Diffstat (limited to 'src/dkimverify.cpp')
-rw-r--r-- | src/dkimverify.cpp | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/src/dkimverify.cpp b/src/dkimverify.cpp index 334e1b4..90f871f 100644 --- a/src/dkimverify.cpp +++ b/src/dkimverify.cpp @@ -37,6 +37,8 @@ extern "C" { #include "dns.h" } +using std::string; + /***************************************************************************** * * Verifying DKIM Ed25519 signatures: @@ -413,7 +415,7 @@ bool WildcardMatch(const char *p, const char *s) // Parse addresses from a string. Returns true if at least one address found // //////////////////////////////////////////////////////////////////////////////// -bool ParseAddresses(string str, vector<string>& Addresses) +bool ParseAddresses(string str, std::vector<string>& Addresses) { char *s = (char *)str.c_str(); @@ -555,9 +557,9 @@ int CDKIMVerify::GetResults(void) int RealFailures = 0; int res = 0; - list<string> SuccessfulDomains; // can contain duplicates + std::list<string> SuccessfulDomains; // can contain duplicates - for (list<SignatureInfo>::iterator i = Signatures.begin(); i != Signatures.end(); ++i) { + for (std::list<SignatureInfo>::iterator i = Signatures.begin(); i != Signatures.end(); ++i) { if (i->Status == DKIM_SUCCESS) { if (!i->BodyHashData.empty()) { // FIRST: Get the body hash unsigned char md[EVP_MAX_MD_SIZE]; @@ -678,13 +680,13 @@ int CDKIMVerify::GetResults(void) // get the From address's domain if we might need it string sFromDomain; if (SuccessCount > 0 || m_CheckPractices) { - for (list<string>::iterator i = HeaderList.begin(); i != HeaderList.end(); ++i) { + for (std::list<string>::iterator i = HeaderList.begin(); i != HeaderList.end(); ++i) { if (_strnicmp(i->c_str(), "From", 4) == 0) { // skip over whitespace between the header name and : const char *s = i->c_str() + 4; while (*s == ' ' || *s == '\t') s++; if (*s == ':') { - vector<string> Addresses; + std::vector<string> Addresses; if (ParseAddresses(s + 1, Addresses)) { unsigned atpos = Addresses[0].find('@'); sFromDomain = Addresses[0].substr(atpos + 1); @@ -698,7 +700,7 @@ int CDKIMVerify::GetResults(void) // if a signature from the From domain verified successfully, return success now // without checking the author domain signing practices if (SuccessCount > 0 && !sFromDomain.empty()) { - for (list<string>::iterator i = SuccessfulDomains.begin(); i != SuccessfulDomains.end(); ++i) { + for (std::list<string>::iterator i = SuccessfulDomains.begin(); i != SuccessfulDomains.end(); ++i) { // see if the successful domain is the same as or a parent of the From domain if (i->length() > sFromDomain.length()) continue; if (_stricmp(i->c_str(), sFromDomain.c_str() + sFromDomain.length() - i->length()) != 0) continue; @@ -779,7 +781,7 @@ void SignatureInfo::Hash(const char *szBuffer, unsigned nBufLength, bool IsBody) //////////////////////////////////////////////////////////////////////////////// int CDKIMVerify::ProcessHeaders(void) { - for (list<string>::iterator i = HeaderList.begin(); i != HeaderList.end(); ++i) { + for (std::list<string>::iterator i = HeaderList.begin(); i != HeaderList.end(); ++i) { if (strlen(i->c_str()) < 14) continue; // too short if (_strnicmp(i->c_str(), "DKIM-Signature", 14) == 0) { // skip over whitespace between the header name and : @@ -800,7 +802,7 @@ int CDKIMVerify::ProcessHeaders(void) bool ValidSigFound = false; - for (list<SignatureInfo>::iterator s = Signatures.begin(); s != Signatures.end(); ++s) { + for (std::list<SignatureInfo>::iterator s = Signatures.begin(); s != Signatures.end(); ++s) { SignatureInfo& sig = *s; if (sig.Status != DKIM_SUCCESS) continue; SelectorInfo& sel = GetSelector(sig.Selector, sig.Domain); @@ -854,10 +856,11 @@ int CDKIMVerify::ProcessHeaders(void) #endif // compute the hash of the header - vector<list<string>::reverse_iterator> used; + std::vector<std::list<string>::reverse_iterator> used; - for (vector<string>::iterator x = sig.SignedHeaders.begin(); x != sig.SignedHeaders.end(); ++x) { - list<string>::reverse_iterator i; + for (std::vector<string>::iterator x = sig.SignedHeaders.begin(); x != sig.SignedHeaders.end(); ++x) + { + std::list<string>::reverse_iterator i; for (i = HeaderList.rbegin(); i != HeaderList.rend(); ++i) { if (_strnicmp(i->c_str(), x->c_str(), x->length()) == 0) { // skip over whitespace between the header name and : @@ -897,7 +900,7 @@ int CDKIMVerify::ProcessHeaders(void) if (!m_AllowUnsignedFromHeaders) { // make sure the message has no unsigned From headers - list<string>::reverse_iterator i; + std::list<string>::reverse_iterator i; for (i = HeaderList.rbegin(); i != HeaderList.rend(); ++i) { if (_strnicmp(i->c_str(), "From", 4) == 0) { // skip over whitespace between the header name and : @@ -1143,7 +1146,7 @@ int CDKIMVerify::ProcessBody(char *szBuffer, int nBufLength, bool bEOF) { bool MoreBodyNeeded = false; - for (list<SignatureInfo>::iterator i = Signatures.begin(); i != Signatures.end(); ++i) { + for (std::list<SignatureInfo>::iterator i = Signatures.begin(); i != Signatures.end(); ++i) { if (i->Status == DKIM_SUCCESS) { if (i->BodyCanonicalization == DKIM_CANON_SIMPLE) { if (nBufLength > 0) { @@ -1351,7 +1354,7 @@ int SelectorInfo::Parse(char *Buffer) SelectorInfo& CDKIMVerify::GetSelector(const string& sSelector, const string& sDomain) { // see if we already have this selector - for (list<SelectorInfo>::iterator i = Selectors.begin(); i != Selectors.end(); ++i) { + for (std::list<SelectorInfo>::iterator i = Selectors.begin(); i != Selectors.end(); ++i) { if (_stricmp(i->Selector.c_str(), sSelector.c_str()) == 0 && _stricmp(i->Domain.c_str(), sDomain.c_str()) == 0) { @@ -1401,7 +1404,7 @@ int CDKIMVerify::GetDetails(int *nSigCount, DKIMVerifyDetails **pDetails) { Details.clear(); - for (list<SignatureInfo>::iterator i = Signatures.begin(); i != Signatures.end(); ++i) { + for (std::list<SignatureInfo>::iterator i = Signatures.begin(); i != Signatures.end(); ++i) { DKIMVerifyDetails d; d.szSignature = (char *)i->Header.c_str(); d.szSignatureDomain = (char *)i->Domain.c_str(); |