skip storing rcpt address matching the cfg.hostid

This commit is contained in:
SJ 2013-10-29 16:05:35 +01:00
parent 20b6eb7143
commit b8d10ea9e5
4 changed files with 13 additions and 3 deletions

View File

@ -185,6 +185,8 @@ struct __config read_config(char *configfile){
if(parse_config_file(configfile, &cfg, config_parse_rules) == -1) printf("error parsing the configfile: %s\n", configfile); if(parse_config_file(configfile, &cfg, config_parse_rules) == -1) printf("error parsing the configfile: %s\n", configfile);
cfg.hostid_len = strlen(cfg.hostid);
return cfg; return cfg;
} }

View File

@ -12,6 +12,8 @@ struct __config {
char username[MAXVAL]; char username[MAXVAL];
char hostid[MAXVAL]; char hostid[MAXVAL];
int hostid_len;
char pidfile[MAXVAL]; char pidfile[MAXVAL];
char pilergetd_pidfile[MAXVAL]; char pilergetd_pidfile[MAXVAL];

View File

@ -14,7 +14,7 @@
#define VERSION "0.1.25-master-branch" #define VERSION "0.1.25-master-branch"
#define BUILD 846 #define BUILD 847
#define HOSTID "mailarchiver" #define HOSTID "mailarchiver"

View File

@ -636,12 +636,18 @@ int parse_line(char *buf, struct _state *state, struct session_data *sdata, int
if(state->message_state == MSG_RECIPIENT && findnode(state->journal_recipient, puf) == NULL){ if(state->message_state == MSG_RECIPIENT && findnode(state->journal_recipient, puf) == NULL){
addnode(state->journal_recipient, puf); addnode(state->journal_recipient, puf);
memcpy(&(state->b_journal_to[state->journaltolen]), puf, len); memcpy(&(state->b_journal_to[state->journaltolen]), puf, len);
memcpy(&(state->b_journal_to[state->journaltolen]), puf, len);
if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "%s: journal rcpt: '%s'", sdata->ttmpfile, puf); if(cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "%s: journal rcpt: '%s'", sdata->ttmpfile, puf);
} }
if(findnode(state->rcpt, puf) == NULL){ if(findnode(state->rcpt, puf) == NULL){
/* skip any address matching ...@cfg->hostid, 2013.10.29, SJ */
q = strchr(puf, '@');
if(q && strncmp(q+1, cfg->hostid, cfg->hostid_len) == 0){
continue;
}
addnode(state->rcpt, puf); addnode(state->rcpt, puf);
memcpy(&(state->b_to[state->tolen]), puf, len); memcpy(&(state->b_to[state->tolen]), puf, len);
state->tolen += len; state->tolen += len;
@ -650,7 +656,7 @@ int parse_line(char *buf, struct _state *state, struct session_data *sdata, int
if(is_email_address_on_my_domains(puf, data) == 1) sdata->internal_recipient = 1; if(is_email_address_on_my_domains(puf, data) == 1) sdata->internal_recipient = 1;
else sdata->external_recipient = 1; else sdata->external_recipient = 1;
q = strchr(puf, '@'); //q = strchr(puf, '@');
if(q){ if(q){
if(findnode(state->rcpt_domain, q+1) == NULL){ if(findnode(state->rcpt_domain, q+1) == NULL){
addnode(state->rcpt_domain, q+1); addnode(state->rcpt_domain, q+1);