mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-25 06:50:12 +01:00
fixed the from= logged field in case of null sender
This commit is contained in:
parent
e3f1134f04
commit
0c20a5f1e1
@ -10,7 +10,7 @@
|
||||
#include <piler.h>
|
||||
|
||||
|
||||
int do_av_check(struct session_data *sdata, char *rcpttoemail, char *fromemail, char *virusinfo, struct __data *data, struct __config *cfg){
|
||||
int do_av_check(struct session_data *sdata, char *rcpttoemail, char *virusinfo, struct __data *data, struct __config *cfg){
|
||||
int rav = AVIR_OK;
|
||||
char avengine[SMALLBUFSIZE];
|
||||
|
||||
|
@ -169,6 +169,7 @@ struct session_data {
|
||||
char filename[SMALLBUFSIZE];
|
||||
char ttmpfile[SMALLBUFSIZE], tmpframe[SMALLBUFSIZE], tre, restored_copy;
|
||||
char mailfrom[SMALLBUFSIZE], rcptto[MAX_RCPT_TO][SMALLBUFSIZE], client_addr[SMALLBUFSIZE];
|
||||
char fromemail[SMALLBUFSIZE];
|
||||
char acceptbuf[SMALLBUFSIZE];
|
||||
char attachments[SMALLBUFSIZE];
|
||||
char internal_sender, internal_recipient, external_recipient;
|
||||
|
@ -395,6 +395,8 @@ void init_session_data(struct session_data *sdata){
|
||||
|
||||
memset(sdata->attachments, 0, SMALLBUFSIZE);
|
||||
|
||||
memset(sdata->fromemail, 0, SMALLBUFSIZE);
|
||||
|
||||
sdata->restored_copy = 0;
|
||||
|
||||
sdata->internal_sender = sdata->internal_recipient = sdata->external_recipient = 0;
|
||||
|
@ -593,9 +593,10 @@ int parse_line(char *buf, struct _state *state, struct session_data *sdata, int
|
||||
q = strchr(puf, '@');
|
||||
if(q){
|
||||
memcpy(&(state->b_from_domain[strlen(state->b_from_domain)]), q+1, len);
|
||||
/*if(strstr(sdata->mailfrom, "<>")){
|
||||
|
||||
}*/
|
||||
if(strstr(sdata->mailfrom, "<>")){
|
||||
snprintf(sdata->fromemail, SMALLBUFSIZE-1, "%s", puf);
|
||||
sdata->fromemail[len-1] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
if(is_email_address_on_my_domains(puf, cfg) == 1) sdata->internal_sender = 1;
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
int read_key(struct __config *cfg);
|
||||
|
||||
int do_av_check(struct session_data *sdata, char *rcpttoemail, char *fromemail, char *virusinfo, struct __data *data, struct __config *cfg);
|
||||
int do_av_check(struct session_data *sdata, char *rcpttoemail, char *virusinfo, struct __data *data, struct __config *cfg);
|
||||
|
||||
int make_digests(struct session_data *sdata, struct __config *cfg);
|
||||
void digest_file(char *filename, char *digest);
|
||||
@ -59,5 +59,7 @@ int store_index_data(struct session_data *sdata, struct _state *state, struct __
|
||||
|
||||
void extract_attachment_content(struct session_data *sdata, struct _state *state, char *filename, char *type, int *rec);
|
||||
|
||||
int retrieve_file_from_archive(char *filename, int mode, char **buffer, FILE *dest, struct __config *cfg);
|
||||
|
||||
#endif /* _PILER_H */
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
int handle_smtp_session(int new_sd, struct __data *data, struct __config *cfg){
|
||||
int i, ret, pos, n, inj=ERR, state, prevlen=0;
|
||||
char *p, buf[MAXBUFSIZE], puf[MAXBUFSIZE], resp[MAXBUFSIZE], prevbuf[MAXBUFSIZE], last2buf[2*MAXBUFSIZE+1];
|
||||
char rctptoemail[SMALLBUFSIZE], fromemail[SMALLBUFSIZE], virusinfo[SMALLBUFSIZE], delay[SMALLBUFSIZE];
|
||||
char rctptoemail[SMALLBUFSIZE], virusinfo[SMALLBUFSIZE], delay[SMALLBUFSIZE];
|
||||
char *arule = NULL;
|
||||
struct session_data sdata;
|
||||
struct _state sstate;
|
||||
@ -148,7 +148,7 @@ int handle_smtp_session(int new_sd, struct __data *data, struct __config *cfg){
|
||||
#ifdef HAVE_ANTIVIRUS
|
||||
if(cfg->use_antivirus == 1){
|
||||
gettimeofday(&tv1, &tz);
|
||||
sdata.rav = do_av_check(&sdata, rctptoemail, fromemail, &virusinfo[0], data, cfg);
|
||||
sdata.rav = do_av_check(&sdata, rctptoemail, &virusinfo[0], data, cfg);
|
||||
gettimeofday(&tv2, &tz);
|
||||
sdata.__av = tvdiff(tv2, tv1);
|
||||
}
|
||||
@ -228,7 +228,7 @@ int handle_smtp_session(int new_sd, struct __data *data, struct __config *cfg){
|
||||
(sdata.__acquire+sdata.__parsed+sdata.__av+sdata.__compress+sdata.__encrypt+sdata.__store)/1000000.0,
|
||||
sdata.__acquire/1000000.0, sdata.__parsed/1000000.0, sdata.__av/1000000.0, sdata.__compress/1000000.0, sdata.__encrypt/1000000.0, sdata.__store/1000000.0);
|
||||
|
||||
syslog(LOG_PRIORITY, "%s: from=%s, size=%d, reference=%s, message-id=%s, %s", sdata.ttmpfile, fromemail, sdata.tot_len, sstate.reference, sstate.message_id, delay);
|
||||
syslog(LOG_PRIORITY, "%s: from=%s, size=%d, reference=%s, message-id=%s, %s", sdata.ttmpfile, sdata.fromemail, sdata.tot_len, sstate.reference, sstate.message_id, delay);
|
||||
|
||||
|
||||
|
||||
@ -317,8 +317,8 @@ AFTER_PERIOD:
|
||||
|
||||
snprintf(sdata.mailfrom, SMALLBUFSIZE-1, "%s\r\n", buf);
|
||||
|
||||
memset(fromemail, 0, SMALLBUFSIZE);
|
||||
extractEmail(sdata.mailfrom, fromemail);
|
||||
memset(sdata.fromemail, 0, SMALLBUFSIZE);
|
||||
extractEmail(sdata.mailfrom, sdata.fromemail);
|
||||
|
||||
strncat(resp, SMTP_RESP_250_OK, strlen(SMTP_RESP_250_OK));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user