Here are my patches for removing SSL.
Ciao
Stephan
--
| Cui bono? |
--- CTRLClient.cpp.orig 2009-12-16 22:36:30.000000000 +0100
+++ CTRLClient.cpp 2009-12-16 22:00:36.000000000 +0100
@@ -25,8 +25,10 @@
#include "SvrDefines.h"
#include "ShBlocks.h"
#include "BuffSock.h"
+#ifdef WITH_SSL
#include "SSLBind.h"
#include "SSLConfig.h"
+#endif
#include "MiscUtils.h"
#include "StrUtils.h"
#include "MD5.h"
@@ -46,7 +48,9 @@
#define CCLN_CHF_USESSL (1 << 2)
struct CClnChannelCfg {
+#ifdef WITH_SSL
SslServerBind SSLB;
+#endif
unsigned long ulFlags;
};
@@ -184,6 +188,7 @@
return 0;
}
+#ifdef WITH_SSL
static int CClnSslEnvCB(void *pPrivate, int iID, void const *pData)
{
SslBindEnv *pSslE = (SslBindEnv *) pPrivate;
@@ -208,6 +213,7 @@
return 0;
}
+#endif
BSOCK_HANDLE CClnConnectServer(char const *pszServer, int iPortNo,
char const *pszUsername, char const *pszPassword,
@@ -240,11 +246,13 @@
int iErrorCode = 0;
char szRTXBuffer[2048] = "";
+#ifdef WITH_SSL
if ((pChCfg->ulFlags & CCLN_CHF_USESSL) &&
CClnSslBind(pChCfg, hBSock) < 0) {
BSckDetach(hBSock, 1);
return INVALID_BSOCK_HANDLE;
}
+#endif
/* Read welcome message */
if (CClnGetResponse(hBSock, szRTXBuffer, sizeof(szRTXBuffer), &iErrorCode, iTimeout) < 0) {
@@ -257,6 +265,7 @@
return INVALID_BSOCK_HANDLE;
}
+#ifdef WITH_SSL
/*
* Do we need to switch to SSL?
*/
@@ -277,6 +286,7 @@
return INVALID_BSOCK_HANDLE;
}
}
+#endif
/* Prepare login */
char szTimeStamp[256] = "";
@@ -359,12 +369,14 @@
" -p pass = set password\n"
" -t timeout = set timeout [%d]\n"
" -f filename = set I/O filename [stdin/stdout]\n"
+#ifdef WITH_SSL
" -S = enable SSL link negotiation\n"
" -L = use native SSL link\n"
" -K filename = set the SSL private key file\n"
" -C filename = set the SSL certificate file\n"
" -X filename = set the SSL certificate-list file\n"
" -H dir = set the SSL certificate-store directory\n"
+#endif
" -c = disable MD5 authentication\n"
" -D = enable debug\n",
pszProgName, STD_CTRL_PORT, STD_CTRL_TIMEOUT);
@@ -383,10 +395,12 @@
ZeroData(ChCfg);
ChCfg.ulFlags = CCLN_CHF_USEMD5;
+#ifdef WITH_SSL
ChCfg.SSLB.pszKeyFile = SysGetEnv("CTRL_KEY_FILE");
ChCfg.SSLB.pszCertFile = SysGetEnv("CTRL_CERT_FILE");
ChCfg.SSLB.pszCAFile = SysGetEnv("CTRL_CA_FILE");
ChCfg.SSLB.pszCAPath = SysGetEnv("CTRL_CA_PATH");
+#endif
for (i = 1; i < iArgCount; i++) {
if (pszArgs[i][0] != '-')
@@ -427,6 +441,7 @@
ChCfg.ulFlags &= ~CCLN_CHF_USEMD5;
break;
+#ifdef WITH_SSL
case ('S'):
ChCfg.ulFlags &= ~CCLN_CHF_USESSL;
ChCfg.ulFlags |= CCLN_CHF_SSLSWITCH;
@@ -464,6 +479,7 @@
ChCfg.SSLB.pszCAPath = SysStrDup(pszArgs[i]);
}
break;
+#endif
case ('D'):
bServerDebug = true;
@@ -475,15 +491,19 @@
}
if (strlen(szServer) == 0 || strlen(szUsername) == 0 ||
strlen(szPassword) == 0 || i == iArgCount) {
+#ifdef WITH_SSL
SysFree(ChCfg.SSLB.pszKeyFile);
SysFree(ChCfg.SSLB.pszCertFile);
+#endif
return CCLN_ERR_BAD_USAGE;
}
+#ifdef WITH_SSL
if ((ChCfg.SSLB.pszKeyFile != NULL) != (ChCfg.SSLB.pszCertFile != NULL)) {
SysFree(ChCfg.SSLB.pszKeyFile);
SysFree(ChCfg.SSLB.pszCertFile);
return CCLN_ERR_SSL_KEYCERT;
}
+#endif
int iFirstParam = i;
int iCmdLength = 0;
@@ -506,10 +526,12 @@
BSOCK_HANDLE hBSock = CClnConnectServer(szServer, iPortNo, szUsername, szPassword,
&ChCfg, iTimeout);
+#ifdef WITH_SSL
SysFree(ChCfg.SSLB.pszKeyFile);
SysFree(ChCfg.SSLB.pszCertFile);
SysFree(ChCfg.SSLB.pszCAFile);
SysFree(ChCfg.SSLB.pszCAPath);
+#endif
if (hBSock == INVALID_BSOCK_HANDLE) {
ErrorPush();
SysFree(pszCommand);
@@ -540,25 +562,33 @@
CClnLogError(ErrGetErrorCode());
return 1;
}
+#ifdef WITH_SSL
if (BSslInit() < 0) {
CClnLogError(ErrGetErrorCode());
SysCleanupLibrary();
return 2;
}
+#endif
int iExecResult = CClnExec(iArgCount, pszArgs);
if (iExecResult == CCLN_ERR_BAD_USAGE) {
CClnShowUsage(pszArgs[0]);
+#ifdef WITH_SSL
BSslCleanup();
+#endif
SysCleanupLibrary();
return 3;
} else if (iExecResult < 0) {
CClnLogError(iExecResult);
+#ifdef WITH_SSL
BSslCleanup();
+#endif
SysCleanupLibrary();
return 4;
}
+#ifdef WITH_SSL
BSslCleanup();
+#endif
SysCleanupLibrary();
return 0;
--- FINGSvr.cpp.orig 2009-12-16 22:37:10.000000000 +0100
+++ FINGSvr.cpp 2009-12-16 22:03:15.000000000 +0100
@@ -26,8 +26,10 @@
#include "ShBlocks.h"
#include "SList.h"
#include "BuffSock.h"
+#ifdef WITH_SSL
#include "SSLBind.h"
#include "SSLConfig.h"
+#endif
#include "StrUtils.h"
#include "ResLocks.h"
#include "MiscUtils.h"
@@ -136,6 +138,7 @@
return ErrorPop();
}
+#ifdef WITH_SSL
/*
* Do we need to switch to TLS?
*/
@@ -168,6 +171,7 @@
SysFree(SslE.pszIssuer);
SysFree(SslE.pszSubject);
}
+#endif
/* Increase threads count */
FINGConfig *pFINGCfg = (FINGConfig *) ShbLock(pThCtx->pThCfg->hThShb);
--- CTRLSvr.cpp.orig 2009-12-16 22:36:54.000000000 +0100
+++ CTRLSvr.cpp 2009-12-16 22:02:39.000000000 +0100
@@ -26,8 +26,10 @@
#include "ShBlocks.h"
#include "SList.h"
#include "BuffSock.h"
+#ifdef WITH_SSL
#include "SSLBind.h"
#include "SSLConfig.h"
+#endif
#include "ResLocks.h"
#include "MiscUtils.h"
#include "MD5.h"
@@ -85,7 +87,9 @@
static char *CTRLGetAccountsFilePath(char *pszAccFilePath, int iMaxPath);
static int CTRLAccountCheck(CTRLConfig *pCTRLCfg, char const *pszUsername,
char const *pszPassword, char const *pszTimeStamp);
+#ifdef WITH_SSL
static int CTRLSslEnvCB(void *pPrivate, int iID, void const *pData);
+#endif
static int CTRLLogin(CTRLConfig *pCTRLCfg, BSOCK_HANDLE hBSock,
char const *pszTimeStamp, SYS_INET_ADDR const &PeerInfo);
static int CTRLHandleSession(ThreadConfig const *pThCfg, BSOCK_HANDLE hBSock,
@@ -299,6 +303,7 @@
return ErrorPop();
}
+#ifdef WITH_SSL
/*
* Do we need to switch to TLS?
*/
@@ -331,6 +336,7 @@
SysFree(SslE.pszIssuer);
SysFree(SslE.pszSubject);
}
+#endif
/* Check IP permission */
if (CTRLCheckPeerIP(pThCtx->SockFD) < 0) {
ErrorPush();
@@ -506,6 +512,7 @@
return ERR_BAD_CTRL_LOGIN;
}
+#ifdef WITH_SSL
static int CTRLSslEnvCB(void *pPrivate, int iID, void const *pData)
{
SslBindEnv *pSslE = (SslBindEnv *) pPrivate;
@@ -517,6 +524,7 @@
return 0;
}
+#endif
static int CTRLLogin(CTRLConfig *pCTRLCfg, BSOCK_HANDLE hBSock,
char const *pszTimeStamp, SYS_INET_ADDR const &PeerInfo)
@@ -527,6 +535,7 @@
MscCmdStringCheck(szLogin) < 0)
return ErrGetErrorCode();
+#ifdef WITH_SSL
if (strcmp(szLogin, CTRL_TLS_INIT_STR) == 0) {
int iError;
SslServerBind SSLB;
@@ -563,6 +572,7 @@
MscCmdStringCheck(szLogin) < 0)
return ErrGetErrorCode();
}
+#endif
char **ppszTokens = StrGetTabLineStrings(szLogin);
--- MailSvr.cpp.orig 2009-12-16 22:37:34.000000000 +0100
+++ MailSvr.cpp 2009-12-16 22:11:39.000000000 +0100
@@ -29,7 +29,9 @@
#include "BuffSock.h"
#include "MailConfig.h"
#include "MiscUtils.h"
+#ifdef WITH_SSL
#include "SSLBind.h"
+#endif
#include "ResLocks.h"
#include "POP3Svr.h"
#include "SMTPSvr.h"
@@ -110,21 +112,27 @@
static int SvrSetupCTRL(int iArgCount, char *pszArgs[]);
static long SvrThreadCntCTRL(ThreadConfig const *pThCfg);
static void SvrCleanupCTRL(void);
+#ifdef WITH_SSL
static int SvrSetupCTRLS(int iArgCount, char *pszArgs[]);
static void SvrCleanupCTRLS(void);
+#endif
static int SvrSetupFING(int iArgCount, char *pszArgs[]);
static long SvrThreadCntFING(ThreadConfig const *pThCfg);
static void SvrCleanupFING(void);
static int SvrSetupPOP3(int iArgCount, char *pszArgs[]);
static long SvrThreadCntPOP3(ThreadConfig const *pThCfg);
static void SvrCleanupPOP3(void);
+#ifdef WITH_SSL
static int SvrSetupPOP3S(int iArgCount, char *pszArgs[]);
static void SvrCleanupPOP3S(void);
+#endif
static int SvrSetupSMTP(int iArgCount, char *pszArgs[]);
static long SvrThreadCntSMTP(ThreadConfig const *pThCfg);
static void SvrCleanupSMTP(void);
+#ifdef WITH_SSL
static int SvrSetupSMTPS(int iArgCount, char *pszArgs[]);
static void SvrCleanupSMTPS(void);
+#endif
static int SvrSetupSMAIL(int iArgCount, char *pszArgs[]);
static void SvrCleanupSMAIL(void);
static int SvrSetupPSYNC(int iArgCount, char *pszArgs[]);
@@ -393,6 +401,7 @@
SysCloseSocket(ThCfgCTRL.SockFDs[ThCfgCTRL.iNumSockFDs - 1]);
}
+#ifdef WITH_SSL
static int SvrSetupCTRLS(int iArgCount, char *pszArgs[])
{
int iPort = STD_CTRLS_PORT, iFamily = AF_INET;
@@ -468,6 +477,7 @@
for (; ThCfgCTRLS.iNumSockFDs > 0; ThCfgCTRLS.iNumSockFDs--)
SysCloseSocket(ThCfgCTRLS.SockFDs[ThCfgCTRLS.iNumSockFDs - 1]);
}
+#endif
static int SvrSetupFING(int iArgCount, char *pszArgs[])
{
@@ -737,6 +747,7 @@
SysCloseSocket(ThCfgPOP3.SockFDs[ThCfgPOP3.iNumSockFDs - 1]);
}
+#ifdef WITH_SSL
static int SvrSetupPOP3S(int iArgCount, char *pszArgs[])
{
int iPort = STD_POP3S_PORT, iFamily = AF_INET;
@@ -813,6 +824,7 @@
for (; ThCfgPOP3S.iNumSockFDs > 0; ThCfgPOP3S.iNumSockFDs--)
SysCloseSocket(ThCfgPOP3S.SockFDs[ThCfgPOP3S.iNumSockFDs - 1]);
}
+#endif
static int SvrSetupSMTP(int iArgCount, char *pszArgs[])
{
@@ -962,6 +974,7 @@
SysCloseSocket(ThCfgSMTP.SockFDs[ThCfgSMTP.iNumSockFDs - 1]);
}
+#ifdef WITH_SSL
static int SvrSetupSMTPS(int iArgCount, char *pszArgs[])
{
int iPort = STD_SMTPS_PORT, iFamily = AF_INET;
@@ -1038,6 +1051,7 @@
for (; ThCfgSMTPS.iNumSockFDs > 0; ThCfgSMTPS.iNumSockFDs--)
SysCloseSocket(ThCfgSMTPS.SockFDs[ThCfgSMTPS.iNumSockFDs - 1]);
}
+#endif
static void SvrShutdown__SMAIL(void *pPrivate)
{
@@ -1492,8 +1506,12 @@
return ErrorPop();
}
/* Initialize DNS cache */
- if (CDNS_Initialize(iDnsCacheDirs) < 0 ||
- BSslInit() < 0) {
+ if (CDNS_Initialize(iDnsCacheDirs) < 0
+#ifdef WITH_SSL
+ ||
+ BSslInit() < 0
+#endif
+ ) {
ErrorPush();
RLckCleanupLockers();
@@ -1505,8 +1523,10 @@
static void SvrCleanup(void)
{
+#ifdef WITH_SSL
/* Cleanup SSL support */
BSslCleanup();
+#endif
/* Cleanup resource lockers */
RLckCleanupLockers();
@@ -1590,11 +1610,17 @@
ArrayInit(iSvcI, -1);
if ((iSvcI[SVC_SMAIL] = SvrSetupSMAIL(iMergeArgsCount, ppszMergeArgs)) < 0 ||
(iSvcI[SVC_CTRL] = SvrSetupCTRL(iMergeArgsCount, ppszMergeArgs)) < 0 ||
+#ifdef WITH_SSL
(iSvcI[SVC_CTRLS] = SvrSetupCTRLS(iMergeArgsCount, ppszMergeArgs)) < 0 ||
+#endif
(iSvcI[SVC_POP3] = SvrSetupPOP3(iMergeArgsCount, ppszMergeArgs)) < 0 ||
+#ifdef WITH_SSL
(iSvcI[SVC_POP3S] = SvrSetupPOP3S(iMergeArgsCount, ppszMergeArgs)) < 0 ||
+#endif
(iSvcI[SVC_SMTP] = SvrSetupSMTP(iMergeArgsCount, ppszMergeArgs)) < 0 ||
+#ifdef WITH_SSL
(iSvcI[SVC_SMTPS] = SvrSetupSMTPS(iMergeArgsCount, ppszMergeArgs)) < 0 ||
+#endif
(iSvcI[SVC_PSYNC] = SvrSetupPSYNC(iMergeArgsCount, ppszMergeArgs)) < 0 ||
(iSvcI[SVC_FING] = SvrSetupFING(iMergeArgsCount, ppszMergeArgs)) < 0 ||
(iSvcI[SVC_LMAIL] = SvrSetupLMAIL(iMergeArgsCount, ppszMergeArgs)) < 0) {
@@ -1628,16 +1654,22 @@
SvrCleanupFING();
if (iSvcI[SVC_PSYNC] == 0)
SvrCleanupPSYNC();
+#ifdef WITH_SSL
if (iSvcI[SVC_SMTPS] == 0)
SvrCleanupSMTPS();
+#endif
if (iSvcI[SVC_SMTP] == 0)
SvrCleanupSMTP();
+#ifdef WITH_SSL
if (iSvcI[SVC_POP3S] == 0)
SvrCleanupPOP3S();
+#endif
if (iSvcI[SVC_POP3] == 0)
SvrCleanupPOP3();
+#ifdef WITH_SSL
if (iSvcI[SVC_CTRLS] == 0)
SvrCleanupCTRLS();
+#endif
if (iSvcI[SVC_CTRL] == 0)
SvrCleanupCTRL();
if (iSvcI[SVC_SMAIL] == 0)
--- MiscUtils.cpp.orig 2009-12-16 22:37:47.000000000 +0100
+++ MiscUtils.cpp 2009-12-16 22:12:22.000000000 +0100
@@ -29,7 +29,9 @@
#include "MD5.h"
#include "Base64Enc.h"
#include "BuffSock.h"
+#ifdef WITH_SSL
#include "SSLBind.h"
+#endif
#include "MailConfig.h"
#include "UsrUtils.h"
#include "SvrUtils.h"
@@ -1483,6 +1485,7 @@
return 0;
}
+#ifdef WITH_SSL
int MscSslEnvCB(void *pPrivate, int iID, void const *pData)
{
SslBindEnv *pSslE = (SslBindEnv *) pPrivate;
@@ -1490,6 +1493,7 @@
return 0;
}
+#endif
int MscParseOptions(const char *pszOpts, int (*pfAssign)(void *, const char *, const char *),
void *pPrivate)
--- POP3Utils.cpp.orig 2009-12-16 22:38:09.000000000 +0100
+++ POP3Utils.cpp 2009-12-16 22:19:12.000000000 +0100
@@ -29,8 +29,10 @@
#include "SList.h"
#include "BuffSock.h"
#include "Hash.h"
+#ifdef WITH_SSL
#include "SSLBind.h"
#include "SSLConfig.h"
+#endif
#include "MD5.h"
#include "MailConfig.h"
#include "UsrUtils.h"
@@ -131,10 +133,12 @@
static int UPopDoAPOPAuth(BSOCK_HANDLE hBSock, const char *pszUsername,
const char *pszPassword, const char *pszTimeStamp,
char *pszRespBuffer, int iMaxRespChars);
+#ifdef WITH_SSL
static int UPopSwitchToTLS(BSOCK_HANDLE hBSock, const char *pszServer,
POP3ChannelCfg const *pChCfg);
static int UPopInitiateTLS(BSOCK_HANDLE hBSock, const char *pszServer, char *pszRespBuffer,
int iMaxRespChars, POP3ChannelCfg const *pChCfg);
+#endif
static BSOCK_HANDLE UPopCreateChannel(const char *pszServer, const char *pszUsername,
const char *pszPassword, POP3ChannelCfg const *pChCfg);
static int UPopCloseChannel(BSOCK_HANDLE hBSock, int iHardClose = 0);
@@ -887,6 +891,7 @@
return 0;
}
+#ifdef WITH_SSL
static int UPopSwitchToTLS(BSOCK_HANDLE hBSock, const char *pszServer,
POP3ChannelCfg const *pChCfg)
{
@@ -922,6 +927,7 @@
return UPopSwitchToTLS(hBSock, pszServer, pChCfg);
}
+#endif
static BSOCK_HANDLE UPopCreateChannel(const char *pszServer, const char *pszUsername,
const char *pszPassword, POP3ChannelCfg const *pChCfg)
@@ -959,6 +965,7 @@
SysCloseSocket(SockFD);
return INVALID_BSOCK_HANDLE;
}
+#ifdef WITH_SSL
/*
* Is this a full POP3S connection?
*/
@@ -967,6 +974,7 @@
SysCloseSocket(SockFD);
return INVALID_BSOCK_HANDLE;
}
+#endif
/* Read welcome message */
char szRTXBuffer[2048] = "";
@@ -976,6 +984,7 @@
UPopCloseChannel(hBSock);
return INVALID_BSOCK_HANDLE;
}
+#ifdef WITH_SSL
/*
* Non TLS mode active and STLS required?
*/
@@ -986,6 +995,7 @@
UPopCloseChannel(hBSock);
return INVALID_BSOCK_HANDLE;
}
+#endif
/* Extract TimeStamp from server respose ( if any ) */
char szTimeStamp[256] = "";
@@ -1129,12 +1139,14 @@
pChCfg->ulFlags |= POPCHF_USE_APOP;
else if (strcmp(pszName, "FAPOP") == 0)
pChCfg->ulFlags |= POPCHF_USE_APOP | POPCHF_FORCE_APOP;
+#ifdef WITH_SSL
else if (strcmp(pszName, "STLS") == 0)
pChCfg->ulFlags |= POPCHF_USE_STLS;
else if (strcmp(pszName, "FSTLS") == 0)
pChCfg->ulFlags |= POPCHF_USE_STLS | POPCHF_FORCE_STLS;
else if (strcmp(pszName, "POP3S") == 0)
pChCfg->ulFlags |= POPCHF_USE_POP3S;
+#endif
else if (strcmp(pszName, "Leave") == 0) {
if (pszValue == NULL || atoi(pszValue) > 0)
pChCfg->ulFlags |= POPCHF_LEAVE_MSGS;
--- SMTPSvr.cpp.orig 2009-12-16 22:38:23.000000000 +0100
+++ SMTPSvr.cpp 2009-12-16 22:30:58.000000000 +0100
@@ -26,7 +26,9 @@
#include "SList.h"
#include "ShBlocks.h"
#include "BuffSock.h"
+#ifdef WITH_SSL
#include "SSLBind.h"
+#endif
#include "ResLocks.h"
#include "StrUtils.h"
#include "UsrUtils.h"
@@ -35,7 +37,9 @@
#include "SMAILUtils.h"
#include "QueueUtils.h"
#include "MiscUtils.h"
+#ifdef WITH_SSL
#include "SSLConfig.h"
+#endif
#include "Base64Enc.h"
#include "MD5.h"
#include "UsrMailList.h"
@@ -209,8 +213,10 @@
static int SMTPSubmitPackedFile(SMTPSession &SMTPS, const char *pszPkgFile);
static int SMTPHandleCmd_HELO(const char *pszCommand, BSOCK_HANDLE hBSock, SMTPSession &SMTPS);
static int SMTPHandleCmd_EHLO(const char *pszCommand, BSOCK_HANDLE hBSock, SMTPSession &SMTPS);
+#ifdef WITH_SSL
static int SMTPSslEnvCB(void *pPrivate, int iID, void const *pData);
static int SMTPHandleCmd_STARTTLS(const char *pszCommand, BSOCK_HANDLE hBSock, SMTPSession &SMTPS);
+#endif
static int SMTPAddAuth(char **ppszAuths, int iNumAuths, int *piAuthCnt, char const *pszAuth,
char const *pszNoTLSAuths, int iLinkSSL);
static int SMTPListAuths(DynString *pDS, SMTPSession &SMTPS, int iLinkSSL);
@@ -358,6 +364,7 @@
return ErrorPop();
}
+#ifdef WITH_SSL
/*
* Do we need to switch to TLS?
*/
@@ -390,6 +397,7 @@
SysFree(SslE.pszIssuer);
SysFree(SslE.pszSubject);
}
+#endif
/* Increase threads count */
if (SMTPThreadCountAdd(+1, pThCtx->pThCfg->hThShb) < 0) {
@@ -485,9 +493,11 @@
} else if (strcmp(pszName, "SenderDomainCheck") == 0) {
if (pszVal != NULL && !atoi(pszVal))
pSMTPS->ulFlags |= SMTPF_SNDRCHECK_BYPASS;
+#ifdef WITH_SSL
} else if (strcmp(pszName, "EaseTLS") == 0) {
if (pszVal == NULL || atoi(pszVal))
pSMTPS->ulSetupFlags &= ~SMTPF_WANT_TLS;
+#endif
} else if (strcmp(pszName, "EnableVRFY") == 0) {
if (pszVal == NULL || atoi(pszVal))
pSMTPS->ulFlags |= SMTPF_VRFY_ENABLED;
@@ -753,9 +763,11 @@
strcmp(pszName, "MailAuth") == 0) {
if (pszValue == NULL || atoi(pszValue))
pSMTPS->ulSetupFlags |= SMTPF_MAIL_LOCKED;
+#ifdef WITH_SSL
} else if (strcmp(pszName, "WantTLS") == 0) {
if (pszValue == NULL || atoi(pszValue))
pSMTPS->ulSetupFlags |= SMTPF_WANT_TLS;
+#endif
}
return 0;
@@ -790,9 +802,11 @@
SMTPS.ulMaxMsgSize = 0;
break;
+#ifdef WITH_SSL
case 'S':
SMTPS.ulFlags |= SMTPF_EASE_TLS;
break;
+#endif
}
}
@@ -1047,8 +1061,10 @@
iError = SMTPHandleCmd_HELO(pszCommand, hBSock, SMTPS);
else if (StrCmdMatch(pszCommand, "EHLO"))
iError = SMTPHandleCmd_EHLO(pszCommand, hBSock, SMTPS);
+#ifdef WITH_SSL
else if (StrCmdMatch(pszCommand, "STARTTLS"))
iError = SMTPHandleCmd_STARTTLS(pszCommand, hBSock, SMTPS);
+#endif
else if (StrCmdMatch(pszCommand, "AUTH"))
iError = SMTPHandleCmd_AUTH(pszCommand, hBSock, SMTPS);
else if (StrCmdMatch(pszCommand, "RSET"))
@@ -1225,6 +1241,7 @@
ErrSetErrorCode(ERR_SMTP_BAD_CMD_SEQUENCE);
return ERR_SMTP_BAD_CMD_SEQUENCE;
}
+#ifdef WITH_SSL
/* Do we need to be in TLS mode for this session? */
if ((SMTPS.ulFlags & SMTPF_WANT_TLS) && !(SMTPS.ulFlags & SMTPF_EASE_TLS) &&
strcmp(BSckBioName(hBSock), BSSL_BIO_NAME) != 0) {
@@ -1235,6 +1252,7 @@
ErrSetErrorCode(ERR_TLS_MODE_REQUIRED);
return ERR_TLS_MODE_REQUIRED;
}
+#endif
/* Split the RETURN PATH */
char **ppszRetDomains = USmtpGetPathStrings(pszCommand);
@@ -2373,7 +2391,11 @@
SysFree(pszDomain);
/* Emit extended SMTP command and internal auths */
+#ifdef WITH_SSL
int iLinkSSL = strcmp(BSckBioName(hBSock), BSSL_BIO_NAME) == 0;
+#else
+ int iLinkSSL = 0;
+#endif
StrDynAdd(&DynS,
"250 VRFY\r\n"
@@ -2389,8 +2411,10 @@
StrDynPrint(&DynS, "250 SIZE %lu\r\n", SMTPS.ulMaxMsgSize);
else
StrDynAdd(&DynS, "250 SIZE\r\n");
+#ifdef WITH_SSL
if (!iLinkSSL && SvrTestConfigFlag("EnableSMTP-TLS", true, SMTPS.hSvrConfig))
StrDynAdd(&DynS, "250 STARTTLS\r\n");
+#endif
/* Send EHLO response file */
if (SMTPSendMultilineResponse(hBSock, SMTPS.pSMTPCfg->iTimeout,
@@ -2411,6 +2435,7 @@
return 0;
}
+#ifdef WITH_SSL
static int SMTPSslEnvCB(void *pPrivate, int iID, void const *pData)
{
SMTPSession *pSMTPS = (SMTPSession *) pPrivate;
@@ -2482,6 +2507,7 @@
return 0;
}
+#endif
static int SMTPAddAuth(char **ppszAuths, int iNumAuths, int *piAuthCnt, char const *pszAuth,
char const *pszNoTLSAuths, int iLinkSSL)
@@ -3168,6 +3194,7 @@
StrSNCpy(szAuthParam, ppszTokens[2]);
StrFreeStrings(ppszTokens);
+#ifdef WITH_SSL
/*
* Check if the client sent an AUTH type that is not allowed in non-TLS
* mode.
@@ -3179,6 +3206,7 @@
ErrSetErrorCode(ERR_UNKNOWN_SMTP_AUTH);
return ERR_UNKNOWN_SMTP_AUTH;
}
+#endif
/* Handle authentication methods */
if (stricmp(szAuthType, "PLAIN") == 0) {
@@ -3256,9 +3284,11 @@
{
char const *pszSTLS = "";
+#ifdef WITH_SSL
if (strcmp(BSckBioName(hBSock), BSSL_BIO_NAME) != 0 &&
SvrTestConfigFlag("EnableSMTP-TLS", true, SMTPS.hSvrConfig))
pszSTLS = " STARTTLS";
+#endif
BSckVSendString(hBSock, SMTPS.pSMTPCfg->iTimeout,
"250-HELO EHLO MAIL RCPT DATA AUTH%s\r\n"
--- POP3Svr.cpp.orig 2009-12-16 22:37:57.000000000 +0100
+++ POP3Svr.cpp 2009-12-16 22:16:46.000000000 +0100
@@ -26,12 +26,16 @@
#include "ShBlocks.h"
#include "SList.h"
#include "BuffSock.h"
+#ifdef WITH_SSL
#include "SSLBind.h"
+#endif
#include "ResLocks.h"
#include "MiscUtils.h"
#include "StrUtils.h"
#include "MD5.h"
+#ifdef WITH_SSL
#include "SSLConfig.h"
+#endif
#include "SvrUtils.h"
#include "UsrUtils.h"
#include "UsrAuth.h"
@@ -86,8 +90,10 @@
static int POP3HandleCmd_PASS(const char *pszCommand, BSOCK_HANDLE hBSock, POP3Session &POP3S);
static int POP3HandleCmd_APOP(const char *pszCommand, BSOCK_HANDLE hBSock, POP3Session &POP3S);
static int POP3HandleCmd_CAPA(const char *pszCommand, BSOCK_HANDLE hBSock, POP3Session &POP3S);
+#ifdef WITH_SSL
static int POP3SslEnvCB(void *pPrivate, int iID, void const *pData);
static int POP3HandleCmd_STLS(const char *pszCommand, BSOCK_HANDLE hBSock, POP3Session &POP3S);
+#endif
static int POP3HandleCmd_STAT(const char *pszCommand, BSOCK_HANDLE hBSock, POP3Session &POP3S);
static int POP3HandleCmd_LIST(const char *pszCommand, BSOCK_HANDLE hBSock, POP3Session &POP3S);
static int POP3HandleCmd_UIDL(const char *pszCommand, BSOCK_HANDLE hBSock, POP3Session &POP3S);
@@ -188,6 +194,7 @@
return ErrorPop();
}
+#ifdef WITH_SSL
/*
* Do we need to switch to TLS?
*/
@@ -220,6 +227,7 @@
SysFree(SslE.pszIssuer);
SysFree(SslE.pszSubject);
}
+#endif
/* Check IP permission */
if (POP3CheckPeerIP(pThCtx->SockFD) < 0) {
@@ -449,8 +457,10 @@
iCmdResult = POP3HandleCmd_APOP(pszCommand, hBSock, POP3S);
else if (StrCmdMatch(pszCommand, "CAPA"))
iCmdResult = POP3HandleCmd_CAPA(pszCommand, hBSock, POP3S);
+#ifdef WITH_SSL
else if (StrCmdMatch(pszCommand, "STLS"))
iCmdResult = POP3HandleCmd_STLS(pszCommand, hBSock, POP3S);
+#endif
else if (StrCmdMatch(pszCommand, "STAT"))
iCmdResult = POP3HandleCmd_STAT(pszCommand, hBSock, POP3S);
else if (StrCmdMatch(pszCommand, "LIST"))
@@ -711,9 +721,11 @@
{
char const *pszSTLS = "";
+#ifdef WITH_SSL
if (SvrTestConfigFlag("EnablePOP3-TLS", true, POP3S.hSvrConfig) &&
strcmp(BSckBioName(hBSock), BSSL_BIO_NAME) != 0)
pszSTLS = "STLS\r\n";
+#endif
BSckVSendString(hBSock, POP3S.pPOP3Cfg->iTimeout,
"+OK Capability list follows\r\n"
@@ -728,6 +740,7 @@
return 0;
}
+#ifdef WITH_SSL
static int POP3SslEnvCB(void *pPrivate, int iID, void const *pData)
{
POP3Session *pPOP3S = (POP3Session *) pPrivate;
@@ -794,6 +807,7 @@
return 0;
}
+#endif
static int POP3HandleCmd_STAT(const char *pszCommand, BSOCK_HANDLE hBSock, POP3Session &POP3S)
{
--- SMTPUtils.cpp.orig 2009-12-16 22:38:33.000000000 +0100
+++ SMTPUtils.cpp 2009-12-16 22:33:32.000000000 +0100
@@ -28,8 +28,10 @@
#include "StrUtils.h"
#include "SList.h"
#include "BuffSock.h"
+#ifdef WITH_SSL
#include "SSLBind.h"
#include "SSLConfig.h"
+#endif
#include "MailConfig.h"
#include "UsrUtils.h"
#include "UsrAuth.h"
@@ -139,8 +141,10 @@
static int USmtpServerAuthenticate(SmtpChannel *pSmtpCh, char const *pszServer,
SMTPError *pSMTPE);
static int USmtpParseEhloResponse(SmtpChannel *pSmtpCh, char const *pszResponse);
+#ifdef WITH_SSL
static int USmtpSslEnvCB(void *pPrivate, int iID, void const *pData);
static int USmtpSwitchToSSL(SmtpChannel *pSmtpCh, SMTPGateway const *pGw, SMTPError *pSMTPE);
+#endif
static void USmtpCleanEHLO(SmtpChannel *pSmtpCh);
static void USmtpFreeChannel(SmtpChannel *pSmtpCh);
static SMTPGateway *USmtpGetDefaultGateway(SVRCFG_HANDLE hSvrConfig, const char *pszServer);
@@ -195,6 +199,7 @@
{
SMTPGateway *pGw = (SMTPGateway *) pPrivate;
+#ifdef WITH_SSL
if (strcmp(pszName, "NeedTLS") == 0) {
if (pszValue != NULL) {
int iNeedTLS = atoi(pszValue);
@@ -206,6 +211,9 @@
pGw->ulFlags |= SMTP_GWF_FORCE_TLS;
}
} else if (strcmp(pszName, "OutBind") == 0) {
+#else
+ if (strcmp(pszName, "OutBind") == 0) {
+#endif
if (pszValue != NULL) {
SysFree(pGw->pszIFace);
pGw->pszIFace = SysStrDup(pszValue);
@@ -1156,14 +1164,17 @@
if (pszLine[4] == ' ' && isdigit(pszLine[5]))
pSmtpCh->ulMaxMsgSize = (unsigned long) atol(pszLine + 5);
+#ifdef WITH_SSL
} else if (StrCmdMatch(pszLine, "STARTTLS")) {
pSmtpCh->ulFlags |= SMTPCH_SUPPORT_TLS;
+#endif
}
}
return 0;
}
+#ifdef WITH_SSL
static int USmtpSslEnvCB(void *pPrivate, int iID, void const *pData)
{
SslBindEnv *pSslE = (SslBindEnv *) pPrivate;
@@ -1226,6 +1237,7 @@
return iError;
}
+#endif
SMTPCH_HANDLE USmtpCreateChannel(SMTPGateway const *pGw, const char *pszDomain, SMTPError *pSMTPE)
{
@@ -1347,6 +1359,7 @@
return INVALID_SMTPCH_HANDLE;
}
}
+#ifdef WITH_SSL
/*
* Do we need SSL?
*/
@@ -1365,6 +1378,7 @@
goto SendHELO;
}
}
+#endif
/* Check if We need authentication */
if (USmtpServerAuthenticate(pSmtpCh, szAddress, pSMTPE) < 0) {
--- SSLBind.cpp.orig 2009-12-16 22:38:47.000000000 +0100
+++ SSLBind.cpp 2009-12-16 22:34:56.000000000 +0100
@@ -19,6 +19,7 @@
* Davide Libenzi <[email protected]>
*
*/
+#ifdef WITH_SSL
#include "SysInclude.h"
#include "SysDep.h"
@@ -587,4 +588,4 @@
return 0;
}
-
+#endif
--- SSLConfig.cpp.orig 2009-12-16 22:38:53.000000000 +0100
+++ SSLConfig.cpp 2009-12-16 22:35:18.000000000 +0100
@@ -19,6 +19,7 @@
* Davide Libenzi <[email protected]>
*
*/
+#ifdef WITH_SSL
#include "SysInclude.h"
#include "SysDep.h"
@@ -91,4 +92,4 @@
SysFree(pSSLB->pszCAFile);
SysFree(pSSLB->pszCAPath);
}
-
+#endif
_______________________________________________
xmail mailing list
[email protected]
http://xmailserver.org/mailman/listinfo/xmail