mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-24 19:10:13 +01:00
verp fix
This commit is contained in:
parent
39a2e6a306
commit
d79b1f97c7
@ -10,7 +10,7 @@
|
||||
#include <piler.h>
|
||||
|
||||
|
||||
int do_av_check(struct session_data *sdata, char *rcpttoemail, char *virusinfo, struct __data *data, struct __config *cfg){
|
||||
int do_av_check(struct session_data *sdata, char *virusinfo, struct __data *data, struct __config *cfg){
|
||||
int rav = AVIR_OK;
|
||||
char avengine[SMALLBUFSIZE];
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
#define VERSION "0.1.25-rc3"
|
||||
|
||||
#define BUILD 877
|
||||
#define BUILD 878
|
||||
|
||||
#define HOSTID "mailarchiver"
|
||||
|
||||
|
@ -28,6 +28,11 @@ int import_message(char *filename, struct session_data *sdata, struct __data *da
|
||||
|
||||
init_session_data(sdata, cfg);
|
||||
|
||||
if(data->import->extra_recipient){
|
||||
snprintf(sdata->rcptto[0], SMALLBUFSIZE-1, "%s", data->import->extra_recipient);
|
||||
sdata->num_of_rcpt_to = 1;
|
||||
}
|
||||
|
||||
if(cfg->verbosity > 1) printf("processing: %s\n", filename);
|
||||
|
||||
if(strcmp(filename, "-") == 0){
|
||||
|
@ -211,6 +211,7 @@ int extractEmail(char *rawmail, char *email){
|
||||
*p = '\0';
|
||||
*q2 = '@';
|
||||
snprintf(email, SMALLBUFSIZE-1, "%s", q1+1);
|
||||
*p = '@';
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
53
src/parser.c
53
src/parser.c
@ -32,56 +32,35 @@ struct _state parse_message(struct session_data *sdata, int take_into_pieces, st
|
||||
}
|
||||
|
||||
|
||||
if(sdata->import == 1 && data->import->extra_recipient){
|
||||
len = strlen(data->import->extra_recipient);
|
||||
|
||||
addnode(state.journal_recipient, data->import->extra_recipient);
|
||||
|
||||
memcpy(&(state.b_journal_to[state.journaltolen]), data->import->extra_recipient, len);
|
||||
state.journaltolen += len;
|
||||
memcpy(&(state.b_journal_to[state.journaltolen]), " ", 1);
|
||||
state.journaltolen++;
|
||||
strtolower(state.b_journal_to);
|
||||
|
||||
memcpy(&(state.b_to[state.tolen]), data->import->extra_recipient, len);
|
||||
state.tolen += len;
|
||||
memcpy(&(state.b_to[state.tolen]), " ", 1);
|
||||
state.tolen++;
|
||||
strtolower(state.b_to);
|
||||
}
|
||||
|
||||
|
||||
if(sdata->num_of_rcpt_to > 0){
|
||||
for(i=0; i<sdata->num_of_rcpt_to; i++){
|
||||
extractEmail(sdata->rcptto[i], puf);
|
||||
|
||||
if(strlen(puf) > 5){
|
||||
snprintf(puf, sizeof(puf)-1, "%s ", sdata->rcptto[i]);
|
||||
|
||||
if(does_it_seem_like_an_email_address(puf) == 1){
|
||||
p = strstr(puf, cfg->hostid);
|
||||
if(p && *(p-1) == '.'){
|
||||
|
||||
*(p-1) = ' ';
|
||||
*p = '\0';
|
||||
if(!p){
|
||||
|
||||
strtolower(puf);
|
||||
len = strlen(puf);
|
||||
|
||||
if(does_it_seem_like_an_email_address(puf) == 1){
|
||||
if(state.tolen < MAXBUFSIZE-len-1){
|
||||
|
||||
if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "%s: processing rcpt to address: *%s*", sdata->ttmpfile, puf);
|
||||
if(findnode(state.rcpt, puf) == NULL){
|
||||
addnode(state.journal_recipient, puf);
|
||||
|
||||
if(state.tolen < MAXBUFSIZE-len-1){
|
||||
if(findnode(state.rcpt, puf) == NULL){
|
||||
addnode(state.rcpt, puf);
|
||||
memcpy(&(state.b_journal_to[state.journaltolen]), puf, len);
|
||||
state.journaltolen += len;
|
||||
|
||||
memcpy(&(state.b_to[state.tolen]), puf, len);
|
||||
state.tolen += len;
|
||||
|
||||
if(state.tolen < MAXBUFSIZE-len-1){
|
||||
split_email_address(puf);
|
||||
memcpy(&(state.b_to[state.tolen]), puf, len);
|
||||
state.tolen += len;
|
||||
|
||||
if(state.tolen < MAXBUFSIZE-len-1){
|
||||
split_email_address(puf);
|
||||
memcpy(&(state.b_to[state.tolen]), puf, len);
|
||||
state.tolen += len;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
int read_key(struct __config *cfg);
|
||||
void insert_offset(struct session_data *sdata, int server_id);
|
||||
|
||||
int do_av_check(struct session_data *sdata, char *rcpttoemail, char *virusinfo, struct __data *data, struct __config *cfg);
|
||||
int do_av_check(struct session_data *sdata, 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);
|
||||
|
@ -22,7 +22,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 rcpttoemail[SMALLBUFSIZE], virusinfo[SMALLBUFSIZE], delay[SMALLBUFSIZE];
|
||||
char virusinfo[SMALLBUFSIZE], delay[SMALLBUFSIZE];
|
||||
char *arule = NULL;
|
||||
char *status = NULL;
|
||||
struct session_data sdata;
|
||||
@ -167,7 +167,7 @@ int handle_smtp_session(int new_sd, struct __data *data, struct __config *cfg){
|
||||
remove_stripped_attachments(&sstate);
|
||||
inj = ERR_MYDOMAINS;
|
||||
|
||||
snprintf(sdata.acceptbuf, SMALLBUFSIZE-1, "250 Ok %s <%s>\r\n", sdata.ttmpfile, rcpttoemail);
|
||||
snprintf(sdata.acceptbuf, SMALLBUFSIZE-1, "250 Ok %s\r\n", sdata.ttmpfile);
|
||||
write1(new_sd, sdata.acceptbuf, strlen(sdata.acceptbuf), sdata.tls, data->ssl);
|
||||
|
||||
syslog(LOG_PRIORITY, "%s: discarding: not on mydomains, from=%s, message-id=%s", sdata.ttmpfile, sdata.fromemail, sstate.message_id);
|
||||
@ -182,7 +182,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, rcpttoemail, &virusinfo[0], data, cfg);
|
||||
sdata.rav = do_av_check(&sdata, &virusinfo[0], data, cfg);
|
||||
gettimeofday(&tv2, &tz);
|
||||
sdata.__av = tvdiff(tv2, tv1);
|
||||
}
|
||||
@ -197,8 +197,6 @@ int handle_smtp_session(int new_sd, struct __data *data, struct __config *cfg){
|
||||
#endif
|
||||
if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "%s: round %d in injection", sdata.ttmpfile, i);
|
||||
|
||||
extractEmail(sdata.rcptto[i], rcpttoemail);
|
||||
|
||||
inj = ERR;
|
||||
status = S_STATUS_UNDEF;
|
||||
|
||||
@ -249,10 +247,10 @@ int handle_smtp_session(int new_sd, struct __data *data, struct __config *cfg){
|
||||
|
||||
/* set the accept buffer */
|
||||
|
||||
snprintf(sdata.acceptbuf, SMALLBUFSIZE-1, "250 Ok %s <%s>\r\n", sdata.ttmpfile, rcpttoemail);
|
||||
snprintf(sdata.acceptbuf, SMALLBUFSIZE-1, "250 Ok %s <%s>\r\n", sdata.ttmpfile, sdata.rcptto[i]);
|
||||
|
||||
if(inj == ERR){
|
||||
snprintf(sdata.acceptbuf, SMALLBUFSIZE-1, "451 %s <%s>\r\n", sdata.ttmpfile, rcpttoemail);
|
||||
snprintf(sdata.acceptbuf, SMALLBUFSIZE-1, "451 %s <%s>\r\n", sdata.ttmpfile, sdata.rcptto[i]);
|
||||
status = S_STATUS_ERROR;
|
||||
}
|
||||
|
||||
@ -418,13 +416,11 @@ AFTER_PERIOD:
|
||||
}
|
||||
|
||||
if(sdata.num_of_rcpt_to < MAX_RCPT_TO-1){
|
||||
snprintf(sdata.rcptto[sdata.num_of_rcpt_to], SMALLBUFSIZE-1, "%s\r\n", buf);
|
||||
extractEmail(buf, sdata.rcptto[sdata.num_of_rcpt_to]);
|
||||
}
|
||||
|
||||
state = SMTP_STATE_RCPT_TO;
|
||||
|
||||
extractEmail(buf, rcpttoemail);
|
||||
|
||||
if(sdata.num_of_rcpt_to < MAX_RCPT_TO-1) sdata.num_of_rcpt_to++;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user