diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/src/expand.c | 1 | ||||
-rw-r--r-- | src/src/functions.h | 1 | ||||
-rw-r--r-- | src/src/smtp_in.c | 22 |
3 files changed, 23 insertions, 1 deletions
diff --git a/src/src/expand.c b/src/src/expand.c index a064e34e4..4eb1818f1 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -680,6 +680,7 @@ static var_entry var_table[] = { { "smtp_active_hostname", vtype_stringptr, &smtp_active_hostname }, { "smtp_command", vtype_stringptr, &smtp_cmd_buffer }, { "smtp_command_argument", vtype_stringptr, &smtp_cmd_argument }, + { "smtp_command_history", vtype_string_func, &smtp_cmd_hist }, { "smtp_count_at_connection_start", vtype_int, &smtp_accept_count }, { "smtp_notquit_reason", vtype_stringptr, &smtp_notquit_reason }, { "sn0", vtype_filter_int, &filter_sn[0] }, diff --git a/src/src/functions.h b/src/src/functions.h index f7173576b..9c9caaf97 100644 --- a/src/src/functions.h +++ b/src/src/functions.h @@ -394,6 +394,7 @@ extern int sieve_interpret(uschar *, int, uschar *, uschar *, uschar *, extern void sigalrm_handler(int); extern BOOL smtp_buffered(void); extern void smtp_closedown(uschar *); +extern uschar *smtp_cmd_hist(void); extern int smtp_connect(host_item *, int, uschar *, int, transport_instance *); extern int smtp_sock_connect(host_item *, int, int, uschar *, diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c index 92dbac4ce..629634267 100644 --- a/src/src/smtp_in.c +++ b/src/src/smtp_in.c @@ -1795,7 +1795,7 @@ for (i = 0; i < smtp_ch_index; i++) sep = US","; } -if (s != NULL) s[ptr] = 0; else s = US""; +if (s) s[ptr] = 0; else s = US""; log_write(0, LOG_MAIN, "no MAIL in SMTP connection from %s D=%s%s", host_and_ident(FALSE), readconf_printtime( (int) ((long)time(NULL) - (long)smtp_connection_start)), @@ -1803,6 +1803,26 @@ log_write(0, LOG_MAIN, "no MAIL in SMTP connection from %s D=%s%s", } +/* Return list of recent smtp commands */ + +uschar * +smtp_cmd_hist(void) +{ +uschar * list = NULL; +int size = 0, len = 0, i; + +for (i = smtp_ch_index; i < SMTP_HBUFF_SIZE; i++) + if (smtp_connection_had[i] != SCH_NONE) + list = string_append_listele(list, &size, &len, ',', + smtp_names[smtp_connection_had[i]]); +for (i = 0; i < smtp_ch_index; i++) + list = string_append_listele(list, &size, &len, ',', + smtp_names[smtp_connection_had[i]]); +return list ? list : US""; +} + + + /************************************************* * Check HELO line and set sender_helo_name * |