X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/1ed70f64c0df2c1428057c2ad5b3d43260087396..c3d6f1ff09458b3e7619f9bc4799aec0ab5fc2f2:/src/src/functions.h diff --git a/src/src/functions.h b/src/src/functions.h index d05d87450..e231ce204 100644 --- a/src/src/functions.h +++ b/src/src/functions.h @@ -615,8 +615,8 @@ extern BOOL transport_pass_socket(const uschar *, const uschar *, const uscha #endif ); extern uschar *transport_rcpt_address(address_item *, BOOL); -extern BOOL transport_set_up_command(const uschar ***, uschar *, - BOOL, int, address_item *, const uschar *, uschar **); +extern BOOL transport_set_up_command(const uschar ***, const uschar *, + BOOL, int, address_item *, BOOL, const uschar *, uschar **); extern void transport_update_waiting(host_item *, uschar *); extern BOOL transport_write_block(transport_ctx *, uschar *, int, BOOL); extern void transport_write_reset(int); @@ -1253,6 +1253,42 @@ struct pollfd p = {.fd = fd, .events = pollbits}; return poll(&p, 1, tmo_millisec); } +/******************************************************************************/ +/* Client-side smtp log string, for debug */ + +static inline void +smtp_debug_cmd(const uschar * buf, int mode) +{ +HDEBUG(D_transport|D_acl|D_v) debug_printf_indent(" SMTP%c> %s\n", + mode == SCMD_BUFFER ? '|' : mode == SCMD_MORE ? '+' : '>', buf); + +# ifndef DISABLE_CLIENT_CMD_LOG + { + int old_pool = store_pool; + store_pool = POOL_PERM; /* Main pool ACL allocations eg. callouts get released */ + client_cmd_log = string_append_listele_n(client_cmd_log, ':', buf, + Ustrcspn(buf, " \n")); + if (mode == SCMD_BUFFER) + { + client_cmd_log = string_catn(client_cmd_log, US"|", 1); + (void) string_from_gstring(client_cmd_log); + } + store_pool = old_pool; + } +# endif +} + + +static inline void +smtp_debug_cmd_report(void) +{ +# ifndef DISABLE_CLIENT_CMD_LOG +debug_printf("cmdlog: '%s'\n", client_cmd_log ? client_cmd_log->s : US"(unset)"); +# endif +} + + + # endif /* !COMPILE_UTILITY */ /******************************************************************************/