mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-11-07 21:51:59 +01:00
auto enabled the starttls code
Signed-off-by: SJ <sj@acts.hu>
This commit is contained in:
parent
c2e7a94b4e
commit
f70a69679d
21
configure
vendored
21
configure
vendored
@ -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"
|
||||
|
||||
|
10
configure.in
10
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])
|
||||
|
@ -24,7 +24,6 @@
|
||||
#undef HAVE_TNEF
|
||||
#undef HAVE_ZIP
|
||||
|
||||
#undef HAVE_STARTTLS
|
||||
#undef HAVE_LIBWRAP
|
||||
|
||||
#undef HAVE_TWEAK_SENT_TIME
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#define VERSION "1.2.0-master"
|
||||
|
||||
#define BUILD 943
|
||||
#define BUILD 944
|
||||
|
||||
#define HOSTID "mailarchiver"
|
||||
|
||||
|
@ -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");
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user