diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/date822fmt.h | 2 | ||||
-rw-r--r-- | src/include/dkim.h | 88 | ||||
-rw-r--r-- | src/include/dkimbase.h | 20 | ||||
-rw-r--r-- | src/include/dkimsign.h | 26 | ||||
-rw-r--r-- | src/include/dkimverify.h | 38 | ||||
-rw-r--r-- | src/include/global.h | 2 | ||||
-rw-r--r-- | src/include/ipalloc.h | 3 | ||||
-rw-r--r-- | src/include/maildir.h | 1 | ||||
-rw-r--r-- | src/include/prioq.h | 4 | ||||
-rw-r--r-- | src/include/recipients.h | 2 | ||||
-rw-r--r-- | src/include/tcpto.h | 6 | ||||
-rw-r--r-- | src/include/tls_remote.h | 2 | ||||
-rw-r--r-- | src/include/token822.h | 4 |
13 files changed, 103 insertions, 95 deletions
diff --git a/src/include/date822fmt.h b/src/include/date822fmt.h index fc721a0..44a26e8 100644 --- a/src/include/date822fmt.h +++ b/src/include/date822fmt.h @@ -1,6 +1,8 @@ #ifndef DATE822FMT_H #define DATE822FMT_H +#include "datetime.h" + unsigned int date822fmt(char *, struct datetime *); #define DATE822FMT 60 diff --git a/src/include/dkim.h b/src/include/dkim.h index dd2a70d..27c3b73 100644 --- a/src/include/dkim.h +++ b/src/include/dkim.h @@ -1,19 +1,19 @@ /***************************************************************************** -* Copyright 2005 Alt-N Technologies, Ltd. +* Copyright 2005 Alt-N Technologies, Ltd. * -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at * -* http://www.apache.org/licenses/LICENSE-2.0 +* http://www.apache.org/licenses/LICENSE-2.0 * -* This code incorporates intellectual property owned by Yahoo! and licensed +* This code incorporates intellectual property owned by Yahoo! and licensed * pursuant to the Yahoo! DomainKeys Patent License Agreement. * -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and * limitations under the License. * * Changes done by ¢feh@fehcom.de obeying the above license @@ -43,8 +43,9 @@ extern "C" { #define DKIM_SIGN_RELAXED MAKELONG(DKIM_CANON_RELAXED, DKIM_CANON_RELAXED) #define DKIM_SIGN_RELAXED_SIMPLE MAKELONG(DKIM_CANON_SIMPLE, DKIM_CANON_RELAXED) +// clang-format off // DKIM Error codes -#define DKIM_SUCCESS 0 // operation successful +#define DKIM_SUCCESS 0 // operation successful #define DKIM_FAIL -1 // verify error: message is suspicious #define DKIM_BAD_SYNTAX -2 // signature error: DKIM-Signature could not parse or has bad tags/values #define DKIM_SIGNATURE_BAD -3 // signature error: RSA/ED25519 verify failed @@ -53,40 +54,37 @@ extern "C" { #define DKIM_SELECTOR_INVALID -6 // signature error: selector doesn't parse or contains invalid values #define DKIM_SELECTOR_GRANULARITY_MISMATCH -7 // signature error: selector g= doesn't match i= #define DKIM_SELECTOR_KEY_REVOKED -8 // signature error: selector p= empty -#define DKIM_SELECTOR_DOMAIN_NAME_TOO_LONG \ - -9 // signature error: selector domain name too long to request -#define DKIM_SELECTOR_DNS_TEMP_FAILURE -10 // signature error: temporary dns failure requesting selector -#define DKIM_SELECTOR_DNS_PERM_FAILURE -11 // signature error: permanent dns failure requesting selector -#define DKIM_SELECTOR_PUBLIC_KEY_INVALID \ - -12 // signature error: selector p= value invalid or wrong format -#define DKIM_NO_SIGNATURES -13 // process error, no sigs -#define DKIM_NO_VALID_SIGNATURES -14 // process error, no valid sigs -#define DKIM_BODY_HASH_MISMATCH -15 // sigature verify error: message body does not hash to bh value -#define DKIM_SELECTOR_ALGORITHM_MISMATCH -16 // signature error: selector h= doesn't match signature a= -#define DKIM_STAT_INCOMPAT -17 // signature error: incompatible v= -#define DKIM_UNSIGNED_FROM -18 // signature error: not all message's From headers in signature -#define DKIM_OUT_OF_MEMORY -20 // memory allocation failed -#define DKIM_INVALID_CONTEXT -21 // DKIMContext structure invalid for this operation -#define DKIM_NO_SENDER -22 // signing error: Could not find From: or Sender: header in message -#define DKIM_BAD_PRIVATE_KEY -23 // signing error: Could not parse private key -#define DKIM_BUFFER_TOO_SMALL -24 // signing error: Buffer passed in is not large enough -#define DKIM_MAX_ERROR -25 // set this to 1 greater than the highest error code (but negative) - -// DKIM_SUCCESS // verify result: all signatures verified +#define DKIM_SELECTOR_DOMAIN_NAME_TOO_LONG -9 // signature error: selector domain name too long to request +#define DKIM_SELECTOR_DNS_TEMP_FAILURE -10 // signature error: temporary dns failure requesting selector +#define DKIM_SELECTOR_DNS_PERM_FAILURE -11 // signature error: permanent dns failure requesting selector +#define DKIM_SELECTOR_PUBLIC_KEY_INVALID -12 // signature error: selector p= value invalid or wrong format +#define DKIM_NO_SIGNATURES -13 // process error, no sigs +#define DKIM_NO_VALID_SIGNATURES -14 // process error, no valid sigs +#define DKIM_BODY_HASH_MISMATCH -15 // sigature verify error: message body does not hash to bh value +#define DKIM_SELECTOR_ALGORITHM_MISMATCH -16 // signature error: selector h= doesn't match signature a= +#define DKIM_STAT_INCOMPAT -17 // signature error: incompatible v= +#define DKIM_UNSIGNED_FROM -18 // signature error: not all message's From headers in signature +#define DKIM_OUT_OF_MEMORY -20 // memory allocation failed +#define DKIM_INVALID_CONTEXT -21 // DKIMContext structure invalid for this operation +#define DKIM_NO_SENDER -22 // signing error: Could not find From: or Sender: header in message +#define DKIM_BAD_PRIVATE_KEY -23 // signing error: Could not parse private key +#define DKIM_BUFFER_TOO_SMALL -24 // signing error: Buffer passed in is not large enough +#define DKIM_MAX_ERROR -25 // set this to 1 greater than the highest error code (but negative) + +// DKIM_SUCCESS // verify result: all signatures verified // signature result: signature verified -#define DKIM_FINISHED_BODY 1 // process result: no more message body is needed -#define DKIM_PARTIAL_SUCCESS 2 // verify result: at least one but not all signatures verified -#define DKIM_NEUTRAL 3 // verify result: no signatures verified but message is not suspicous -#define DKIM_SUCCESS_BUT_EXTRA \ - 4 // signature result: signature verified but it did not include all of the body - +#define DKIM_FINISHED_BODY 1 // process result: no more message body is needed +#define DKIM_PARTIAL_SUCCESS 2 // verify result: at least one but not all signatures verified +#define DKIM_NEUTRAL 3 // verify result: no signatures verified but message is not suspicous +#define DKIM_SUCCESS_BUT_EXTRA 4 // signature result: signature verified but it did not include all of the body +// clang-format on // This function is called once for each header in the message // return 1 to include this header in the signature and 0 to exclude. -typedef int(DKIM_CALL *DKIMHEADERCALLBACK)(const char *szHeader); +typedef int (*DKIMHEADERCALLBACK)(const char *szHeader); // This function is called to retrieve a TXT record from DNS -typedef int(DKIM_CALL *DKIMDNSCALLBACK)(const char *szFQDN, char *szBuffer, int nBufLen); +typedef int (*DKIMDNSCALLBACK)(const char *szFQDN, char *szBuffer, int nBufLen); typedef struct DKIMContext_t { unsigned int reserved1; @@ -111,15 +109,17 @@ typedef struct DKIMSignOptions_t { int nIncludeCopiedHeaders; // 0 = don't include z= tag, 1 = include z= tag } DKIMSignOptions; +// clang-format off typedef struct DKIMVerifyOptions_t { DKIMDNSCALLBACK pfnSelectorCallback; // selector record callback DKIMDNSCALLBACK pfnPracticesCallback; // ADSP record callback - int nHonorBodyLengthTag; // 0 = ignore l= tag, 1 = use l= tag to limit the amount of body verified - int nCheckPractices; // 0 = use default (unknown) practices, 1 = request and use author domain signing practices - int nSubjectRequired; // 0 = subject is required to be signed, 1 = not required - int nSaveCanonicalizedData; // 0 = canonicalized data is not saved, 1 = canonicalized data is saved - int nAllowUnsignedFromHeaders; // 0 = From headers not included in the signature are not allowed, 1 = allowed + int nHonorBodyLengthTag; // 0 = ignore l= tag, 1 = use l= tag to limit the amount of body verified + int nCheckPractices; // 0 = use default (unknown) practices, 1 = request and use author domain signing practices + int nSubjectRequired; // 0 = subject is required to be signed, 1 = not required + int nSaveCanonicalizedData; // 0 = canonicalized data is not saved, 1 = canonicalized data is saved + int nAllowUnsignedFromHeaders; // 0 = From headers not included in the signature are not allowed, 1 = allowed } DKIMVerifyOptions; +// clang-format on typedef struct DKIMVerifyDetails_t { char *szSignature; diff --git a/src/include/dkimbase.h b/src/include/dkimbase.h index bfecb5d..ddded67 100644 --- a/src/include/dkimbase.h +++ b/src/include/dkimbase.h @@ -1,19 +1,19 @@ /***************************************************************************** -* Copyright 2005 Alt-N Technologies, Ltd. +* Copyright 2005 Alt-N Technologies, Ltd. * -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at * -* http://www.apache.org/licenses/LICENSE-2.0 +* http://www.apache.org/licenses/LICENSE-2.0 * -* This code incorporates intellectual property owned by Yahoo! and licensed +* This code incorporates intellectual property owned by Yahoo! and licensed * pursuant to the Yahoo! DomainKeys Patent License Agreement. * -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and * limitations under the License. * * Changes done by ¢feh@fehcom.de obeying the above license diff --git a/src/include/dkimsign.h b/src/include/dkimsign.h index af1dd70..75d33de 100644 --- a/src/include/dkimsign.h +++ b/src/include/dkimsign.h @@ -62,22 +62,22 @@ protected: #if ( \ (OPENSSL_VERSION_NUMBER < 0x10100000L) \ || (LIBRESSL_VERSION_NUMBER > 0 && LIBRESSL_VERSION_NUMBER < 0x20700000L)) - EVP_MD_CTX m_Hdr_sha1ctx; /* the RSA SHA1 signature */ - EVP_MD_CTX m_Hdr_sha256ctx; /* the RSA SHA256 signature */ + EVP_MD_CTX m_Hdr_sha1ctx; // the RSA SHA1 signature + EVP_MD_CTX m_Hdr_sha256ctx; // the RSA SHA256 signature - EVP_MD_CTX m_Bdy_sha1ctx; /* the SHA1 digest */ - EVP_MD_CTX m_Bdy_sha256ctx; /* the SHA256 digest */ + EVP_MD_CTX m_Bdy_sha1ctx; // the SHA1 digest + EVP_MD_CTX m_Bdy_sha256ctx; // the SHA256 digest #else - EVP_MD_CTX *m_Hdr_sha1ctx; /* the RSA SHA1 signature */ - EVP_MD_CTX *m_Hdr_sha256ctx; /* the RSA SHA256 signature */ - EVP_MD_CTX *m_Hdr_ed25519ctx; /* the PureEd25519 signature */ + EVP_MD_CTX *m_Hdr_sha1ctx; // the RSA SHA1 signature + EVP_MD_CTX *m_Hdr_sha256ctx; // the RSA SHA256 signature + EVP_MD_CTX *m_Hdr_ed25519ctx; // the PureEd25519 signature - EVP_MD_CTX *m_Bdy_sha1ctx; /* the SHA1 digest */ - EVP_MD_CTX *m_Bdy_sha256ctx; /* the SHA256 digest for RSA */ - EVP_MD_CTX *m_Edy_sha256ctx; /* the SHA256 digest for Ed25519 */ + EVP_MD_CTX *m_Bdy_sha1ctx; // the SHA1 digest + EVP_MD_CTX *m_Bdy_sha256ctx; // the SHA256 digest for RSA + EVP_MD_CTX *m_Edy_sha256ctx; // the SHA256 digest for Ed25519 #endif - int m_Canon; /* canonization method */ + int m_Canon; // canonization method int m_EmptyLineCount; @@ -85,9 +85,9 @@ protected: string sFrom; string sSender; string sSelector; - string eSelector; /* Used for Ed25519 signatures */ + string eSelector; // Used for Ed25519 signatures string sDomain; - string sIdentity; /* for i= tag, if empty tag will not be included in sig */ + string sIdentity; // for i= tag, if empty tag will not be included in sig string sRequiredHeaders; bool m_IncludeBodyLengthTag; diff --git a/src/include/dkimverify.h b/src/include/dkimverify.h index 685426b..fb7d564 100644 --- a/src/include/dkimverify.h +++ b/src/include/dkimverify.h @@ -1,19 +1,19 @@ /***************************************************************************** -* Copyright 2005 Alt-N Technologies, Ltd. +* Copyright 2005 Alt-N Technologies, Ltd. * -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at * -* http://www.apache.org/licenses/LICENSE-2.0 +* http://www.apache.org/licenses/LICENSE-2.0 * -* This code incorporates intellectual property owned by Yahoo! and licensed +* This code incorporates intellectual property owned by Yahoo! and licensed * pursuant to the Yahoo! DomainKeys Patent License Agreement. * -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and * limitations under the License. * * Changes done by ¢feh@fehcom.de obeying the above license @@ -27,9 +27,9 @@ #include "dkimbase.h" /* not used anymore -#define DKIM_ADSP_UNKNOWN 1 -#define DKIM_ADSP_ALL 2 -#define DKIM_ADSP_DISCARDABLE 3 +#define DKIM_ADSP_UNKNOWN 1 +#define DKIM_ADSP_ALL 2 +#define DKIM_ADSP_DISCARDABLE 3 */ #define DKIM_POLICY_DOMAIN_NAME_TOO_LONG -50 // internal error @@ -38,8 +38,8 @@ #define DKIM_POLICY_INVALID -53 // internal error /* dito -#define DKIM_SIG_VERSION_PRE_02 0 -#define DKIM_SIG_VERSION_02_PLUS 1 +#define DKIM_SIG_VERSION_PRE_02 0 +#define DKIM_SIG_VERSION_02_PLUS 1 */ class SelectorInfo { @@ -111,13 +111,13 @@ class CDKIMVerify : public CDKIMBase { public: CDKIMVerify(); ~CDKIMVerify(); - // virtual ~CDKIMVerify() = 0; + // virtual ~CDKIMVerify() = 0; int Init(DKIMVerifyOptions *pOptions); int GetResults(void); int GetDetails(int *nSigCount, DKIMVerifyDetails **pDetails); - // int _DNSGetTXT(const char* szFQDN,char* Buffer,int nBufLen); + // int _DNSGetTXT(const char* szFQDN,char* Buffer,int nBufLen); virtual int ProcessHeaders(void); virtual int ProcessBody(char *szBuffer, int nBufLength, bool bEOF); @@ -132,13 +132,13 @@ protected: SelectorInfo& GetSelector(const string& sSelector, const string& sDomain); - // int GetADSP(const string &sDomain,int &iADSP); + // int GetADSP(const std::string& sDomain, int& iADSP); list<SignatureInfo> Signatures; list<SelectorInfo> Selectors; DKIMDNSCALLBACK m_pfnSelectorCallback; // selector record callback - // DKIMDNSCALLBACK m_pfnPracticesCallback; // ADSP record callback + // DKIMDNSCALLBACK m_pfnPracticesCallback; // ADSP record callback bool m_HonorBodyLengthTag; bool m_CheckPractices; diff --git a/src/include/global.h b/src/include/global.h index 7e9b673..a35999c 100644 --- a/src/include/global.h +++ b/src/include/global.h @@ -5,7 +5,7 @@ #include "uint_t.h" /* Copyright (C) RSA Laboratories, a division of RSA Data Security, - Inc., created 1991. All rights reserved. + * Inc., created 1991. All rights reserved. */ #ifndef _GLOBAL_H_ diff --git a/src/include/ipalloc.h b/src/include/ipalloc.h index 6626ecc..cec29a9 100644 --- a/src/include/ipalloc.h +++ b/src/include/ipalloc.h @@ -15,7 +15,8 @@ struct ip_mx { char mxh[NAME_LEN]; }; -GEN_ALLOC_typedef(ipalloc, struct ip_mx, ix, len, a) int ipalloc_readyplus(); +GEN_ALLOC_typedef(ipalloc, struct ip_mx, ix, len, a); +int ipalloc_readyplus(); int ipalloc_append(); #endif diff --git a/src/include/maildir.h b/src/include/maildir.h index 69e679b..9659989 100644 --- a/src/include/maildir.h +++ b/src/include/maildir.h @@ -2,6 +2,7 @@ #define MAILDIR_H #include "logmsg.h" +#include "stralloc.h" #include "prioq.h" diff --git a/src/include/prioq.h b/src/include/prioq.h index cbddd9b..31c99ac 100644 --- a/src/include/prioq.h +++ b/src/include/prioq.h @@ -10,9 +10,9 @@ struct prioq_elt { unsigned long id; }; -GEN_ALLOC_typedef(prioq, struct prioq_elt, p, len, a) +GEN_ALLOC_typedef(prioq, struct prioq_elt, p, len, a); - int prioq_insert(); +int prioq_insert(); int prioq_min(); void prioq_delmin(); diff --git a/src/include/recipients.h b/src/include/recipients.h index e666bd1..34542d5 100644 --- a/src/include/recipients.h +++ b/src/include/recipients.h @@ -1,6 +1,8 @@ #ifndef RECIPIENTS_H #define RECIPIENTS_H +#include <sys/types.h> + int recipients_init(void); int recipients(char *, int); ssize_t safewrite(); diff --git a/src/include/tcpto.h b/src/include/tcpto.h index ca4f97a..678d12a 100644 --- a/src/include/tcpto.h +++ b/src/include/tcpto.h @@ -4,17 +4,17 @@ #define TCPTO_BUFSIZ 1024 /* persistency structure: record -struct tcpto { +struct tcpto { unsigned char af; -- 1 byte -- IPv4: x'2' / IPv6: x'a' (10) unsigned char nul[3]; -- 3 byte unsigned char errorcount -- 1 byte -- if err_timeout || err_conrefused || err_proto (TLS) unsigned char nul[3]; -- 3 byte - unsigned long when; -- 8 byte + unsigned long when; -- 8 byte union { struct ip_address ip; struct ip6_address ip6; unsigned char nul[16]; -- 16 byte -- IPv4: filled up with '.' = x'2e' - } addr; + } addr; }; total: 32 byte */ diff --git a/src/include/tls_remote.h b/src/include/tls_remote.h index 7df0776..fe55d22 100644 --- a/src/include/tls_remote.h +++ b/src/include/tls_remote.h @@ -3,6 +3,8 @@ #include <openssl/ssl.h> +#include "stralloc.h" + /* the version is like this: 0xMNNFFPPS: major minor fix patch status */ #if OPENSSL_VERSION_NUMBER < 0x00908000L #error "Need OpenSSL version at least 0.9.8" diff --git a/src/include/token822.h b/src/include/token822.h index e1cef4a..73ef0be 100644 --- a/src/include/token822.h +++ b/src/include/token822.h @@ -9,9 +9,9 @@ struct token822 { int slen; }; -GEN_ALLOC_typedef(token822_alloc, struct token822, t, len, a) +GEN_ALLOC_typedef(token822_alloc, struct token822, t, len, a); - int token822_parse(); +int token822_parse(); int token822_addrlist(); int token822_unquote(); int token822_unparse(); |