mirror of
https://bitbucket.org/jsuto/piler.git
synced 2025-06-13 12:57:04 +02:00
added a tweak option to change the sent time piler stores
This commit is contained in:
@ -95,6 +95,7 @@ struct _parse_rule config_parse_rules[] =
|
||||
{ "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},
|
||||
{ "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)},
|
||||
{ "username", "string", (void*) string_parser, offsetof(struct __config, username), "piler", MAXVAL-1},
|
||||
{ "use_antivirus", "integer", (void*) int_parser, offsetof(struct __config, use_antivirus), "1", sizeof(int)},
|
||||
|
@ -72,6 +72,8 @@ struct __config {
|
||||
|
||||
int min_word_len;
|
||||
|
||||
int tweak_sent_time_offset;
|
||||
|
||||
int debug;
|
||||
};
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#define VERSION "0.1.23-master-branch"
|
||||
|
||||
#define BUILD 768
|
||||
#define BUILD 769
|
||||
|
||||
#define HOSTID "mailarchiver"
|
||||
|
||||
|
@ -26,7 +26,7 @@ int import_message(char *filename, struct session_data *sdata, struct __data *da
|
||||
struct __counters counters;
|
||||
|
||||
|
||||
init_session_data(sdata, cfg->server_id);
|
||||
init_session_data(sdata, cfg);
|
||||
|
||||
if(cfg->verbosity > 1) printf("processing: %s\n", filename);
|
||||
|
||||
@ -109,6 +109,7 @@ ENDE:
|
||||
|
||||
case ERR_EXISTS:
|
||||
rc = OK;
|
||||
printf("duplicate: %s (id: %s)\n", filename, sdata->ttmpfile);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -449,13 +449,13 @@ int is_email_address_on_my_domains(char *email, struct __data *data){
|
||||
}
|
||||
|
||||
|
||||
void init_session_data(struct session_data *sdata, unsigned char server_id){
|
||||
void init_session_data(struct session_data *sdata, struct __config *cfg){
|
||||
int i;
|
||||
|
||||
|
||||
sdata->fd = -1;
|
||||
|
||||
create_id(&(sdata->ttmpfile[0]), server_id);
|
||||
create_id(&(sdata->ttmpfile[0]), cfg->server_id);
|
||||
unlink(sdata->ttmpfile);
|
||||
|
||||
snprintf(sdata->filename, SMALLBUFSIZE-1, "%s", sdata->ttmpfile);
|
||||
@ -496,6 +496,10 @@ void init_session_data(struct session_data *sdata, unsigned char server_id){
|
||||
|
||||
time(&(sdata->now));
|
||||
sdata->sent = sdata->delivered = sdata->retained = sdata->now;
|
||||
|
||||
#ifdef HAVE_TWEAK_SENT_TIME
|
||||
sdata->sent += cfg->tweak_sent_time_offset;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -35,7 +35,7 @@ void write_pid_file(char *pidfile);
|
||||
int drop_privileges(struct passwd *pwd);
|
||||
|
||||
int is_email_address_on_my_domains(char *email, struct __data *data);
|
||||
void init_session_data(struct session_data *sdata, unsigned char server_id);
|
||||
void init_session_data(struct session_data *sdata, struct __config *cfg);
|
||||
int read_from_stdin(struct session_data *sdata);
|
||||
void strtolower(char *s);
|
||||
|
||||
|
@ -401,7 +401,7 @@ int main(int argc, char **argv){
|
||||
if(read_key(&cfg)) p_clean_exit(ERR_READING_KEY, 1);
|
||||
|
||||
|
||||
init_session_data(&sdata, cfg.server_id);
|
||||
init_session_data(&sdata, &cfg);
|
||||
|
||||
|
||||
mysql_init(&(sdata.mysql));
|
||||
|
@ -348,7 +348,7 @@ int main(int argc, char **argv){
|
||||
|
||||
setlocale(LC_CTYPE, cfg.locale);
|
||||
|
||||
init_session_data(&sdata, cfg.server_id);
|
||||
init_session_data(&sdata, &cfg);
|
||||
|
||||
i = is_purge_allowed(&sdata, &cfg);
|
||||
if(i == 1){
|
||||
|
@ -212,7 +212,7 @@ int main(int argc, char **argv){
|
||||
}
|
||||
}
|
||||
|
||||
init_session_data(&sdata, cfg.server_id);
|
||||
init_session_data(&sdata, &cfg);
|
||||
|
||||
|
||||
mysql_init(&(sdata.mysql));
|
||||
|
@ -54,7 +54,7 @@ int handle_smtp_session(int new_sd, struct __data *data, struct __config *cfg){
|
||||
|
||||
state = SMTP_STATE_INIT;
|
||||
|
||||
init_session_data(&sdata, cfg->server_id);
|
||||
init_session_data(&sdata, cfg);
|
||||
sdata.tls = 0;
|
||||
|
||||
bzero(&counters, sizeof(counters));
|
||||
@ -383,7 +383,7 @@ AFTER_PERIOD:
|
||||
unlink(sdata.ttmpfile);
|
||||
unlink(sdata.tmpframe);
|
||||
|
||||
init_session_data(&sdata, cfg->server_id);
|
||||
init_session_data(&sdata, cfg);
|
||||
}
|
||||
|
||||
state = SMTP_STATE_MAIL_FROM;
|
||||
@ -489,7 +489,7 @@ AFTER_PERIOD:
|
||||
unlink(sdata.ttmpfile);
|
||||
unlink(sdata.tmpframe);
|
||||
|
||||
init_session_data(&sdata, cfg->server_id);
|
||||
init_session_data(&sdata, cfg);
|
||||
|
||||
state = SMTP_STATE_HELO;
|
||||
|
||||
|
@ -62,7 +62,7 @@ int main(int argc, char **argv){
|
||||
|
||||
load_mydomains(&sdata, &data, &cfg);
|
||||
|
||||
init_session_data(&sdata, cfg.server_id);
|
||||
init_session_data(&sdata, &cfg);
|
||||
|
||||
sdata.sent = 0;
|
||||
sdata.delivered = 0;
|
||||
|
Reference in New Issue
Block a user