mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-25 19:40:11 +01:00
write only envelope to if it's not on @hostname
Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
parent
b9f6f3627a
commit
a815d1b60f
@ -72,7 +72,7 @@ void process_bdat(struct smtp_session *session, char *readbuf, int readlen, stru
|
|||||||
syslog(LOG_PRIORITY, "%s: %s", ERR_OPEN_TMP_FILE, session->ttmpfile);
|
syslog(LOG_PRIORITY, "%s: %s", ERR_OPEN_TMP_FILE, session->ttmpfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cfg->process_rcpt_to_addresses == 1) write_envelope_addresses(session);
|
if(cfg->process_rcpt_to_addresses == 1) write_envelope_addresses(session, cfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
session->bdat_bytes_to_read -= readlen;
|
session->bdat_bytes_to_read -= readlen;
|
||||||
|
@ -71,7 +71,7 @@ int is_email_address_on_my_domains(char *email, struct data *data);
|
|||||||
int start_new_session(struct smtp_session **sessions, int socket, int *num_connections, struct config *cfg);
|
int start_new_session(struct smtp_session **sessions, int socket, int *num_connections, struct config *cfg);
|
||||||
void tear_down_session(struct smtp_session **sessions, int slot, int *num_connections);
|
void tear_down_session(struct smtp_session **sessions, int slot, int *num_connections);
|
||||||
struct smtp_session *get_session_by_socket(struct smtp_session **sessions, int max_connections, int socket);
|
struct smtp_session *get_session_by_socket(struct smtp_session **sessions, int max_connections, int socket);
|
||||||
void write_envelope_addresses(struct smtp_session *session);
|
void write_envelope_addresses(struct smtp_session *session, struct config *cfg);
|
||||||
void handle_data(struct smtp_session *session, char *readbuf, int readlen, struct config *cfg);
|
void handle_data(struct smtp_session *session, char *readbuf, int readlen, struct config *cfg);
|
||||||
void free_smtp_session(struct smtp_session *session);
|
void free_smtp_session(struct smtp_session *session);
|
||||||
|
|
||||||
|
@ -231,14 +231,17 @@ void handle_data(struct smtp_session *session, char *readbuf, int readlen, struc
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void write_envelope_addresses(struct smtp_session *session){
|
void write_envelope_addresses(struct smtp_session *session, struct config *cfg){
|
||||||
int i;
|
int i;
|
||||||
char s[SMALLBUFSIZE];
|
char *p, s[SMALLBUFSIZE];
|
||||||
|
|
||||||
if(session->fd == -1) return;
|
if(session->fd == -1) return;
|
||||||
|
|
||||||
for(i=0; i<session->num_of_rcpt_to; i++){
|
for(i=0; i<session->num_of_rcpt_to; i++){
|
||||||
snprintf(s, sizeof(s)-1, "X-Piler-Envelope-To: %s\n", session->rcptto[i]);
|
p = strchr(session->rcptto[i], '@');
|
||||||
if(write(session->fd, s, strlen(s)) == -1) syslog(LOG_PRIORITY, "ERROR: %s: cannot write envelope to address", session->ttmpfile);
|
if(p && strncmp(p+1, cfg->hostid, cfg->hostid_len)){
|
||||||
|
snprintf(s, sizeof(s)-1, "X-Piler-Envelope-To: %s\n", session->rcptto[i]);
|
||||||
|
if(write(session->fd, s, strlen(s)) == -1) syslog(LOG_PRIORITY, "ERROR: %s: cannot write envelope to address", session->ttmpfile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -299,7 +299,7 @@ void process_command_data(struct smtp_session *session, struct config *cfg){
|
|||||||
session->protocol_state = SMTP_STATE_DATA;
|
session->protocol_state = SMTP_STATE_DATA;
|
||||||
send_smtp_response(session, SMTP_RESP_354_DATA_OK);
|
send_smtp_response(session, SMTP_RESP_354_DATA_OK);
|
||||||
|
|
||||||
if(cfg->process_rcpt_to_addresses == 1) write_envelope_addresses(session);
|
if(cfg->process_rcpt_to_addresses == 1) write_envelope_addresses(session, cfg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user