mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-11-07 23:41:59 +01:00
added logging recipients
This commit is contained in:
parent
5b6c2cbb8f
commit
1852d90211
@ -106,6 +106,11 @@ archive_emails_not_having_message_id=0
|
||||
; everything
|
||||
archive_only_mydomains=0
|
||||
|
||||
; whether to syslog the recipients of the email in the following format:
|
||||
; 400000.....xxxxx: rcpt=recipient1@domain.com
|
||||
; 400000.....xxxxx: rcpt=recipient2@domain.com
|
||||
syslog_recipients=0
|
||||
|
||||
; minimum word length in mail body to index
|
||||
min_word_len=1
|
||||
|
||||
|
@ -100,6 +100,7 @@ struct _parse_rule config_parse_rules[] =
|
||||
{ "server_id", "integer", (void*) int_parser, offsetof(struct __config, server_id), "0", sizeof(int)},
|
||||
{ "session_timeout", "integer", (void*) int_parser, offsetof(struct __config, session_timeout), "420", sizeof(int)},
|
||||
{ "spam_header_line", "string", (void*) string_parser, offsetof(struct __config, spam_header_line), "", MAXVAL-1},
|
||||
{ "syslog_recipients", "integer", (void*) int_parser, offsetof(struct __config, syslog_recipients), "0", sizeof(int)},
|
||||
{ "tls_enable", "integer", (void*) int_parser, offsetof(struct __config, tls_enable), "0", sizeof(int)},
|
||||
{ "tweak_sent_time_offset", "integer", (void*) int_parser, offsetof(struct __config, tweak_sent_time_offset), "0", sizeof(int)},
|
||||
{ "update_counters_to_memcached", "integer", (void*) int_parser, offsetof(struct __config, update_counters_to_memcached), "0", sizeof(int)},
|
||||
|
@ -86,6 +86,8 @@ struct __config {
|
||||
|
||||
int enable_cjk;
|
||||
|
||||
int syslog_recipients;
|
||||
|
||||
int debug;
|
||||
};
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
#define VERSION "1.1.0-rc4"
|
||||
|
||||
#define BUILD 883
|
||||
#define BUILD 884
|
||||
|
||||
#define HOSTID "mailarchiver"
|
||||
|
||||
|
@ -21,8 +21,8 @@
|
||||
|
||||
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 virusinfo[SMALLBUFSIZE], delay[SMALLBUFSIZE];
|
||||
char *p, *rcpt, buf[MAXBUFSIZE], puf[MAXBUFSIZE], resp[MAXBUFSIZE], prevbuf[MAXBUFSIZE], last2buf[2*MAXBUFSIZE+1];
|
||||
char virusinfo[SMALLBUFSIZE], delay[SMALLBUFSIZE], tmpbuf[SMALLBUFSIZE];
|
||||
char *arule = NULL;
|
||||
char *status = NULL;
|
||||
struct session_data sdata;
|
||||
@ -161,6 +161,17 @@ int handle_smtp_session(int new_sd, struct __data *data, struct __config *cfg){
|
||||
gettimeofday(&tv2, &tz);
|
||||
sdata.__parsed = tvdiff(tv2, tv1);
|
||||
|
||||
if(cfg->syslog_recipients == 1){
|
||||
rcpt = sstate.b_to;
|
||||
do {
|
||||
rcpt = split_str(rcpt, " ", tmpbuf, sizeof(tmpbuf)-1);
|
||||
|
||||
if(does_it_seem_like_an_email_address(tmpbuf) == 1){
|
||||
syslog(LOG_PRIORITY, "%s: rcpt=%s", sdata.ttmpfile, tmpbuf);
|
||||
}
|
||||
} while(rcpt);
|
||||
}
|
||||
|
||||
if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "%s: parsed message", sdata.ttmpfile);
|
||||
|
||||
if(cfg->archive_only_mydomains == 1 && sdata.internal_sender == 0 && sdata.internal_recipient == 0){
|
||||
|
Loading…
Reference in New Issue
Block a user