From 89b7b67a13ebb7965cc7f13ad0595e2194a2d34c Mon Sep 17 00:00:00 2001 From: Jannis Hoffmann Date: Wed, 3 Jul 2024 15:48:04 +0200 Subject: add sqmail-4.2.29a --- src/include/auto_break.h | 6 ++ src/include/auto_patrn.h | 6 ++ src/include/auto_qmail.h | 6 ++ src/include/auto_spawn.h | 6 ++ src/include/auto_split.h | 6 ++ src/include/auto_uids.h | 16 +++++ src/include/auto_usera.h | 6 ++ src/include/base64.h | 9 +++ src/include/commands.h | 12 ++++ src/include/constmap.h | 21 ++++++ src/include/control.h | 12 ++++ src/include/date822fmt.h | 7 ++ src/include/datetime.h | 20 ++++++ src/include/dkim.h | 154 ++++++++++++++++++++++++++++++++++++++++++++ src/include/dkimbase.h | 79 +++++++++++++++++++++++ src/include/dkimsign.h | 113 ++++++++++++++++++++++++++++++++ src/include/dkimverify.h | 152 +++++++++++++++++++++++++++++++++++++++++++ src/include/dns.h | 27 ++++++++ src/include/dnsdoe.h | 6 ++ src/include/dnsgettxt.h | 7 ++ src/include/exit.h | 16 +++++ src/include/extra.h | 7 ++ src/include/fifo.h | 6 ++ src/include/fmtqfn.h | 8 +++ src/include/gfrom.h | 6 ++ src/include/global.h | 53 +++++++++++++++ src/include/headerbody.h | 6 ++ src/include/hfield.h | 38 +++++++++++ src/include/hier.h | 10 +++ src/include/hmac_md5.h | 7 ++ src/include/ipalloc.h | 22 +++++++ src/include/ipme.h | 14 ++++ src/include/maildir.h | 13 ++++ src/include/md5.h | 49 ++++++++++++++ src/include/mfrules.h | 9 +++ src/include/myctime.h | 8 +++ src/include/newfield.h | 12 ++++ src/include/now.h | 8 +++ src/include/prioq.h | 15 +++++ src/include/prot.h | 7 ++ src/include/qlx.h | 18 ++++++ src/include/qmail.h | 24 +++++++ src/include/qsutil.h | 17 +++++ src/include/quote.h | 10 +++ src/include/rcpthosts.h | 7 ++ src/include/readsubdir.h | 20 ++++++ src/include/readwrite.h | 11 ++++ src/include/received.h | 9 +++ src/include/recipients.h | 8 +++ src/include/sendtodo.h | 14 ++++ src/include/sha1.h | 31 +++++++++ src/include/sha256.h | 18 ++++++ src/include/smtpdlog.h | 73 +++++++++++++++++++++ src/include/spf.h | 111 +++++++++++++++++++++++++++++++ src/include/srs2.h | 126 ++++++++++++++++++++++++++++++++++++ src/include/strset.h | 29 +++++++++ src/include/tcpto.h | 25 +++++++ src/include/tls_errors.h | 42 ++++++++++++ src/include/tls_remote.h | 32 +++++++++ src/include/tls_start.h | 7 ++ src/include/tls_timeoutio.h | 15 +++++ src/include/token822.h | 36 +++++++++++ src/include/trigger.h | 9 +++ src/include/triggerpull.h | 6 ++ src/include/ucspitls.h | 45 +++++++++++++ src/include/wildmat.h | 6 ++ 66 files changed, 1734 insertions(+) create mode 100644 src/include/auto_break.h create mode 100644 src/include/auto_patrn.h create mode 100644 src/include/auto_qmail.h create mode 100644 src/include/auto_spawn.h create mode 100644 src/include/auto_split.h create mode 100644 src/include/auto_uids.h create mode 100644 src/include/auto_usera.h create mode 100644 src/include/base64.h create mode 100644 src/include/commands.h create mode 100644 src/include/constmap.h create mode 100644 src/include/control.h create mode 100644 src/include/date822fmt.h create mode 100644 src/include/datetime.h create mode 100644 src/include/dkim.h create mode 100644 src/include/dkimbase.h create mode 100644 src/include/dkimsign.h create mode 100644 src/include/dkimverify.h create mode 100644 src/include/dns.h create mode 100644 src/include/dnsdoe.h create mode 100644 src/include/dnsgettxt.h create mode 100644 src/include/exit.h create mode 100644 src/include/extra.h create mode 100644 src/include/fifo.h create mode 100644 src/include/fmtqfn.h create mode 100644 src/include/gfrom.h create mode 100644 src/include/global.h create mode 100644 src/include/headerbody.h create mode 100644 src/include/hfield.h create mode 100644 src/include/hier.h create mode 100644 src/include/hmac_md5.h create mode 100644 src/include/ipalloc.h create mode 100644 src/include/ipme.h create mode 100644 src/include/maildir.h create mode 100644 src/include/md5.h create mode 100644 src/include/mfrules.h create mode 100644 src/include/myctime.h create mode 100644 src/include/newfield.h create mode 100644 src/include/now.h create mode 100644 src/include/prioq.h create mode 100644 src/include/prot.h create mode 100644 src/include/qlx.h create mode 100644 src/include/qmail.h create mode 100644 src/include/qsutil.h create mode 100644 src/include/quote.h create mode 100644 src/include/rcpthosts.h create mode 100644 src/include/readsubdir.h create mode 100644 src/include/readwrite.h create mode 100644 src/include/received.h create mode 100644 src/include/recipients.h create mode 100644 src/include/sendtodo.h create mode 100644 src/include/sha1.h create mode 100644 src/include/sha256.h create mode 100644 src/include/smtpdlog.h create mode 100644 src/include/spf.h create mode 100644 src/include/srs2.h create mode 100644 src/include/strset.h create mode 100644 src/include/tcpto.h create mode 100644 src/include/tls_errors.h create mode 100644 src/include/tls_remote.h create mode 100644 src/include/tls_start.h create mode 100644 src/include/tls_timeoutio.h create mode 100644 src/include/token822.h create mode 100644 src/include/trigger.h create mode 100644 src/include/triggerpull.h create mode 100644 src/include/ucspitls.h create mode 100644 src/include/wildmat.h (limited to 'src/include') diff --git a/src/include/auto_break.h b/src/include/auto_break.h new file mode 100644 index 0000000..b7f3a63 --- /dev/null +++ b/src/include/auto_break.h @@ -0,0 +1,6 @@ +#ifndef AUTO_BREAK_H +#define AUTO_BREAK_H + +extern char auto_break[]; + +#endif diff --git a/src/include/auto_patrn.h b/src/include/auto_patrn.h new file mode 100644 index 0000000..77cdf1f --- /dev/null +++ b/src/include/auto_patrn.h @@ -0,0 +1,6 @@ +#ifndef AUTO_PATRN_H +#define AUTO_PATRN_H + +extern int auto_patrn; + +#endif diff --git a/src/include/auto_qmail.h b/src/include/auto_qmail.h new file mode 100644 index 0000000..0c56001 --- /dev/null +++ b/src/include/auto_qmail.h @@ -0,0 +1,6 @@ +#ifndef AUTO_QMAIL_H +#define AUTO_QMAIL_H + +extern char auto_qmail[]; + +#endif diff --git a/src/include/auto_spawn.h b/src/include/auto_spawn.h new file mode 100644 index 0000000..165d988 --- /dev/null +++ b/src/include/auto_spawn.h @@ -0,0 +1,6 @@ +#ifndef AUTO_SPAWN_H +#define AUTO_SPAWN_H + +extern int auto_spawn; + +#endif diff --git a/src/include/auto_split.h b/src/include/auto_split.h new file mode 100644 index 0000000..3754129 --- /dev/null +++ b/src/include/auto_split.h @@ -0,0 +1,6 @@ +#ifndef AUTO_SPLIT_H +#define AUTO_SPLIT_H + +extern int auto_split; + +#endif diff --git a/src/include/auto_uids.h b/src/include/auto_uids.h new file mode 100644 index 0000000..1252ecb --- /dev/null +++ b/src/include/auto_uids.h @@ -0,0 +1,16 @@ +#ifndef AUTO_UIDS_H +#define AUTO_UIDS_H + +extern int auto_uida; +extern int auto_uidd; +extern int auto_uidl; +extern int auto_uido; +extern int auto_uidp; +extern int auto_uidq; +extern int auto_uidr; +extern int auto_uids; + +extern int auto_gidn; +extern int auto_gidq; + +#endif diff --git a/src/include/auto_usera.h b/src/include/auto_usera.h new file mode 100644 index 0000000..49d7755 --- /dev/null +++ b/src/include/auto_usera.h @@ -0,0 +1,6 @@ +#ifndef AUTO_USERA_H +#define AUTO_USERA_H + +extern char auto_usera[]; + +#endif diff --git a/src/include/base64.h b/src/include/base64.h new file mode 100644 index 0000000..9384411 --- /dev/null +++ b/src/include/base64.h @@ -0,0 +1,9 @@ +#ifndef BASE64_H +#define BASE64_H + +#include "stralloc.h" + +extern int b64decode(const unsigned char *,int,stralloc *); +extern int b64encode(stralloc *,stralloc *); + +#endif diff --git a/src/include/commands.h b/src/include/commands.h new file mode 100644 index 0000000..3fd2cb8 --- /dev/null +++ b/src/include/commands.h @@ -0,0 +1,12 @@ +#ifndef COMMANDS_H +#define COMMANDS_H + +struct commands { + char *text; + void (*fun)(); + void (*flush)(); +} ; + +int commands(); + +#endif diff --git a/src/include/constmap.h b/src/include/constmap.h new file mode 100644 index 0000000..750702e --- /dev/null +++ b/src/include/constmap.h @@ -0,0 +1,21 @@ +#ifndef CONSTMAP_H +#define CONSTMAP_H + +typedef unsigned long constmap_hash; + +struct constmap { + int num; + constmap_hash mask; + constmap_hash *hash; + int *first; + int *next; + char **input; + int *inputlen; +} ; + +int constmap_init(struct constmap *,char *,int,int); +int constmap_init_char(struct constmap *,char *,int,int,char); +void constmap_free(); +char *constmap(); + +#endif diff --git a/src/include/control.h b/src/include/control.h new file mode 100644 index 0000000..732042c --- /dev/null +++ b/src/include/control.h @@ -0,0 +1,12 @@ +#ifndef CONTROL_H +#define CONTROL_H + +#include "stralloc.h" + +int control_init(void); +int control_readline(stralloc *,char *); +int control_rldef(stralloc *,char *,int,char *); +int control_readint(int *,char *); +int control_readfile(stralloc *,char *,int); + +#endif diff --git a/src/include/date822fmt.h b/src/include/date822fmt.h new file mode 100644 index 0000000..a2f1432 --- /dev/null +++ b/src/include/date822fmt.h @@ -0,0 +1,7 @@ +#ifndef DATE822FMT_H +#define DATE822FMT_H + +unsigned int date822fmt(char *,struct datetime *); +#define DATE822FMT 60 + +#endif diff --git a/src/include/datetime.h b/src/include/datetime.h new file mode 100644 index 0000000..68d1618 --- /dev/null +++ b/src/include/datetime.h @@ -0,0 +1,20 @@ +#ifndef DATETIME_H +#define DATETIME_H + +struct datetime { + int hour; + int min; + int sec; + int wday; + int mday; + int yday; + int mon; + int year; +} ; + +typedef long datetime_sec; + +void datetime_tai(); +datetime_sec datetime_untai(); + +#endif diff --git a/src/include/dkim.h b/src/include/dkim.h new file mode 100644 index 0000000..508b2df --- /dev/null +++ b/src/include/dkim.h @@ -0,0 +1,154 @@ +/***************************************************************************** +* 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 +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* 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 +* limitations under the License. +* +* Changes done by ¢feh@fehcom.de obeying the above license +* +*****************************************************************************/ +#define DKIM_CALL +#define MAKELONG(a,b) ((long)(((unsigned)(a) & 0xffff) | (((unsigned)(b) & 0xffff) << 16))) + +#ifdef __cplusplus +extern "C" { +#endif + +// DKIM hash algorithms +#define DKIM_HASH_SHA1 1 +#define DKIM_HASH_SHA256 2 +#define DKIM_HASH_SHA1_AND_SHA256 3 +#define DKIM_HASH_ED25519 4 +#define DKIM_HASH_RSA256_AND_ED25519 5 + +// DKIM canonicalization methods +#define DKIM_CANON_SIMPLE 1 +#define DKIM_CANON_NOWSP 2 +#define DKIM_CANON_RELAXED 3 + +#define DKIM_SIGN_SIMPLE MAKELONG(DKIM_CANON_SIMPLE,DKIM_CANON_SIMPLE) +#define DKIM_SIGN_SIMPLE_RELAXED MAKELONG(DKIM_CANON_RELAXED,DKIM_CANON_SIMPLE) +#define DKIM_SIGN_RELAXED MAKELONG(DKIM_CANON_RELAXED,DKIM_CANON_RELAXED) +#define DKIM_SIGN_RELAXED_SIMPLE MAKELONG(DKIM_CANON_SIMPLE,DKIM_CANON_RELAXED) + +// DKIM Error codes +#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 +#define DKIM_SIGNATURE_BAD_BUT_TESTING -4 // signature error: RSA/ED25519 verify failed but testing +#define DKIM_SIGNATURE_EXPIRED -5 // signature error: x= is old +#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 + // 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 + + + +// 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); + +// This function is called to retrieve a TXT record from DNS +typedef int (DKIM_CALL *DKIMDNSCALLBACK)(const char* szFQDN,char* szBuffer,int nBufLen); + +typedef struct DKIMContext_t +{ + unsigned int reserved1; + unsigned int reserved2; + void* reserved3; +} DKIMContext; + +typedef struct DKIMSignOptions_t +{ + int nCanon; // canonization + int nIncludeBodyLengthTag; // 0 = don't include l= tag, 1 = include l= tag + int nIncludeTimeStamp; // 0 = don't include t= tag, 1 = include t= tag + int nIncludeQueryMethod; // 0 = don't include q= tag, 1 = include q= tag + char szSelector[64]; // selector - required + char szSelectorE[64]; // 2nd selector - optional + char szDomain[256]; // domain - optional - if empty, domain is computed from sender + char szIdentity[256]; // for i= tag, if empty tag will not be included in sig + unsigned long expireTime; // for x= tag, if 0 tag will not be included in sig + DKIMHEADERCALLBACK pfnHeaderCallback; // header callback + char szRequiredHeaders[256]; // colon-separated list of headers that must be signed + int nHash; // use one of the DKIM_HASH_xx constants here + // even if not present in the message + int nIncludeCopiedHeaders; // 0 = don't include z= tag, 1 = include z= tag +} DKIMSignOptions; + +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 +} DKIMVerifyOptions; + +typedef struct DKIMVerifyDetails_t +{ + char *szSignature; + char *szSignatureDomain; + char *szIdentityDomain; + char *szCanonicalizedData; + int nResult; +} DKIMVerifyDetails; + +int DKIM_CALL DKIMSignInit(DKIMContext* pSignContext,DKIMSignOptions* pOptions); +int DKIM_CALL DKIMSignProcess(DKIMContext* pSignContext,char* szBuffer,int nBufLength); +int DKIM_CALL DKIMSignGetSig2(DKIMContext* pSignContext,char* szRSAPrivKey,char *szECCPrivKey,char** pszSignature); +void DKIM_CALL DKIMSignFree(DKIMContext* pSignContext); + +int DKIM_CALL DKIMVerifyInit(DKIMContext* pVerifyContext,DKIMVerifyOptions* pOptions); +int DKIM_CALL DKIMVerifyProcess(DKIMContext* pVerifyContext,const char* szBuffer,int nBufLength); +int DKIM_CALL DKIMVerifyResults(DKIMContext* pVerifyContext); +int DKIM_CALL DKIMVerifyGetDetails(DKIMContext* pVerifyContext,int* nSigCount,DKIMVerifyDetails** pDetails,char* szPractices); +void DKIM_CALL DKIMVerifyFree(DKIMContext* pVerifyContext); + +// const char *DKIM_CALL DKIMVersion(); + +const char *DKIM_CALL DKIMGetErrorString(int ErrorCode); + +int _DKIM_ReportResult(char const *,char const *,char const *); +const char *DKIM_ErrorResult(const int); + +#ifdef __cplusplus +} +#endif diff --git a/src/include/dkimbase.h b/src/include/dkimbase.h new file mode 100644 index 0000000..25aac02 --- /dev/null +++ b/src/include/dkimbase.h @@ -0,0 +1,79 @@ +/***************************************************************************** +* 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 +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* 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 +* limitations under the License. +* +* Changes done by ¢feh@fehcom.de obeying the above license +* +*****************************************************************************/ +#ifndef DKIMBASE_H +#define DKIMBASE_H + +#include +#include +#include + +#define BUFFER_ALLOC_INCREMENT 256 + +#include +#include + +using namespace std; + +class CDKIMBase +{ +public: + + CDKIMBase(); + ~CDKIMBase(); + + int Init(void); + + int Process(const char* szBuffer,int nBufLength,bool bEOF); + int ProcessFinal(void); + + int Alloc(char*& szBuffer,int nRequiredSize); + int ReAlloc(char*& szBuffer,int& nBufferLength,int nRequiredSize); + void Free(char* szBuffer); + + static void RemoveSWSP(char* szBuffer); + static void RemoveSWSP(char* pBuffer,int& nBufLength); + static void RemoveSWSP(string& sBuffer); + + static void CompressSWSP(char* pBuffer,int& nBufLength); + static void CompressSWSP(string& sBuffer); + + static string RelaxHeader(const string& sHeader); + + virtual int ProcessHeaders(void); + virtual int ProcessBody(char* szBuffer,int nBufLength,bool bEOF); + +protected: + char* m_From; + char* m_Sender; + char* m_hTag; + int m_hTagSize; + int m_hTagPos; + char* m_Line; + int m_LineSize; + int m_LinePos; + bool m_InHeaders; + + list HeaderList; +}; + + +#endif // DKIMBASE_H diff --git a/src/include/dkimsign.h b/src/include/dkimsign.h new file mode 100644 index 0000000..150a0b8 --- /dev/null +++ b/src/include/dkimsign.h @@ -0,0 +1,113 @@ +/***************************************************************************** +* 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 +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* 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 +* limitations under the License. +* +* Changes done by ¢feh@fehcom.de obeying the above license +* +*****************************************************************************/ +#ifndef DKIMSIGN_H +#define DKIMSIGN_H + +#include "dkimbase.h" + +class CDKIMSign : public CDKIMBase +{ +public: + CDKIMSign(); + ~CDKIMSign(); + + //int Init() = delete; + int Init(DKIMSignOptions* pOptions); + int GetSig2(char* szRSAPrivKey,char* szECCPrivKey,char** pszSignature); + + virtual int ProcessHeaders(void) override; + virtual int ProcessBody(char* szBuffer,int nBufLength,bool bEOF) override; + + enum CKDKIMConstants { OptimalHeaderLineLength = 65 }; + + void Hash(const char* szBuffer,int nBufLength,bool bHdr); + +protected: + + bool SignThisTag(const string& sTag); + void GetHeaderParams(const string& sHdr); + void ProcessHeader(const string& sHdr); + bool ParseFromAddress(void); + + void InitSig(void); + void AddTagToSig(const char* const Tag,const string &sValue,char cbrk,bool bFold); + void AddTagToSig(const char* const Tag,unsigned long nValue); + void AddInterTagSpace(int nSizeOfNextTag); + void AddFoldedValueToSig(const string &sValue,char cbrk); + + bool IsRequiredHeader(const string& sTag); + int ConstructSignature(char* szSignKey,int nSigAlg); + + int AssembleReturnedSig(char* szRSAPrivKey,char* szECCPrivKey); + +#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_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_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_EmptyLineCount; + + string hParam; + string sFrom; + string sSender; + string sSelector; + string eSelector; /* Used for Ed25519 signatures */ + string sDomain; + string sIdentity; /* for i= tag, if empty tag will not be included in sig */ + string sRequiredHeaders; + + bool m_IncludeBodyLengthTag; + int m_nBodyLength; + time_t m_ExpireTime; + int m_nIncludeTimeStamp; // 0 = don't include t= tag, 1 = include t= tag + int m_nIncludeQueryMethod; // 0 = don't include q= tag, 1 = include q= tag + int m_nHash; // use one of the DKIM_HASH_xx constants here + int m_nIncludeCopiedHeaders; // 0 = don't include z= tag, 1 = include z= tag + + DKIMHEADERCALLBACK m_pfnHdrCallback; + + string m_sSig; // DKIM-Signature .... + int m_nSigPos; + + string m_sReturnedSig; + bool m_bReturnedSigAssembled; + + string m_sCopiedHeaders; + + string SigHdrs; + int m_SigHdrs; +}; + +#endif // DKIMSIGN_H diff --git a/src/include/dkimverify.h b/src/include/dkimverify.h new file mode 100644 index 0000000..64de2a1 --- /dev/null +++ b/src/include/dkimverify.h @@ -0,0 +1,152 @@ +/***************************************************************************** +* 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 +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* 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 +* limitations under the License. +* +* Changes done by ¢feh@fehcom.de obeying the above license +* +*****************************************************************************/ +#ifndef DKIMVERIFY_H +#define DKIMVERIFY_H + +#include "dkimbase.h" +#include + +/* not used anymore +#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 +#define DKIM_POLICY_DNS_TEMP_FAILURE -51 // internal error +#define DKIM_POLICY_DNS_PERM_FAILURE -52 // internal error +#define DKIM_POLICY_INVALID -53 // internal error + +/* dito +#define DKIM_SIG_VERSION_PRE_02 0 +#define DKIM_SIG_VERSION_02_PLUS 1 +*/ + +class SelectorInfo +{ +public: + SelectorInfo(const string &sSelector,const string &sDomain); + ~SelectorInfo(); + + string Domain; + string Selector; + string Granularity; + bool AllowSHA1; + bool AllowSHA256; + EVP_PKEY *PublicKey; /* the public key */ + bool Testing; + bool SameDomain; + + int Status; + + int Parse(char* Buffer); +}; + +class SignatureInfo +{ +public: + SignatureInfo(bool SaveCanonicalizedData); + ~SignatureInfo(); + + void Hash(const char* szBuffer,unsigned nBufLength,bool IsBody=false); + + string Header; + unsigned Version; + string Domain; + string Selector; + string SignatureData; + string BodyHashData; + string IdentityLocalPart; + string IdentityDomain; + string CanonicalizedData; + vector SignedHeaders; + unsigned BodyLength; + unsigned HeaderCanonicalization; + unsigned BodyCanonicalization; + unsigned ExpireTime; + + unsigned VerifiedBodyCount; + unsigned UnverifiedBodyCount; + +#if ((OPENSSL_VERSION_NUMBER < 0x10100000L) || (LIBRESSL_VERSION_NUMBER > 0 && LIBRESSL_VERSION_NUMBER < 0x20700000L)) + EVP_MD_CTX m_Hdr_ctx; + EVP_MD_CTX m_Bdy_ctx; +#else + EVP_MD_CTX *m_Hdr_ctx; + EVP_MD_CTX *m_Bdy_ctx; +#endif +#if (OPENSSL_VERSION_NUMBER > 0x10101000L) + EVP_MD_CTX *m_Msg_ctx; +#endif + + SelectorInfo *m_pSelector; + + int Status; + int m_nHash; // use one of the DKIM_HASH_xxx constants here + unsigned EmptyLineCount; + bool m_SaveCanonicalizedData; +}; + +class CDKIMVerify : public CDKIMBase +{ +public: + + CDKIMVerify(); + ~CDKIMVerify(); +// 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); + + virtual int ProcessHeaders(void); + virtual int ProcessBody(char* szBuffer,int nBufLength,bool bEOF); + + const char* GetPractices() { return Practices.c_str(); } + +protected: + + int ParseDKIMSignature(const string& sHeader,SignatureInfo &sig); + + SelectorInfo& GetSelector(const string &sSelector,const string &sDomain); + +// int GetADSP(const string &sDomain,int &iADSP); + + list Signatures; + list Selectors; + + DKIMDNSCALLBACK m_pfnSelectorCallback; // selector record callback +// DKIMDNSCALLBACK m_pfnPracticesCallback; // ADSP record callback + + bool m_HonorBodyLengthTag; + bool m_CheckPractices; + bool m_SubjectIsRequired; + bool m_SaveCanonicalizedData; + bool m_AllowUnsignedFromHeaders; + + vector Details; + string Practices; +}; + +#endif //DKIMVERIFY_H diff --git a/src/include/dns.h b/src/include/dns.h new file mode 100644 index 0000000..6293478 --- /dev/null +++ b/src/include/dns.h @@ -0,0 +1,27 @@ +#ifndef DNS_H +#define DNS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "dnsresolv.h" +#include "ipalloc.h" +#include "stralloc.h" + +#define DNS_INIT static char seed[128]; dns_random_init(seed); +#define DNS_NXD 0 +#define DNS_SOFT -5 +#define DNS_HARD -6 + +void dns_init(int); +int dns_ip(ipalloc *,stralloc *); +int dns_mxip(ipalloc *,stralloc *,unsigned long); +int dns_tlsa(stralloc *,const stralloc *); +int dns_mxhost(stralloc *,const stralloc *); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/include/dnsdoe.h b/src/include/dnsdoe.h new file mode 100644 index 0000000..eacd7fc --- /dev/null +++ b/src/include/dnsdoe.h @@ -0,0 +1,6 @@ +#ifndef DNSDOE_H +#define DNSDOE_H + +void dnsdoe(int); + +#endif diff --git a/src/include/dnsgettxt.h b/src/include/dnsgettxt.h new file mode 100644 index 0000000..6d6b8ea --- /dev/null +++ b/src/include/dnsgettxt.h @@ -0,0 +1,7 @@ +#ifdef cplusplus +extern "C" { + +int DNSGetTXT(const char* szFQDN,char* Buffer,int nBufLen); +extern void dns_random_init(const char [12]); + +#endif diff --git a/src/include/exit.h b/src/include/exit.h new file mode 100644 index 0000000..d7351ba --- /dev/null +++ b/src/include/exit.h @@ -0,0 +1,16 @@ +#ifndef EXIT_H +#define EXIT_H + +/* Return code conventions: + + 110: Unable to access dir + 111: General (memory) error + 112: Unable to access file +*/ + +void _exit(); + +int rename(const char *, const char *); + + +#endif diff --git a/src/include/extra.h b/src/include/extra.h new file mode 100644 index 0000000..c598175 --- /dev/null +++ b/src/include/extra.h @@ -0,0 +1,7 @@ +#ifndef EXTRA_H +#define EXTRA_H + +#define QUEUE_EXTRA "" +#define QUEUE_EXTRALEN 0 + +#endif diff --git a/src/include/fifo.h b/src/include/fifo.h new file mode 100644 index 0000000..f48c863 --- /dev/null +++ b/src/include/fifo.h @@ -0,0 +1,6 @@ +#ifndef FIFO_H +#define FIFO_H + +int fifo_make(char *,int); + +#endif diff --git a/src/include/fmtqfn.h b/src/include/fmtqfn.h new file mode 100644 index 0000000..e11e51e --- /dev/null +++ b/src/include/fmtqfn.h @@ -0,0 +1,8 @@ +#ifndef FMTQFN_H +#define FMTQFN_H + +unsigned int fmtqfn(char *,char *,unsigned long,int); + +#define FMTQFN 40 /* maximum space needed, if len(dirslash) <= 10 */ + +#endif diff --git a/src/include/gfrom.h b/src/include/gfrom.h new file mode 100644 index 0000000..121ff6d --- /dev/null +++ b/src/include/gfrom.h @@ -0,0 +1,6 @@ +#ifndef GFROM_H +#define GFROM_H + +int gfrom(char *,int); + +#endif diff --git a/src/include/global.h b/src/include/global.h new file mode 100644 index 0000000..2d8ccf4 --- /dev/null +++ b/src/include/global.h @@ -0,0 +1,53 @@ +/* GLOBAL.H - RSAREF types and constants */ + +#include +#include "uint_t.h" + +/* Copyright (C) RSA Laboratories, a division of RSA Data Security, + Inc., created 1991. All rights reserved. + */ + +#ifndef _GLOBAL_H_ +#define _GLOBAL_H_ 1 + +/* PROTOTYPES should be set to one if and only if the compiler supports + function argument prototyping. + The following makes PROTOTYPES default to 1 if it has not already been + defined as 0 with C compiler flags. + */ +#ifndef PROTOTYPES +#define PROTOTYPES 1 +#endif + +/* POINTER defines a generic pointer type */ +typedef unsigned char *POINTER; + +/* UINT2 defines a two byte word */ +typedef unsigned short int UINT2; + +/* UINT4 defines a four byte word */ +#ifdef UINT32_H +#define UINT4 uint32 +#else +typedef unsigned long int UINT4; +#endif + +#ifndef NULL_PTR +#define NULL_PTR ((POINTER)0) +#endif + +#ifndef UNUSED_ARG +#define UNUSED_ARG(x) x = *(&x); +#endif + +/* PROTO_LIST is defined depending on how PROTOTYPES is defined above. + If using PROTOTYPES, then PROTO_LIST returns the list, otherwise it + returns an empty list. + */ +#if PROTOTYPES +#define PROTO_LIST(list) list +#else +#define PROTO_LIST(list) () +#endif + +#endif /* end _GLOBAL_H_ */ diff --git a/src/include/headerbody.h b/src/include/headerbody.h new file mode 100644 index 0000000..a074981 --- /dev/null +++ b/src/include/headerbody.h @@ -0,0 +1,6 @@ +#ifndef HEADERBODY_H +#define HEADERBODY_H + +int headerbody(); + +#endif diff --git a/src/include/hfield.h b/src/include/hfield.h new file mode 100644 index 0000000..ab367f4 --- /dev/null +++ b/src/include/hfield.h @@ -0,0 +1,38 @@ +#ifndef HFIELD_H +#define HFIELD_H + +unsigned int hfield_skipname(); +int hfield_known(); +int hfield_valid(); + +#define H_SENDER 1 +#define H_FROM 2 +#define H_REPLYTO 3 +#define H_TO 4 +#define H_CC 5 +#define H_BCC 6 +#define H_DATE 7 +#define H_MESSAGEID 8 +#define H_SUBJECT 9 +#define H_R_SENDER 10 +#define H_R_FROM 11 +#define H_R_REPLYTO 12 +#define H_R_TO 13 +#define H_R_CC 14 +#define H_R_BCC 15 +#define H_R_DATE 16 +#define H_R_MESSAGEID 17 +#define H_RETURNRECEIPTTO 18 +#define H_ERRORSTO 19 +#define H_APPARENTLYTO 20 +#define H_RECEIVED 21 +#define H_RETURNPATH 22 +#define H_DELIVEREDTO 23 +#define H_CONTENTLENGTH 24 +#define H_CONTENTTYPE 25 +#define H_CONTENTTRANSFERENCODING 26 +#define H_NOTICEREQUESTEDUPONDELIVERYTO 27 +#define H_MAILFOLLOWUPTO 28 +#define H_NUM 29 + +#endif diff --git a/src/include/hier.h b/src/include/hier.h new file mode 100644 index 0000000..f040e79 --- /dev/null +++ b/src/include/hier.h @@ -0,0 +1,10 @@ +#ifndef HIER_H +#define HIER_H + +void c(char *,char *,char *,int,int,int); +void h(char *,int,int,int); +void d(char *,char *,int,int,int); +void p(char *,char *,int,int,int); +void z(char *,char *,int,int,int,int); + +#endif diff --git a/src/include/hmac_md5.h b/src/include/hmac_md5.h new file mode 100644 index 0000000..87a2c37 --- /dev/null +++ b/src/include/hmac_md5.h @@ -0,0 +1,7 @@ +#ifndef HMAC_MD5_H +#define HMAC_MD5_H + +void hmac_md5(unsigned char *,int,unsigned char *,int,unsigned char *); + +#endif + diff --git a/src/include/ipalloc.h b/src/include/ipalloc.h new file mode 100644 index 0000000..0f58e92 --- /dev/null +++ b/src/include/ipalloc.h @@ -0,0 +1,22 @@ +#ifndef IPALLOC_H +#define IPALLOC_H + +#include "ip.h" +#include "genalloc.h" +#define NAME_LEN 256 + +struct ip_mx { + unsigned short af; + union { + struct ip4_address ip4; + struct ip6_address ip6; + } addr; + int pref; + char mxh[NAME_LEN]; +}; + +GEN_ALLOC_typedef(ipalloc,struct ip_mx,ix,len,a) +int ipalloc_readyplus(); +int ipalloc_append(); + +#endif diff --git a/src/include/ipme.h b/src/include/ipme.h new file mode 100644 index 0000000..9705f45 --- /dev/null +++ b/src/include/ipme.h @@ -0,0 +1,14 @@ +#ifndef IPME_H +#define IPME_H + +#include "ip.h" +#include "ipalloc.h" + +extern ipalloc ipme; + +int ipme_init(); +int ipme_is4(); +int ipme_is6(); +int ipme_is(); + +#endif diff --git a/src/include/maildir.h b/src/include/maildir.h new file mode 100644 index 0000000..5e48822 --- /dev/null +++ b/src/include/maildir.h @@ -0,0 +1,13 @@ +#ifndef MAILDIR_H +#define MAILDIR_H + +#include "logmsg.h" +#include "prioq.h" + +extern struct strerr maildir_chdir_err; +extern struct strerr maildir_scan_err; + +int maildir_chdir(void); +void maildir_clean(stralloc *); +int maildir_scan(prioq *,stralloc *,int,int); +#endif diff --git a/src/include/md5.h b/src/include/md5.h new file mode 100644 index 0000000..94774ba --- /dev/null +++ b/src/include/md5.h @@ -0,0 +1,49 @@ +/* MD5.H - header file for MD5C.C + */ + +/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All + rights reserved. + + License to copy and use this software is granted provided that it + is identified as the "RSA Data Security, Inc. MD5 Message-Digest + Algorithm" in all material mentioning or referencing this software + or this function. + + License is also granted to make and use derivative works provided + that such works are identified as "derived from the RSA Data + Security, Inc. MD5 Message-Digest Algorithm" in all material + mentioning or referencing the derived work. + + RSA Data Security, Inc. makes no representations concerning either + the merchantability of this software or the suitability of this + software for any particular purpose. It is provided "as is" + without express or implied warranty of any kind. + + These notices must be retained in any copies of any part of this + documentation and/or software. + */ + +#ifndef _MD5_H_ +#define _MD5_H_ 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* MD5 context. */ +typedef struct { + UINT4 state[4]; /* state (ABCD) */ + UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */ + unsigned char buffer[64]; /* input buffer */ +} MD5_CTX; + +void MD5Init PROTO_LIST ((MD5_CTX *)); +void MD5Update PROTO_LIST + ((MD5_CTX *, unsigned char *, unsigned int)); +void MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *)); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/include/mfrules.h b/src/include/mfrules.h new file mode 100644 index 0000000..b79f338 --- /dev/null +++ b/src/include/mfrules.h @@ -0,0 +1,9 @@ +#ifndef MFRULES_H +#define MFRULES_H + +#include "stralloc.h" + +extern stralloc key; +int mfrules(int,char *,char *,char *,char *); + +#endif diff --git a/src/include/myctime.h b/src/include/myctime.h new file mode 100644 index 0000000..97a30ca --- /dev/null +++ b/src/include/myctime.h @@ -0,0 +1,8 @@ +#ifndef MYCTIME_H +#define MYCTIME_H + +#include "datetime.h" + +char *myctime(datetime_sec); + +#endif diff --git a/src/include/newfield.h b/src/include/newfield.h new file mode 100644 index 0000000..049fb5e --- /dev/null +++ b/src/include/newfield.h @@ -0,0 +1,12 @@ +#ifndef NEWFIELD_H +#define NEWFIELD_H + +#include "stralloc.h" + +extern stralloc newfield_date; +int newfield_datemake(); + +extern stralloc newfield_msgid; +int newfield_msgidmake(); + +#endif diff --git a/src/include/now.h b/src/include/now.h new file mode 100644 index 0000000..1379d76 --- /dev/null +++ b/src/include/now.h @@ -0,0 +1,8 @@ +#ifndef NOW_H +#define NOW_H + +#include "datetime.h" + +datetime_sec now(); + +#endif diff --git a/src/include/prioq.h b/src/include/prioq.h new file mode 100644 index 0000000..3547b1c --- /dev/null +++ b/src/include/prioq.h @@ -0,0 +1,15 @@ +#ifndef PRIOQ_H +#define PRIOQ_H + +#include "datetime.h" +#include "genalloc.h" + +struct prioq_elt { datetime_sec dt; unsigned long id; } ; + +GEN_ALLOC_typedef(prioq,struct prioq_elt,p,len,a) + +int prioq_insert(); +int prioq_min(); +void prioq_delmin(); + +#endif diff --git a/src/include/prot.h b/src/include/prot.h new file mode 100644 index 0000000..08203da --- /dev/null +++ b/src/include/prot.h @@ -0,0 +1,7 @@ +#ifndef PROT_H +#define PROT_H + +int prot_gid(); +int prot_uid(); + +#endif diff --git a/src/include/qlx.h b/src/include/qlx.h new file mode 100644 index 0000000..713946d --- /dev/null +++ b/src/include/qlx.h @@ -0,0 +1,18 @@ +#ifndef QLX_H +#define QLX_H + +/* 0, 111, 100 are qmail-local success, soft, hard */ + +#define QLX_USAGE 112 +#define QLX_BUG 101 +#define QLX_ROOT 113 +#define QLX_NFS 115 +#define QLX_NOALIAS 116 +#define QLX_CDB 117 +#define QLX_SYS 118 +#define QLX_NOMEM 119 +#define QLX_EXECSOFT 120 +#define QLX_EXECPW 121 +#define QLX_EXECHARD 126 + +#endif diff --git a/src/include/qmail.h b/src/include/qmail.h new file mode 100644 index 0000000..7db214d --- /dev/null +++ b/src/include/qmail.h @@ -0,0 +1,24 @@ +#ifndef QMAIL_H +#define QMAIL_H + +#include "buffer.h" + +struct qmail { + int flagerr; + unsigned long pid; + int fdm; + int fde; + buffer ss; + char buf[1024]; +} ; + +extern int qmail_open(struct qmail *); +extern void qmail_put(struct qmail *,char *, int); +extern void qmail_puts(struct qmail *,char *); +extern void qmail_from(struct qmail *,char *); +extern void qmail_to(struct qmail *,char *); +extern void qmail_fail(struct qmail *); +extern char *qmail_close(struct qmail *); +extern unsigned long qmail_qp(struct qmail *); + +#endif diff --git a/src/include/qsutil.h b/src/include/qsutil.h new file mode 100644 index 0000000..a77a3f8 --- /dev/null +++ b/src/include/qsutil.h @@ -0,0 +1,17 @@ +#ifndef QSUTIL_H +#define QSUTIL_H + +#include "stralloc.h" + +void log1s(char *); +void log2s(char *,char *); +void log3s(char *,char *,char *); +void log4s(char *,char *,char *,char *); +void log5s(char *,char *,char *,char *,char *); +void logsa(stralloc *); +void nomem(); +void pausedir(char *); +void logsafe(char *); +int issafe(char); + +#endif diff --git a/src/include/quote.h b/src/include/quote.h new file mode 100644 index 0000000..4afbc94 --- /dev/null +++ b/src/include/quote.h @@ -0,0 +1,10 @@ +#ifndef QUOTE_H +#define QUOTE_H + +#include "stralloc.h" + +int quote_need(char *,unsigned int); +int quote(stralloc *, stralloc *); +int quote2(stralloc *,char *); + +#endif diff --git a/src/include/rcpthosts.h b/src/include/rcpthosts.h new file mode 100644 index 0000000..0c58797 --- /dev/null +++ b/src/include/rcpthosts.h @@ -0,0 +1,7 @@ +#ifndef RCPTHOSTS_H +#define RCPTHOSTS_H + +int rcpthosts_init(); +int rcpthosts(); + +#endif diff --git a/src/include/readsubdir.h b/src/include/readsubdir.h new file mode 100644 index 0000000..e612fac --- /dev/null +++ b/src/include/readsubdir.h @@ -0,0 +1,20 @@ +#ifndef READSUBDIR_H +#define READSUBDIR_H + +#include "direntry.h" + +typedef struct readsubdir +{ + DIR *dir; + int pos; + char *name; + void (*pause)(); +} +readsubdir; + +void readsubdir_init(); +int readsubdir_next(); + +#define READSUBDIR_NAMELEN 10 + +#endif diff --git a/src/include/readwrite.h b/src/include/readwrite.h new file mode 100644 index 0000000..4fdb771 --- /dev/null +++ b/src/include/readwrite.h @@ -0,0 +1,11 @@ +#ifndef READWRITE_H +#define READWRITE_H + +#include +/* Already in unistd.h */ +/* +int read(); +int write(); +*/ + +#endif diff --git a/src/include/received.h b/src/include/received.h new file mode 100644 index 0000000..2b2ce75 --- /dev/null +++ b/src/include/received.h @@ -0,0 +1,9 @@ +#ifndef RECEIVED_H +#define RECEIVED_H + +#include "qmail.h" + +void received(struct qmail *,char *,char *,char *,char *,char *,char *,char *,char *); +void spfheader(struct qmail *,char *,char *,char *,char *,char *); + +#endif diff --git a/src/include/recipients.h b/src/include/recipients.h new file mode 100644 index 0000000..b73f37e --- /dev/null +++ b/src/include/recipients.h @@ -0,0 +1,8 @@ +#ifndef RECIPIENTS_H +#define RECIPIENTS_H + +int recipients_init(void); +int recipients(char *,int); +ssize_t safewrite(); + +#endif diff --git a/src/include/sendtodo.h b/src/include/sendtodo.h new file mode 100644 index 0000000..86b4434 --- /dev/null +++ b/src/include/sendtodo.h @@ -0,0 +1,14 @@ +#ifndef SENDTODO_H +#define SENDTODO_H + +/* critical timing feature #1: if not triggered, do not busy-loop */ +/* critical timing feature #2: if triggered, respond within fixed time */ +/* important timing feature: when triggered, respond instantly */ +#define SLEEP_TODO 1500 /* check todo/ every 25 minutes in any case */ +#define SLEEP_FUZZ 1 /* slop a bit on sleeps to avoid zeno effect */ +#define SLEEP_FOREVER 86400 /* absolute maximum time spent in select() */ +#define SLEEP_CLEANUP 76431 /* time between cleanups */ +#define SLEEP_SYSFAIL 123 +#define OSSIFIED 129600 /* 36 hours; _must_ exceed q-q's DEATH (24 hours) */ + +#endif diff --git a/src/include/sha1.h b/src/include/sha1.h new file mode 100644 index 0000000..43d141d --- /dev/null +++ b/src/include/sha1.h @@ -0,0 +1,31 @@ +#ifndef SHA1_H +#define SHA1_H + +/* + SHA-1 in C + By Steve Reid + 100% Public Domain + + adopted for s/qmail (feh) + */ + +#include +/* SHA1 implementation */ + +#define SHA1_BLOCKSIZE 64 +#define SHA1_DIGESTSIZE 20 + +typedef struct +{ + uint32_t state[5]; + uint32_t count[2]; + uint8_t buffer[SHA1_BLOCKSIZE]; +} sha1_ctx; + +void sha1_init(sha1_ctx *context); +void sha1_update(sha1_ctx *context, const uint8_t *data, uint32_t len); +void sha1_final(uint8_t hash[SHA1_DIGESTSIZE], sha1_ctx *context); +void sha1_transform(uint32_t state[5], const uint8_t buffer[SHA1_BLOCKSIZE]); +void sha1_hash(char *hash, const char *data, uint32_t len); + +#endif /* SHA1_H */ diff --git a/src/include/sha256.h b/src/include/sha256.h new file mode 100644 index 0000000..e8979c5 --- /dev/null +++ b/src/include/sha256.h @@ -0,0 +1,18 @@ +#ifndef SHA256_H +#define SHA256_H + +typedef struct +{ + uint8_t data[64]; + uint32_t datalen; + uint32_t bitlen[2]; + uint32_t state[8]; +} sha256_ctx; + +static void sha256_init(sha256_ctx *ctx); +static void sha256_transform(sha256_ctx *ctx, uint8_t *data); +static void sha256_update(sha256_ctx *ctx, uint8_t *data, uint32_t len); +static void sha256_final(uint8_t *hash, sha256_ctx *ctx); +extern void sha256_hash(char *hash,const char *data, size_t len); + +#endif diff --git a/src/include/smtpdlog.h b/src/include/smtpdlog.h new file mode 100644 index 0000000..0feb126 --- /dev/null +++ b/src/include/smtpdlog.h @@ -0,0 +1,73 @@ +#ifndef SMTPDLOG_H +#define SMTPDLOG_H +#define FDLOG 2 + +void flush(); +void out(); + +void smtpdlog_init(void); +void smtp_loga(char *,char *,char *,char *,char *,char *,char *,char *,char *); +void smtp_logb(char *,char *,char *,char *,char *,char *,char *); +void smtp_logg(char *,char *,char *,char *,char *,char *,char *); +void smtp_logh(char *,char *,char *,char *,char *); +void smtp_logi(char *,char *,char *,char *,char *,char *,char *,char *); +void smtp_logr(char *,char *,char *,char *,char *,char *,char *,char *); + +void die_read(void); +void die_alarm(void); +void die_nomem(void); +void die_control(void); +void die_ipme(void); +void die_starttls(void); +void die_recipients(void); +void straynewline(void); + +void err_unimpl(void); +void err_syntax(void); +void err_noop(void); +void err_vrfy(void); +void err_wantrcpt(void); +void err_qqt(void); + +int err_child(void); +int err_fork(void); +int err_pipe(void); +int err_write(void); +int err_starttls(void); +void err_tlsreq(char *,char *,char *,char *,char *); + +void err_helo(char *,char *,char *,char *,char *,char *,char *,char *); +void err_spf(char *,char *,char *,char *,char *,char *,char *,char *); + +void err_authsetup(char *,char *,char *,char *,char *); +void err_authd(void); +void err_authmail(void); +void err_authfail(char *,char *,char *,char *,char *,char *,char *); +void err_authinvalid(char *,char *,char *,char *,char *); +void err_authabrt(void); +void err_authreq(char *,char *,char *,char *,char *); +void err_submission(char *,char *,char *,char *,char *); +int err_authabort(void); +int err_authinput(void); +int err_noauth(void); + +void err_wantmail(void); +void err_mav(char *,char *,char *,char *,char *,char *,char *); +void err_bmf(char *,char *,char *,char *,char *,char *,char *,char *); +void err_mfdns(char *,char *,char *,char *,char *,char *,char *); + +void err_nogateway(char *,char *,char *,char *,char *,char *,char *); +void err_brt(char *,char *,char *,char *,char *,char *,char *); +void err_rcpts(char *,char *,char *,char *,char *,char *,char *); +void err_recipient(char *,char *,char *,char *,char *,char *,char *); + +void straynewline(void); +void err_notorious(void); +void err_size(char *,char *,char *,char *,char *,char *,char *); +void err_data(char *,char *,char *,char *,char *,char *,char *,char *); + +int err_postgl(void); +int err_forkgl(void); +void postgrey(char *,char *,char *,char *,char *,char *,char *); + +#endif diff --git a/src/include/spf.h b/src/include/spf.h new file mode 100644 index 0000000..ca20418 --- /dev/null +++ b/src/include/spf.h @@ -0,0 +1,111 @@ +#ifndef SPF_H +#define SPF_H + +#include "stralloc.h" +#include "ipalloc.h" + +/* (Internal) Processing codes */ + +#define SPF_INIT -1 +#define SPF_EXT -2 /* x */ +#define SPF_ME -3 +#define SPF_EXHAUST -4 +#define SPF_LOOP -5 +#define SPF_MULTIRR -6 +#define SPF_LOCAL -7 +#define SPF_ERROR -8 +#define SPF_NOMEM -9 +#define SPF_SYNTAX -10 /* Setup problem */ + +/* (External) Resulting codes */ + +#define SPF_OK 0 /* + Pass */ +#define SPF_NONE 1 /* o None */ +#define SPF_UNKNOWN 2 /* u Unknown method */ +#define SPF_NEUTRAL 3 /* ? Neutral */ +#define SPF_SOFTFAIL 4 /* ~ Softfail */ +#define SPF_FAIL 5 /* - Not Permitted */ +#define SPF_DNSSOFT 6 /* d From DNS; not used */ + +#define LOOKUP_LIMIT 10 + +/* spfinfo: S=remoteip|O=mailfrom|C=identity/domain|H=helo|M(echanism)=query|D=redirect|I=domain|P=problem|R:result */ + +#define SPF_DEFEXP "See http://%{d}/why.html?sender=%{s}&ip=%{i}&receiver=%{r}" + +extern int flagip6; +extern stralloc spfmf; +extern stralloc spfhelo; +extern stralloc spfinfo; +extern stralloc spfdomain; +extern stralloc dnsname; +extern stralloc spflocalrules; +extern stralloc spfrecord; +extern stralloc expdomain; +extern stralloc spfexplain; +extern stralloc spfexpmsg; + +/* this table and macro came from wget more or less */ +/* and was in turn stolen by me++ from libspf as is :) */ + +const static unsigned char urlchr_table[256] = +{ + 1, 1, 1, 1, 1, 1, 1, 1, /* NUL SOH STX ETX EOT ENQ ACK BEL */ + 1, 1, 1, 1, 1, 1, 1, 1, /* BS HT LF VT FF CR SO SI */ + 1, 1, 1, 1, 1, 1, 1, 1, /* DLE DC1 DC2 DC3 DC4 NAK SYN ETB */ + 1, 1, 1, 1, 1, 1, 1, 1, /* CAN EM SUB ESC FS GS RS US */ + 1, 0, 1, 1, 0, 1, 1, 0, /* SP ! " # $ % & ' */ + 0, 0, 0, 1, 0, 0, 0, 1, /* ( ) * + , - . / */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 0 1 2 3 4 5 6 7 */ + 0, 0, 1, 1, 1, 1, 1, 1, /* 8 9 : ; < = > ? */ + 1, 0, 0, 0, 0, 0, 0, 0, /* @ A B C D E F G */ + 0, 0, 0, 0, 0, 0, 0, 0, /* H I J K L M N O */ + 0, 0, 0, 0, 0, 0, 0, 0, /* P Q R S T U V W */ + 0, 0, 0, 1, 1, 1, 1, 0, /* X Y Z [ \ ] ^ _ */ + 1, 0, 0, 0, 0, 0, 0, 0, /* ` a b c d e f g */ + 0, 0, 0, 0, 0, 0, 0, 0, /* h i j k l m n o */ + 0, 0, 0, 0, 0, 0, 0, 0, /* p q r s t u v w */ + 0, 0, 0, 1, 1, 1, 1, 1, /* x y z { | } ~ DEL */ + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, +}; + +#define WSPACE(x) ((x) == ' ' || (x) == '\t' || (x) == '\r' || (x) == '\n') +#define NXTOK(b, p, a) do { (b) = (p); \ + while((p) < (a)->len && !WSPACE((a)->s[(p)])) ++(p); \ + while((p) < (a)->len && WSPACE((a)->s[(p)])) (a)->s[(p)++] = 0; \ + } while(0) + +/* spfdnsip.c */ + +int match_ip4(unsigned char [4],int,char [4]); +int match_ip6(unsigned char [16],int,char [16]); +int get_prefix(char *); +int spf_records(stralloc *,stralloc *); +int spf_include(char *,char *); +int spf_a(char *,char *); +int spf_mx(char *,char *); +int spf_ptr(char *,char *); +int spf_ip4(char *,char *); +int spf_ip6(char *,char *); +int spf_exists(char *,char *); + +/* spf.c */ + +int spf_query(const char *,const char *,const char *,const char *,const int); +int spf_lookup(stralloc *); +int spf_mechanism(char *,char *,char *,char *); +int spf_parse(stralloc *,char *,char *); +int spf_macros(stralloc *,char *,char *); +int spf_info(char *,const char *); + +#endif + diff --git a/src/include/srs2.h b/src/include/srs2.h new file mode 100644 index 0000000..e993928 --- /dev/null +++ b/src/include/srs2.h @@ -0,0 +1,126 @@ +#ifndef SRS2_H +#define SRS2_H +#include +#include + +/* Adjusted to s/qmail (feh) */ + +/* Copyright (c) 2004 Shevek (srs@anarres.org) + * All rights reserved. + * + * This file is a part of libsrs2 from http://www.libsrs2.org/ + * + * Redistribution and use in source and binary forms, with or without + * modification, under the terms of either the GNU General Public + * License version 2 or the BSD license, at the discretion of the + * user. Copies of these licenses have been included in the libsrs2 + * distribution. See the the file called LICENSE for more + * information. + */ + +/* This is ugly, but reasonably safe. */ +#undef TRUE +#define TRUE 1 +#undef FALSE +#define FALSE 0 + +#define SRSSEP '=' +#define SRS0TAG "SRS0" +#define SRS1TAG "SRS1" + +/* Error codes */ + +#define SRS_ERRTYPE_MASK 0xf000 +#define SRS_ERRTYPE_NONE 0x0000 +#define SRS_ERRTYPE_CONFIG 0x1000 +#define SRS_ERRTYPE_INPUT 0x2000 +#define SRS_ERRTYPE_SYNTAX 0x4000 +#define SRS_ERRTYPE_SRS 0x8000 + +#define SRS_SUCCESS (0) +#define SRS_ENOTSRSADDRESS (1) +#define SRS_ENOTREWRITTEN (2) + +#define SRS_ENOSECRETS (SRS_ERRTYPE_CONFIG | 1) +#define SRS_ESEPARATORINVALID (SRS_ERRTYPE_CONFIG | 2) + +#define SRS_ENOSENDERATSIGN (SRS_ERRTYPE_INPUT | 1) +#define SRS_EBUFTOOSMALL (SRS_ERRTYPE_INPUT | 2) + +#define SRS_ENOSRS0HOST (SRS_ERRTYPE_SYNTAX | 1) +#define SRS_ENOSRS0USER (SRS_ERRTYPE_SYNTAX | 2) +#define SRS_ENOSRS0HASH (SRS_ERRTYPE_SYNTAX | 3) +#define SRS_ENOSRS0STAMP (SRS_ERRTYPE_SYNTAX | 4) +#define SRS_ENOSRS1HOST (SRS_ERRTYPE_SYNTAX | 5) +#define SRS_ENOSRS1USER (SRS_ERRTYPE_SYNTAX | 6) +#define SRS_ENOSRS1HASH (SRS_ERRTYPE_SYNTAX | 7) +#define SRS_EBADTIMESTAMPCHAR (SRS_ERRTYPE_SYNTAX | 8) +#define SRS_EHASHTOOSHORT (SRS_ERRTYPE_SYNTAX | 9) + +#define SRS_ETIMESTAMPOUTOFDATE (SRS_ERRTYPE_SRS | 1) +#define SRS_EHASHINVALID (SRS_ERRTYPE_SRS | 2) + +#define SRS_ERROR_TYPE(x) ((x) & SRS_ERRTYPE_MASK) + +/* SRS implementation */ + +#define SRS_IS_SRS_ADDRESS(x) ( \ + (strncasecmp((x),"SRS",3) == 0) && \ + (strchr("01", (x)[3]) != NULL) && \ + (strchr("-+=", (x)[4]) != NULL) \ +) + +typedef void *(*srs_malloc_t)(size_t); +typedef void *(*srs_realloc_t)(void *,size_t); +typedef void (*srs_free_t)(void *); + +typedef int srs_bool; + +typedef struct _srs_t { + /* Rewriting parameters */ +// stralloc cookies; + char **secrets; + int numsecrets; + char separator; + + /* Security parameters */ + int maxage; /* Maximum allowed age in seconds */ + int hashlen; + int hashmin; + + /* Behaviour parameters */ + srs_bool alwaysrewrite; /* Rewrite even into same domain? */ + srs_bool noforward; /* Never perform forwards rewriting */ + srs_bool noreverse; /* Never perform reverse rewriting */ + char **neverrewrite; /* A list of non-rewritten domains */ +} srs_t; + +/* Interface */ +int srs_set_malloc(srs_malloc_t m,srs_realloc_t r,srs_free_t f); +srs_t *srs_new(); +void srs_init(srs_t *); +void srs_free(srs_t *); +int srs_forward(srs_t *,char *,int,const char *,const char *); +int srs_forward_alloc(srs_t *,char **,const char *,const char *); +int srs_reverse(srs_t *,char *,int, const char *); +int srs_reverse_alloc(srs_t *,char **,const char *); +const char *srs_strerror(int); +int srs_add_secret(srs_t *,const char *); +const char * srs_get_secret(srs_t *,int); + /* You probably shouldn't call these. */ +int srs_timestamp_create(srs_t *,char *,time_t); +int srs_timestamp_check(srs_t *,const char *); + +#define SRS_PARAM_DECLARE(n, t) \ + int srs_set_ ## n (srs_t *srs, t value); \ + t srs_get_ ## n (srs_t *srs); + +SRS_PARAM_DECLARE(alwaysrewrite,srs_bool) +SRS_PARAM_DECLARE(separator,char) +SRS_PARAM_DECLARE(maxage,int) +SRS_PARAM_DECLARE(hashlen,int) +SRS_PARAM_DECLARE(hashmin,int) +SRS_PARAM_DECLARE(noforward,srs_bool) +SRS_PARAM_DECLARE(noreverse,srs_bool) + +#endif /* SRS2_H */ diff --git a/src/include/strset.h b/src/include/strset.h new file mode 100644 index 0000000..4a5703e --- /dev/null +++ b/src/include/strset.h @@ -0,0 +1,29 @@ +#ifndef STRSET_H +#define STRSET_H + +#include "uint_t.h" + +typedef struct strset_list +{ + uint32 h; + int next; +} +strset_list; + +typedef struct +{ + int mask; /* mask + 1 is power of 2, size of hash table */ + int n; /* number of entries used in list and x */ + int a; /* number of entries allocated in list and x */ + int *first; /* first[h] is front of hash list h */ + strset_list *p; /* p[i].next is next; p[i].h is hash of x[i] */ + char **x; /* x[i] is entry i */ +} +strset; + +extern uint32 strset_hash(char *); +extern int strset_init(strset *); +extern char *strset_in(strset *,char *); +extern int strset_add(strset *,char *); + +#endif diff --git a/src/include/tcpto.h b/src/include/tcpto.h new file mode 100644 index 0000000..ca4f97a --- /dev/null +++ b/src/include/tcpto.h @@ -0,0 +1,25 @@ +#ifndef TCPTO_H +#define TCPTO_H + +#define TCPTO_BUFSIZ 1024 + +/* persistency structure: record +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 + union { + struct ip_address ip; + struct ip6_address ip6; + unsigned char nul[16]; -- 16 byte -- IPv4: filled up with '.' = x'2e' + } addr; +}; total: 32 byte +*/ + +int tcpto(); +void tcpto_err(); +void tcpto_clean(); + +#endif diff --git a/src/include/tls_errors.h b/src/include/tls_errors.h new file mode 100644 index 0000000..a61e8fd --- /dev/null +++ b/src/include/tls_errors.h @@ -0,0 +1,42 @@ +#ifndef TLS_CLIENTS_H +#define TLS_CLIENTS_H + +#include "stralloc.h" + +extern void temp_tlscon(); +extern void temp_tlspeercert(); +extern void temp_tlspeervalid(); +extern void temp_tlspeerverify(); + +extern stralloc host; +extern stralloc remotehost; +extern stralloc cafile; +extern stralloc cadir; +extern stralloc ciphers; +extern stralloc certfile; +extern stralloc keyfile; +extern stralloc keypwd; + +void temp_nomem(void); +void temp_tlsctx(void); +void temp_tlsca(void); +void temp_tlscipher(void); +void temp_tlscert(void); +void temp_tlscertfp(void); +void temp_tlsdigest(void); +void temp_tlshost(void); +void temp_tlskey(void); +void temp_tlschk(void); +void temp_tlsctx(void); +void temp_tlserr(void); +void temp_tlsepeercert(void); +void temp_tlsepeerverify(void); +void temp_invaliddigest(void); +void temp_tlsainvalid(void); +void temp_tlsamissing(void); + +void zerodie(void); +void out(char *); +void outsafe(stralloc *); + +#endif diff --git a/src/include/tls_remote.h b/src/include/tls_remote.h new file mode 100644 index 0000000..c3c7933 --- /dev/null +++ b/src/include/tls_remote.h @@ -0,0 +1,32 @@ +#ifndef TLS_REMOTE_H +#define TLS_REMOTE_H + +#include + +/* 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" +#endif + +extern char *tlsdestinfo; +extern struct constmap maptlsdestinations; +extern char *tlsdomaininfo; +extern struct constmap mapdomaincerts; +extern stralloc ciphers; + +int tls_domaincerts(const stralloc); +int tls_destination(const stralloc); +int tlsa_check(const STACK_OF(X509) *,const stralloc,const unsigned long); +int tls_fingerprint(X509 *,const char *,const int); +int tls_chainfile(SSL_CTX *,const char *); +int tls_certkey(SSL_CTX *,const char *,const char *,char *); +int tls_conn(SSL *,int); +int tls_setup(int,char *,char *); +int tls_checkpeer(SSL *,X509 *,const stralloc,const int,const int); +int tls_checkcrl(SSL *); +int tls_error(void); +int tls_exit(SSL *); + +int utf8string(unsigned char *,int); + +#endif diff --git a/src/include/tls_start.h b/src/include/tls_start.h new file mode 100644 index 0000000..d0417f9 --- /dev/null +++ b/src/include/tls_start.h @@ -0,0 +1,7 @@ +#ifndef TLS_START_H +#define TLS_START_H + +int starttls_init(void); +int starttls_info(void); + +#endif diff --git a/src/include/tls_timeoutio.h b/src/include/tls_timeoutio.h new file mode 100644 index 0000000..175757e --- /dev/null +++ b/src/include/tls_timeoutio.h @@ -0,0 +1,15 @@ +#ifndef TLS_TIMEOUTIO_H +#define TLS_TIMEOUTIO_H + +#include + +int tls_timeoutconn(int t, int rfd, int wfd, SSL *tls); +int tls_timeoutaccept(int t, int rfd, int wfd, SSL *tls); +int tsl_timeoutrehandshake(int t, int rfd, int wfd, SSL *tls); + +int tls_timeoutread(int t, int rfd, int wfd, SSL *tls, char *buf, int len); +int tls_timeoutwrite(int t, int rfd, int wfd, SSL *tls, char *buf, int len); + +int tls_timeoutio(int (*fun)(), int t, int rfd, int wfd, SSL *tls, char *buf, int len); + +#endif diff --git a/src/include/token822.h b/src/include/token822.h new file mode 100644 index 0000000..42c909f --- /dev/null +++ b/src/include/token822.h @@ -0,0 +1,36 @@ +#ifndef TOKEN822_H +#define TOKEN822_H + +#include "genalloc.h" + +struct token822 { + int type; + char *s; + int slen; +}; + +GEN_ALLOC_typedef(token822_alloc,struct token822,t,len,a) + +int token822_parse(); +int token822_addrlist(); +int token822_unquote(); +int token822_unparse(); +void token822_free(); +void token822_reverse(); +int token822_ready(); +int token822_readyplus(); +int token822_append(); + +#define TOKEN822_ATOM 1 +#define TOKEN822_QUOTE 2 +#define TOKEN822_LITERAL 3 +#define TOKEN822_COMMENT 4 +#define TOKEN822_LEFT 5 +#define TOKEN822_RIGHT 6 +#define TOKEN822_AT 7 +#define TOKEN822_COMMA 8 +#define TOKEN822_SEMI 9 +#define TOKEN822_COLON 10 +#define TOKEN822_DOT 11 + +#endif diff --git a/src/include/trigger.h b/src/include/trigger.h new file mode 100644 index 0000000..d0f4a3e --- /dev/null +++ b/src/include/trigger.h @@ -0,0 +1,9 @@ +#ifndef TRIGGER_H +#define TRIGGER_H + +extern void trigger_set(); +extern void trigger_selprep(); +extern int trigger_pulled(); +extern void triggerpull(); + +#endif diff --git a/src/include/triggerpull.h b/src/include/triggerpull.h new file mode 100644 index 0000000..188f4f2 --- /dev/null +++ b/src/include/triggerpull.h @@ -0,0 +1,6 @@ +#ifndef TRIGGERPULL_H +#define TRIGGERPULL_H + +void triggerpull(void); + +#endif diff --git a/src/include/ucspitls.h b/src/include/ucspitls.h new file mode 100644 index 0000000..40f8a81 --- /dev/null +++ b/src/include/ucspitls.h @@ -0,0 +1,45 @@ +#ifndef UCSPITLS_H +#define UCSPITLS_H + +#include +#include +#include +#include "stralloc.h" + +#define SSL_NAME_LEN 256 +#define OPENSSL_VERSION_NUMBER 0x101010100L + +#if (OPENSSL_VERSION_NUMBER < 0x10100000L) +#define ssl_client() (ssl_context(SSLv23_client_method())) +#define ssl_server() (ssl_context(SSLv23_server_method())) +#else +#define ssl_client() (ssl_context(TLS_client_method())) +#define ssl_server() (ssl_context(TLS_server_method())) +#endif + +extern int ssl_errno; +int ssl_io(SSL *,int,int,unsigned int); +SSL_CTX *ssl_context(SSL_METHOD *); +int ssl_timeoutconn(SSL *,unsigned int); +int ssl_timeoutaccept(SSL *,unsigned int); +SSL *ssl_new(SSL_CTX *,int); +int ssl_certkey(SSL_CTX *,const char *,const char *,pem_password_cb *); +int ssl_ca(SSL_CTX *,const char *,const char *,int); +int ssl_cca(SSL_CTX *,const char *); +int ssl_ciphers(SSL_CTX *,const char *); +int ssl_verify(SSL *,const char *); +int ssl_params(SSL_CTX *,const char *,int); +int ssl_server_env(SSL *,stralloc *); +int ssl_client_env(SSL *,stralloc *); +char *ssl_error_str(int); + +#define ssl_errstr() (SSL_load_error_strings()) +#define ssl_free(ssl) (SSL_free((ssl))) +#define ssl_close(ssl) (close(SSL_get_fd((ssl)))) + +#define ssl_pending(ssl) (SSL_pending((ssl))) +#define ssl_shutdown(ssl) (SSL_shutdown((ssl))) +#define ssl_shutdown_pending(ssl) (SSL_get_shutdown((ssl)) & SSL_RECEIVED_SHUTDOWN) +#define ssl_shutdown_sent(ssl) (SSL_get_shutdown((ssl)) & SSL_SENT_SHUTDOWN) + +#endif diff --git a/src/include/wildmat.h b/src/include/wildmat.h new file mode 100644 index 0000000..501b7e4 --- /dev/null +++ b/src/include/wildmat.h @@ -0,0 +1,6 @@ +#ifndef WILDMAT_H +#define WILDMAT_H + +extern int wildmat(char *,char *); + +#endif -- cgit v1.2.3