From ac49647fc3986ac6cb9b635d7f1287de3be0dd0b Mon Sep 17 00:00:00 2001 From: Janos SUTO Date: Sun, 13 May 2018 16:48:20 +0200 Subject: [PATCH] bdat fixes Signed-off-by: Janos SUTO --- src/piler-smtp.c | 2 +- src/session.c | 2 +- src/smtp.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/piler-smtp.c b/src/piler-smtp.c index 2353ec48..f87ecaf2 100644 --- a/src/piler-smtp.c +++ b/src/piler-smtp.c @@ -257,7 +257,7 @@ int main(int argc, char **argv){ if(getnameinfo((struct sockaddr *)&client_address, client_len, hbuf, sizeof(hbuf), sbuf, sizeof(sbuf), NI_NUMERICHOST | NI_NUMERICSERV) == 0){ // Strictly speaking it's not correct to log num_connections+1 connections // but it still gives a good clue how many connections we have at the moment - syslog(LOG_PRIORITY, "connected from %s:%s on descriptor %d (active connections: %d)", hbuf, sbuf, client_sockfd, num_connections + 1); + syslog(LOG_PRIORITY, "connected from %s:%s on fd=%d (active connections: %d)", hbuf, sbuf, client_sockfd, num_connections + 1); } if(make_socket_non_blocking(client_sockfd) == -1){ diff --git a/src/session.c b/src/session.c index b98d3da4..5329c381 100644 --- a/src/session.c +++ b/src/session.c @@ -159,7 +159,7 @@ void free_smtp_session(struct smtp_session *session){ void tear_down_session(struct smtp_session **sessions, int slot, int *num_connections){ - syslog(LOG_PRIORITY, "disconnected from %s on descriptor %d (%d active connections)", sessions[slot]->remote_host, sessions[slot]->net.socket, (*num_connections)-1); + syslog(LOG_PRIORITY, "disconnected from %s on fd=%d (%d active connections)", sessions[slot]->remote_host, sessions[slot]->net.socket, (*num_connections)-1); close(sessions[slot]->net.socket); diff --git a/src/smtp.c b/src/smtp.c index e7635149..db01f186 100644 --- a/src/smtp.c +++ b/src/smtp.c @@ -18,7 +18,7 @@ void process_smtp_command(struct smtp_session *session, char *buf, struct config *cfg){ char response[SMALLBUFSIZE]; - if(session->cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "processing command (fd: %d): *%s*", session->net.socket, buf); + if(session->cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "got on fd=%d: *%s*", session->net.socket, buf); if(strncasecmp(buf, SMTP_CMD_HELO, strlen(SMTP_CMD_HELO)) == 0){ process_command_helo(session, response, sizeof(response)); @@ -47,7 +47,7 @@ void process_smtp_command(struct smtp_session *session, char *buf, struct config } /* Support only BDAT xxxx LAST command */ - if(session->cfg->enable_chunking == 1 && strncasecmp(buf, SMTP_CMD_BDAT, strlen(SMTP_CMD_BDAT)) == 0 && strncasecmp(buf, "LAST", 4) == 0){ + if(session->cfg->enable_chunking == 1 && strncasecmp(buf, SMTP_CMD_BDAT, strlen(SMTP_CMD_BDAT)) == 0 && strcasestr(buf, "LAST")){ get_bdat_size_to_read(session, buf); return; } @@ -115,7 +115,7 @@ void wait_for_ssl_accept(struct smtp_session *session){ void send_smtp_response(struct smtp_session *session, char *buf){ write1(&(session->net), buf, strlen(buf)); - if(session->cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "sent (fd: %d): %s", session->net.socket, buf); + if(session->cfg->verbosity >= _LOG_DEBUG) syslog(LOG_PRIORITY, "sent on fd=%d: %s", session->net.socket, buf); }