From f70a69679d422bd7bd27e1d020f9129f8dea8065 Mon Sep 17 00:00:00 2001 From: SJ Date: Sat, 7 May 2016 11:29:40 +0200 Subject: [PATCH] auto enabled the starttls code Signed-off-by: SJ --- configure | 21 --------------------- configure.in | 10 ---------- piler-config.h.in | 1 - src/config.h | 2 +- src/piler.c | 6 ------ src/session.c | 6 ------ src/smtp.c | 6 ------ 7 files changed, 1 insertion(+), 51 deletions(-) diff --git a/configure b/configure index fc0592a7..b6bac1af 100755 --- a/configure +++ b/configure @@ -699,7 +699,6 @@ enable_static_build enable_compat_layout enable_clamd enable_memcached -enable_starttls enable_tcpwrappers enable_tweak_sent_time with_database @@ -1325,7 +1324,6 @@ Optional Features: --enable-compat-layout support for older storage layout (default: no) --enable-clamd build clamd antivirus support --enable-memcached build memcached support - --enable-starttls build starttls support --enable-tcpwrappers build tcpwrappers support --tweak-sent-time tweak sent time @@ -3445,7 +3443,6 @@ have_psql="no" have_tre="no" have_zip="no" have_zlib="no" -have_starttls="no" have_tcpwrappers="no" have_tweak_sent_time="no" @@ -3537,15 +3534,6 @@ fi -# Check whether --enable-starttls was given. -if test "${enable_starttls+set}" = set; then : - enableval=$enable_starttls; have_starttls=$enableval -else - have_starttls="no" -fi - - - # Check whether --enable-tcpwrappers was given. if test "${enable_tcpwrappers+set}" = set; then : enableval=$enable_tcpwrappers; want_tcpwrappers=$enableval @@ -4738,15 +4726,6 @@ _ACEOF antispam_libs="$antispam_libs -lzip" fi -if test "$have_starttls" = "yes"; then - echo "starttls support: yes" - -cat >>confdefs.h <<_ACEOF -#define HAVE_STARTTLS 1 -_ACEOF - -fi - if test "$have_tcpwrappers" = "yes"; then echo "tcpwrappers support: yes" diff --git a/configure.in b/configure.in index cbe3ae08..cc8a5d40 100644 --- a/configure.in +++ b/configure.in @@ -41,7 +41,6 @@ have_psql="no" have_tre="no" have_zip="no" have_zlib="no" -have_starttls="no" have_tcpwrappers="no" have_tweak_sent_time="no" @@ -116,10 +115,6 @@ AC_ARG_ENABLE(memcached, [ --enable-memcached build memcached support], want_memcached=$enableval, want_memcached="no") -AC_ARG_ENABLE(starttls, - [ --enable-starttls build starttls support], have_starttls=$enableval, have_starttls="no") - - AC_ARG_ENABLE(tcpwrappers, [ --enable-tcpwrappers build tcpwrappers support], want_tcpwrappers=$enableval, want_tcpwrappers="no") @@ -445,11 +440,6 @@ if test "$have_zip" = "yes"; then antispam_libs="$antispam_libs -lzip" fi -if test "$have_starttls" = "yes"; then - echo "starttls support: yes" - AC_DEFINE_UNQUOTED(HAVE_STARTTLS, 1, [starttls support]) -fi - if test "$have_tcpwrappers" = "yes"; then echo "tcpwrappers support: yes" AC_DEFINE_UNQUOTED(HAVE_LIBWRAP, 1, [tcpwrappers support]) diff --git a/piler-config.h.in b/piler-config.h.in index 694f4e6b..feb78ea2 100644 --- a/piler-config.h.in +++ b/piler-config.h.in @@ -24,7 +24,6 @@ #undef HAVE_TNEF #undef HAVE_ZIP -#undef HAVE_STARTTLS #undef HAVE_LIBWRAP #undef HAVE_TWEAK_SENT_TIME diff --git a/src/config.h b/src/config.h index 8665832a..762538f6 100644 --- a/src/config.h +++ b/src/config.h @@ -13,7 +13,7 @@ #define VERSION "1.2.0-master" -#define BUILD 943 +#define BUILD 944 #define HOSTID "mailarchiver" diff --git a/src/piler.c b/src/piler.c index 5acf9dea..7caf7ee4 100644 --- a/src/piler.c +++ b/src/piler.c @@ -244,11 +244,9 @@ void p_clean_exit(){ if(data.dedup != MAP_FAILED) munmap(data.dedup, MAXCHILDREN*DIGEST_LENGTH*2); -#ifdef HAVE_STARTTLS if(data.ctx) SSL_CTX_free(data.ctx); ERR_free_strings(); -#endif exit(1); } @@ -260,7 +258,6 @@ void fatal(char *s){ } -#ifdef HAVE_STARTTLS int init_ssl(){ SSL_library_init(); @@ -278,7 +275,6 @@ int init_ssl(){ return OK; } -#endif void initialise_configuration(){ @@ -323,11 +319,9 @@ void initialise_configuration(){ initrules(data.retention_rules); initrules(data.folder_rules); -#ifdef HAVE_STARTTLS if(cfg.tls_enable > 0 && data.ctx == NULL && init_ssl() == OK){ snprintf(data.starttls, sizeof(data.starttls)-1, "250-STARTTLS\r\n"); } -#endif if(open_database(&sdata, &cfg) == ERR){ syslog(LOG_PRIORITY, "cannot connect to mysql server"); diff --git a/src/session.c b/src/session.c index 259d1d55..504b7df5 100644 --- a/src/session.c +++ b/src/session.c @@ -37,9 +37,7 @@ int handle_smtp_session(int new_sd, struct __data *data, struct __config *cfg){ struct timezone tz; struct timeval tv1, tv2; -#ifdef HAVE_STARTTLS int starttls = 0; -#endif #ifdef HAVE_LIBWRAP @@ -365,12 +363,10 @@ AFTER_PERIOD: } - #ifdef HAVE_STARTTLS if(cfg->tls_enable > 0 && strncasecmp(buf, SMTP_CMD_STARTTLS, strlen(SMTP_CMD_STARTTLS)) == 0 && strlen(data->starttls) > 4 && sdata.tls == 0){ process_command_starttls(&sdata, data, &protocol_state, &starttls, new_sd, &resp[0], sizeof(resp)-1, cfg); continue; } - #endif if(strncasecmp(buf, SMTP_CMD_MAIL_FROM, strlen(SMTP_CMD_MAIL_FROM)) == 0){ @@ -465,12 +461,10 @@ QUITTING: close_database(&sdata); #endif -#ifdef HAVE_STARTTLS if(sdata.tls == 1){ SSL_shutdown(data->ssl); SSL_free(data->ssl); } -#endif if(cfg->verbosity >= _LOG_INFO) syslog(LOG_PRIORITY, "processed %llu messages", counters.c_rcvd); diff --git a/src/smtp.c b/src/smtp.c index 8e1c121f..636dd443 100644 --- a/src/smtp.c +++ b/src/smtp.c @@ -32,7 +32,6 @@ void process_command_ehlo_lhlo(struct session_data *sdata, struct __data *data, } -#ifdef HAVE_STARTTLS void process_command_starttls(struct session_data *sdata, struct __data *data, int *protocol_state, int *starttls, int new_sd, char *resp, int resplen, struct __config *cfg){ if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "%s: starttls request from client", sdata->ttmpfile); @@ -54,7 +53,6 @@ void process_command_starttls(struct session_data *sdata, struct __data *data, i strncat(resp, SMTP_RESP_454_ERR_TLS_TEMP_ERROR, resplen); } -#endif void process_command_mail_from(struct session_data *sdata, int *protocol_state, char *buf, char *resp, int resplen, struct __config *cfg){ @@ -163,16 +161,13 @@ void process_command_reset(struct session_data *sdata, int *protocol_state, char void send_buffered_response(struct session_data *sdata, struct __data *data, int starttls, int new_sd, char *resp, struct __config *cfg){ int rc; -#ifdef HAVE_STARTTLS char ssl_error[SMALLBUFSIZE]; -#endif write1(new_sd, resp, strlen(resp), sdata->tls, data->ssl); if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "%s: sent: %s", sdata->ttmpfile, resp); memset(resp, 0, MAXBUFSIZE); -#ifdef HAVE_STARTTLS if(starttls == 1 && sdata->tls == 0){ if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "%s: waiting for ssl handshake", sdata->ttmpfile); @@ -189,7 +184,6 @@ void send_buffered_response(struct session_data *sdata, struct __data *data, int syslog(LOG_PRIORITY, "%s: SSL_accept() failed, rc=%d, errorcode: %d, error text: %s\n", sdata->ttmpfile, rc, SSL_get_error(data->ssl, rc), ssl_error); } } -#endif }