--- SMTPSvr.cpp.orig	2010-05-01 08:39:22.000000000 +0200
+++ SMTPSvr.cpp	2010-05-01 08:50:20.000000000 +0200
@@ -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"
@@ -278,9 +282,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;
@@ -492,9 +498,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;
@@ -529,9 +537,11 @@
 			SMTPS.ulMaxMsgSize = 0;
 			break;
 
+#ifdef WITH_SSL
 		case 'S':
 			SMTPS.ulFlags |= SMTPF_EASE_TLS;
 			break;
+#endif
 		}
 	}
 
@@ -977,6 +987,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) {
@@ -987,6 +998,7 @@
 		ErrSetErrorCode(ERR_TLS_MODE_REQUIRED);
 		return ERR_TLS_MODE_REQUIRED;
 	}
+#endif
 
 	/* Split the RETURN PATH */
 	char **ppszRetDomains = USmtpGetPathStrings(pszCommand);
@@ -2253,7 +2265,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"
@@ -2269,8 +2285,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,
@@ -2291,6 +2309,7 @@
 	return 0;
 }
 
+#ifdef WITH_SSL
 static int SMTPSslEnvCB(void *pPrivate, int iID, void const *pData)
 {
 	SMTPSession *pSMTPS = (SMTPSession *) pPrivate;
@@ -2302,7 +2321,9 @@
 
 	return 0;
 }
+#endif
 
+#ifdef WITH_SSL
 static int SMTPHandleCmd_STARTTLS(char const *pszCommand, BSOCK_HANDLE hBSock, SMTPSession &SMTPS)
 {
 
@@ -2362,6 +2383,7 @@
 
 	return 0;
 }
+#endif
 
 static char *SMTPExtAuthMacroLkupProc(void *pPrivate, char const *pszName, int iSize)
 {
@@ -2931,6 +2953,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.
@@ -2942,6 +2965,7 @@
 		ErrSetErrorCode(ERR_UNKNOWN_SMTP_AUTH);
 		return ERR_UNKNOWN_SMTP_AUTH;
 	}
+#endif
 
 	/* Handle authentication methods */
 	if (stricmp(szAuthType, "PLAIN") == 0) {
@@ -3000,9 +3024,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,
 			"214-HELO EHLO MAIL RCPT DATA AUTH%s\r\n"
@@ -3140,8 +3166,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"))
@@ -3235,6 +3263,7 @@
 		return ErrorPop();
 	}
 
+#ifdef WITH_SSL
 	/*
 	 * Do we need to switch to TLS?
 	 */
@@ -3267,6 +3296,7 @@
 		SysFree(SslE.pszIssuer);
 		SysFree(SslE.pszSubject);
 	}
+#endif
 
 	/* Increase threads count */
 	if (SMTPThreadCountAdd(+1, pThCtx->pThCfg->hThShb) < 0) {
