mirror of
https://bitbucket.org/jsuto/piler.git
synced 2025-06-12 23:17:02 +02:00
@ -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
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user