From 774ef2d7d0f7fffbfd114271b8567e36485898dc Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Sat, 18 Oct 2014 20:38:07 +0100 Subject: Rename facility to Event Actions, ifdeffed on EXPERIMENTAL_EVENT --- src/src/EDITME | 4 ++-- src/src/config.h.defaults | 2 +- src/src/deliver.c | 44 ++++++++++++++++++++++---------------------- src/src/exim.c | 4 ++-- src/src/expand.c | 16 ++++++++-------- src/src/functions.h | 9 ++++----- src/src/globals.c | 14 +++++++------- src/src/globals.h | 15 ++++++++------- src/src/readconf.c | 6 +++--- src/src/smtp_out.c | 10 +++++----- src/src/structs.h | 4 ++-- src/src/tls-gnu.c | 22 +++++++++++----------- src/src/tls-openssl.c | 22 +++++++++++----------- src/src/transport.c | 8 ++++---- src/src/transports/smtp.c | 34 +++++++++++++++++----------------- src/src/verify.c | 16 ++++++++-------- 16 files changed, 115 insertions(+), 115 deletions(-) (limited to 'src') diff --git a/src/src/EDITME b/src/src/EDITME index 01c4ebc9d..4a290a4bc 100644 --- a/src/src/EDITME +++ b/src/src/EDITME @@ -473,9 +473,9 @@ EXIM_MONITOR=eximon.bin # LDFLAGS += -lopendmarc -# Uncomment the following line to support Transport post-delivery actions, +# Uncomment the following line to support Events, # eg. for logging to a database. -# EXPERIMENTAL_TPDA=yes +# EXPERIMENTAL_EVENT=yes # Uncomment the following line to add Redis lookup support # You need to have hiredis installed on your system (https://github.com/redis/hiredis). diff --git a/src/src/config.h.defaults b/src/src/config.h.defaults index 49ab276ff..a0997a01e 100644 --- a/src/src/config.h.defaults +++ b/src/src/config.h.defaults @@ -176,7 +176,7 @@ it's a default value. */ #define EXPERIMENTAL_REDIS #define EXPERIMENTAL_SPF #define EXPERIMENTAL_SRS -#define EXPERIMENTAL_TPDA +#define EXPERIMENTAL_EVENT /* For developers */ #define WANT_DEEPER_PRINTF_CHECKS diff --git a/src/src/deliver.c b/src/src/deliver.c index 4462d5c4a..4cc05b4ae 100644 --- a/src/src/deliver.c +++ b/src/src/deliver.c @@ -718,27 +718,27 @@ d_tlslog(uschar * s, int * sizep, int * ptrp, address_item * addr) -#ifdef EXPERIMENTAL_TPDA +#ifdef EXPERIMENTAL_EVENT int -tpda_raise_event(uschar * action, uschar * event, uschar * ev_data) +event_raise(uschar * action, uschar * event, uschar * ev_data) { uschar * s; if (action) { DEBUG(D_deliver) - debug_printf("TPDA(%s): tpda_event_action=|%s| tpda_delivery_IP=%s\n", + debug_printf("Event(%s): event_action=|%s| delivery_IP=%s\n", event, action, deliver_host_address); - tpda_event = event; - tpda_data = ev_data; + event_name = event; + event_data = ev_data; if (!(s = expand_string(action)) && *expand_string_message) log_write(0, LOG_MAIN|LOG_PANIC, - "failed to expand tpda_event_action %s in %s: %s\n", + "failed to expand event_action %s in %s: %s\n", event, transport_name, expand_string_message); - tpda_event = tpda_data = NULL; + event_name = event_data = NULL; /* If the expansion returns anything but an empty string, flag for the caller to modify his normal processing @@ -746,7 +746,7 @@ if (action) if (s && *s) { DEBUG(D_deliver) - debug_printf("TPDA(%s): event_action returned \"%s\"\n", event, s); + debug_printf("Event(%s): event_action returned \"%s\"\n", event, s); return DEFER; } } @@ -754,7 +754,7 @@ return OK; } static void -tpda_msg_event(uschar * event, address_item * addr) +msg_event_raise(uschar * event, address_item * addr) { uschar * save_domain = deliver_domain; uschar * save_local = deliver_localpart; @@ -769,7 +769,7 @@ deliver_domain = addr->domain; deliver_localpart = addr->local_part; deliver_host = addr->host_used ? addr->host_used->name : NULL; -(void) tpda_raise_event(addr->transport->tpda_event_action, event, +(void) event_raise(addr->transport->event_action, event, addr->host_used || Ustrcmp(addr->transport->driver_name, "lmtp") == 0 ? addr->message : NULL); @@ -778,7 +778,7 @@ deliver_localpart = save_local; deliver_domain = save_domain; router_name = transport_name = NULL; } -#endif /*EXPERIMENTAL_TPDA*/ +#endif /*EXPERIMENTAL_EVENT*/ @@ -803,7 +803,7 @@ the log line, and reset the store afterwards. Remote deliveries should always have a pointer to the host item that succeeded; local deliveries can have a pointer to a single host item in their host list, for use by the transport. */ -#ifdef EXPERIMENTAL_TPDA +#ifdef EXPERIMENTAL_EVENT /* presume no successful remote delivery */ lookup_dnssec_authenticated = NULL; #endif @@ -870,7 +870,7 @@ else if (continue_sequence > 1) s = string_cat(s, &size, &ptr, US"*", 1); -#ifdef EXPERIMENTAL_TPDA +#ifdef EXPERIMENTAL_EVENT deliver_host_address = addr->host_used->address; deliver_host_port = addr->host_used->port; deliver_host = addr->host_used->name; @@ -939,8 +939,8 @@ store we used to build the line after writing it. */ s[ptr] = 0; log_write(0, flags, "%s", s); -#ifdef EXPERIMENTAL_TPDA -if (!msg) tpda_msg_event(US"msg:delivery", addr); +#ifdef EXPERIMENTAL_EVENT +if (!msg) msg_event_raise(US"msg:delivery", addr); #endif store_reset(reset_point); @@ -1138,7 +1138,7 @@ if (result == OK) child_done(addr, now); } - /* Certificates for logging (via TPDA) */ + /* Certificates for logging (via events) */ #ifdef SUPPORT_TLS tls_out.ourcert = addr->ourcert; addr->ourcert = NULL; @@ -1381,8 +1381,8 @@ else log_write(0, LOG_MAIN, "** %s", s); -#ifdef EXPERIMENTAL_TPDA - tpda_msg_event(US"msg:fail:delivery", addr); +#ifdef EXPERIMENTAL_EVENT + msg_event_raise(US"msg:fail:delivery", addr); #endif store_reset(reset_point); @@ -5585,7 +5585,7 @@ if (process_recipients != RECIP_IGNORE) break; } -#ifdef EXPERIMENTAL_TPDA +#ifdef EXPERIMENTAL_EVENT if (process_recipients != RECIP_ACCEPT) { uschar * save_local = deliver_localpart; @@ -5596,7 +5596,7 @@ if (process_recipients != RECIP_IGNORE) deliver_domain = expand_string( string_sprintf("${domain:%s}", new->address)); - (void) tpda_raise_event(delivery_event_action, + (void) event_raise(event_action, US"msg:fail:internal", new->message); deliver_localpart = save_local; @@ -7364,8 +7364,8 @@ if (addr_defer == NULL) /* Unset deliver_freeze so that we won't try to move the spool files further down */ deliver_freeze = FALSE; -#ifdef EXPERIMENTAL_TPDA - (void) tpda_raise_event(delivery_event_action, US"msg:complete", NULL); +#ifdef EXPERIMENTAL_EVENT + (void) event_raise(event_action, US"msg:complete", NULL); #endif } diff --git a/src/src/exim.c b/src/src/exim.c index 85a7c812c..5faa6f97f 100644 --- a/src/src/exim.c +++ b/src/src/exim.c @@ -839,8 +839,8 @@ fprintf(f, "Support for:"); #ifdef EXPERIMENTAL_PROXY fprintf(f, " Experimental_Proxy"); #endif -#ifdef EXPERIMENTAL_TPDA - fprintf(f, " Experimental_TPDA"); +#ifdef EXPERIMENTAL_EVENT + fprintf(f, " Experimental_Event"); #endif #ifdef EXPERIMENTAL_REDIS fprintf(f, " Experimental_Redis"); diff --git a/src/src/expand.c b/src/src/expand.c index 8e94c3e4b..623d3f224 100644 --- a/src/src/expand.c +++ b/src/src/expand.c @@ -490,6 +490,14 @@ static var_entry var_table[] = { { "dnslist_value", vtype_stringptr, &dnslist_value }, { "domain", vtype_stringptr, &deliver_domain }, { "domain_data", vtype_stringptr, &deliver_domain_data }, +#ifdef EXPERIMENTAL_EVENT + { "event_data", vtype_stringptr, &event_data }, + + /*XXX want to use generic vars for as many of these as possible*/ + { "event_defer_errno", vtype_int, &event_defer_errno }, + + { "event_name", vtype_stringptr, &event_name }, +#endif { "exim_gid", vtype_gid, &exim_gid }, { "exim_path", vtype_stringptr, &exim_path }, { "exim_uid", vtype_uid, &exim_uid }, @@ -714,14 +722,6 @@ static var_entry var_table[] = { { "tod_logfile", vtype_todlf, NULL }, { "tod_zone", vtype_todzone, NULL }, { "tod_zulu", vtype_todzulu, NULL }, -#ifdef EXPERIMENTAL_TPDA - { "tpda_data", vtype_stringptr, &tpda_data }, - - /*XXX want to use generic vars for as many of these as possible*/ - { "tpda_defer_errno", vtype_int, &tpda_defer_errno }, - - { "tpda_event", vtype_stringptr, &tpda_event }, -#endif { "transport_name", vtype_stringptr, &transport_name }, { "value", vtype_stringptr, &lookup_value }, { "version_number", vtype_stringptr, &version_string }, diff --git a/src/src/functions.h b/src/src/functions.h index 6328416dc..ba4760f7a 100644 --- a/src/src/functions.h +++ b/src/src/functions.h @@ -157,6 +157,9 @@ extern BOOL dscp_lookup(const uschar *, int, int *, int *, int *); extern void enq_end(uschar *); extern BOOL enq_start(uschar *); +#ifdef EXPERIMENTAL_EVENT +extern int event_raise(uschar *, uschar *, uschar *); +#endif extern void exim_exit(int); extern void exim_nullstd(void); extern void exim_setugid(uid_t, gid_t, BOOL, uschar *); @@ -347,7 +350,7 @@ extern void sigalrm_handler(int); extern BOOL smtp_buffered(void); extern void smtp_closedown(uschar *); extern int smtp_connect(host_item *, int, int, uschar *, int, BOOL, const uschar * -#ifdef EXPERIMENTAL_TPDA +#ifdef EXPERIMENTAL_EVENT , uschar * #endif ); @@ -409,10 +412,6 @@ extern uschar *strstric(uschar *, uschar *, BOOL); extern uschar *tod_stamp(int); -#ifdef EXPERIMENTAL_TPDA -extern int tpda_raise_event(uschar *, uschar *, uschar *); -#endif - extern void tls_modify_variables(tls_support *); extern BOOL transport_check_waiting(uschar *, uschar *, int, uschar *, BOOL *); diff --git a/src/src/globals.c b/src/src/globals.c index 22bd69e01..fb3ea32a9 100644 --- a/src/src/globals.c +++ b/src/src/globals.c @@ -1336,11 +1336,11 @@ int thismessage_size_limit = 0; int timeout_frozen_after = 0; BOOL timestamps_utc = FALSE; -#ifdef EXPERIMENTAL_TPDA -int tpda_defer_errno = 0; -uschar *tpda_event = NULL; /* event name */ -uschar *tpda_data = NULL; /* auxilary data for event */ -uschar *delivery_event_action = NULL; /* expansion for delivery events */ +#ifdef EXPERIMENTAL_EVENT +uschar *event_action = NULL; /* expansion for delivery events */ +uschar *event_data = NULL; /* auxilary data variable for event */ +int event_defer_errno = 0; +uschar *event_name = NULL; /* event name variable */ #endif transport_instance *transports = NULL; @@ -1395,8 +1395,8 @@ transport_instance transport_defaults = { FALSE, /* log_defer_output */ TRUE_UNSET /* retry_use_local_part: BOOL, but set neither 1 nor 0 so can detect unset */ -#ifdef EXPERIMENTAL_TPDA - ,NULL /* tpda_event_action */ +#ifdef EXPERIMENTAL_EVENT + ,NULL /* event_action */ #endif }; diff --git a/src/src/globals.h b/src/src/globals.h index 800ec9c31..c335c343b 100644 --- a/src/src/globals.h +++ b/src/src/globals.h @@ -418,6 +418,14 @@ extern int error_handling; /* Error handling style */ extern uschar *errors_copy; /* For taking copies of errors */ extern uschar *errors_reply_to; /* Reply-to for error messages */ extern int errors_sender_rc; /* Return after message to sender*/ + +#ifdef EXPERIMENTAL_EVENT +extern uschar *event_action; /* expansion for delivery events */ +extern uschar *event_data; /* event data */ +extern int event_defer_errno; /* error number set when a remote delivery is deferred with a host error */ +extern uschar *event_name; /* event classification */ +#endif + extern gid_t exim_gid; /* To be used with exim_uid */ extern BOOL exim_gid_set; /* TRUE if exim_gid set */ extern uschar *exim_path; /* Path to exec exim */ @@ -876,13 +884,6 @@ extern int thismessage_size_limit; /* Limit for this message */ extern int timeout_frozen_after; /* Max time to keep frozen messages */ extern BOOL timestamps_utc; /* Use UTC for all times */ -#ifdef EXPERIMENTAL_TPDA -extern int tpda_defer_errno; /* error number set when a remote delivery is deferred with a host error */ -extern uschar *tpda_event; /* event classification */ -extern uschar *tpda_data; /* event data */ -extern uschar *delivery_event_action; /* expansion for delivery events */ -#endif - extern uschar *transport_name; /* Name of transport last started */ extern int transport_count; /* Count of bytes transported */ extern int transport_newlines; /* Accurate count of number of newline chars transported */ diff --git a/src/src/readconf.c b/src/src/readconf.c index 2e18b670e..074ed9615 100644 --- a/src/src/readconf.c +++ b/src/src/readconf.c @@ -205,9 +205,6 @@ static optionlist optionlist_config[] = { { "deliver_drop_privilege", opt_bool, &deliver_drop_privilege }, { "deliver_queue_load_max", opt_fixed, &deliver_queue_load_max }, { "delivery_date_remove", opt_bool, &delivery_date_remove }, -#ifdef EXPERIMENTAL_TPDA - { "delivery_event_action", opt_stringptr, &delivery_event_action }, -#endif #ifdef ENABLE_DISABLE_FSYNC { "disable_fsync", opt_bool, &disable_fsync }, #endif @@ -239,6 +236,9 @@ static optionlist optionlist_config[] = { { "envelope_to_remove", opt_bool, &envelope_to_remove }, { "errors_copy", opt_stringptr, &errors_copy }, { "errors_reply_to", opt_stringptr, &errors_reply_to }, +#ifdef EXPERIMENTAL_EVENT + { "event_action", opt_stringptr, &event_action }, +#endif { "exim_group", opt_gid, &exim_gid }, { "exim_path", opt_stringptr, &exim_path }, { "exim_user", opt_uid, &exim_uid }, diff --git a/src/src/smtp_out.c b/src/src/smtp_out.c index 4920b7371..e3f2588d7 100644 --- a/src/src/smtp_out.c +++ b/src/src/smtp_out.c @@ -165,7 +165,7 @@ Arguments: timeout timeout value or 0 keepalive TRUE to use keepalive dscp DSCP value to assign to socket - tpda_event event expansion + event event expansion Returns: connected socket number, or -1 with errno set */ @@ -173,8 +173,8 @@ Returns: connected socket number, or -1 with errno set int smtp_connect(host_item *host, int host_af, int port, uschar *interface, int timeout, BOOL keepalive, const uschar *dscp -#ifdef EXPERIMENTAL_TPDA - , uschar * tpda_event +#ifdef EXPERIMENTAL_EVENT + , uschar * event #endif ) { @@ -203,11 +203,11 @@ HDEBUG(D_transport|D_acl|D_v) host->address, port, interface); } -#ifdef EXPERIMENTAL_TPDA +#ifdef EXPERIMENTAL_EVENT /*XXX Called from both delivery and verify. Is that status observable? */ deliver_host_address = host->address; deliver_host_port = port; - if (tpda_raise_event(tpda_event, US"tcp:connect", NULL) == DEFER) return -1; + if (event_raise(event, US"tcp:connect", NULL) == DEFER) return -1; #endif /* Create the socket */ diff --git a/src/src/structs.h b/src/src/structs.h index 4f7862dc5..259d9af71 100644 --- a/src/src/structs.h +++ b/src/src/structs.h @@ -187,8 +187,8 @@ typedef struct transport_instance { BOOL log_fail_output; BOOL log_defer_output; BOOL retry_use_local_part; /* Defaults true for local, false for remote */ -#ifdef EXPERIMENTAL_TPDA - uschar *tpda_event_action; /* String to expand on notable events */ +#ifdef EXPERIMENTAL_EVENT + uschar *event_action; /* String to expand on notable events */ #endif } transport_instance; diff --git a/src/src/tls-gnu.c b/src/src/tls-gnu.c index 593319393..20e11cae1 100644 --- a/src/src/tls-gnu.c +++ b/src/src/tls-gnu.c @@ -47,9 +47,9 @@ require current GnuTLS, then we'll drop support for the ancient libraries). # warning "GnuTLS library version too old; define DISABLE_OCSP in Makefile" # define DISABLE_OCSP #endif -#if GNUTLS_VERSION_NUMBER < 0x020a00 && defined(EXPERIMENTAL_TPDA) -# warning "GnuTLS library version too old; TPDA tls:cert event unsupported" -# undef EXPERIMENTAL_TPDA +#if GNUTLS_VERSION_NUMBER < 0x020a00 && defined(EXPERIMENTAL_EVENT) +# warning "GnuTLS library version too old; tls:cert event unsupported" +# undef EXPERIMENTAL_EVENT #endif #if GNUTLS_VERSION_NUMBER >= 0x030306 # define SUPPORT_CA_DIR @@ -124,7 +124,7 @@ typedef struct exim_gnutls_state { #ifdef EXPERIMENTAL_CERTNAMES uschar *exp_tls_verify_cert_hostnames; #endif -#ifdef EXPERIMENTAL_TPDA +#ifdef EXPERIMENTAL_EVENT uschar *event_action; #endif @@ -145,7 +145,7 @@ static const exim_gnutls_state_st exim_gnutls_state_init = { #ifdef EXPERIMENTAL_CERTNAMES NULL, #endif -#ifdef EXPERIMENTAL_TPDA +#ifdef EXPERIMENTAL_EVENT NULL, #endif NULL, @@ -1542,10 +1542,10 @@ return 0; #endif -#ifdef EXPERIMENTAL_TPDA +#ifdef EXPERIMENTAL_EVENT /* We use this callback to get observability and detail-level control -for an exim client TLS connection, raising a TPDA tls:cert event +for an exim client TLS connection, raising a tls:cert event for each cert in the chain presented by the server. Any event can deny verification. @@ -1574,7 +1574,7 @@ if (cert_list) } state->tlsp->peercert = crt; - if (tpda_raise_event(state->event_action, + if (event_raise(state->event_action, US"tls:cert", string_sprintf("%d", cert_list_size)) == DEFER) { log_write(0, LOG_MAIN, @@ -1885,10 +1885,10 @@ if (request_ocsp) } #endif -#ifdef EXPERIMENTAL_TPDA -if (tb->tpda_event_action) +#ifdef EXPERIMENTAL_EVENT +if (tb->event_action) { - state->event_action = tb->tpda_event_action; + state->event_action = tb->event_action; gnutls_session_set_ptr(state->session, state); gnutls_certificate_set_verify_function(state->x509_cred, client_verify_cb); } diff --git a/src/src/tls-openssl.c b/src/src/tls-openssl.c index 43ea8a0d2..13a3cd076 100644 --- a/src/src/tls-openssl.c +++ b/src/src/tls-openssl.c @@ -120,7 +120,7 @@ typedef struct tls_ext_ctx_cb { #ifdef EXPERIMENTAL_CERTNAMES uschar * verify_cert_hostnames; #endif -#ifdef EXPERIMENTAL_TPDA +#ifdef EXPERIMENTAL_EVENT uschar * event_action; #endif } tls_ext_ctx_cb; @@ -322,11 +322,11 @@ else if (depth != 0) ERR_clear_error(); } #endif -#ifdef EXPERIMENTAL_TPDA +#ifdef EXPERIMENTAL_EVENT if (tlsp == &tls_out && client_static_cbinfo->event_action) { tlsp->peercert = X509_dup(cert); - if (tpda_raise_event(client_static_cbinfo->event_action, + if (event_raise(client_static_cbinfo->event_action, US"tls:cert", string_sprintf("%d", depth)) == DEFER) { log_write(0, LOG_MAIN, "SSL verify denied by event-action: " @@ -391,10 +391,10 @@ else # endif #endif /*EXPERIMENTAL_CERTNAMES*/ -#ifdef EXPERIMENTAL_TPDA +#ifdef EXPERIMENTAL_EVENT if (tlsp == &tls_out) { - if (tpda_raise_event(client_static_cbinfo->event_action, + if (event_raise(client_static_cbinfo->event_action, US"tls:cert", US"0") == DEFER) { log_write(0, LOG_MAIN, "SSL verify denied by event-action: " @@ -438,7 +438,7 @@ verify_callback_client_dane(int state, X509_STORE_CTX * x509ctx) { X509 * cert = X509_STORE_CTX_get_current_cert(x509ctx); static uschar txt[256]; -#ifdef EXPERIMENTAL_TPDA +#ifdef EXPERIMENTAL_EVENT int depth = X509_STORE_CTX_get_error_depth(x509ctx); #endif @@ -448,10 +448,10 @@ DEBUG(D_tls) debug_printf("verify_callback_client_dane: %s\n", txt); tls_out.peerdn = txt; tls_out.peercert = X509_dup(cert); -#ifdef EXPERIMENTAL_TPDA +#ifdef EXPERIMENTAL_EVENT if (client_static_cbinfo->event_action) { - if (tpda_raise_event(client_static_cbinfo->event_action, + if (event_raise(client_static_cbinfo->event_action, US"tls:cert", string_sprintf("%d", depth)) == DEFER) { log_write(0, LOG_MAIN, "DANE verify denied by event-action: " @@ -1140,7 +1140,7 @@ else cbinfo->dhparam = dhparam; cbinfo->server_cipher_list = NULL; cbinfo->host = host; -#ifdef EXPERIMENTAL_TPDA +#ifdef EXPERIMENTAL_EVENT cbinfo->event_action = NULL; #endif @@ -1935,8 +1935,8 @@ if (request_ocsp) } #endif -#ifdef EXPERIMENTAL_TPDA -client_static_cbinfo->event_action = tb->tpda_event_action; +#ifdef EXPERIMENTAL_EVENT +client_static_cbinfo->event_action = tb->event_action; #endif /* There doesn't seem to be a built-in timeout on connection. */ diff --git a/src/src/transport.c b/src/src/transport.c index 15c30bf04..e833894a8 100644 --- a/src/src/transport.c +++ b/src/src/transport.c @@ -66,6 +66,10 @@ optionlist optionlist_transports[] = { (void *)offsetof(transport_instance, driver_name) }, { "envelope_to_add", opt_bool|opt_public, (void *)(offsetof(transport_instance, envelope_to_add)) }, +#ifdef EXPERIMENTAL_EVENT + { "event_action", opt_stringptr | opt_public, + (void *)offsetof(transport_instance, event_action) }, +#endif { "group", opt_expand_gid|opt_public, (void *)offsetof(transport_instance, gid) }, { "headers_add", opt_stringptr|opt_public|opt_rep_str, @@ -94,10 +98,6 @@ optionlist optionlist_transports[] = { (void *)offsetof(transport_instance, shadow_condition) }, { "shadow_transport", opt_stringptr|opt_public, (void *)offsetof(transport_instance, shadow) }, -#ifdef EXPERIMENTAL_TPDA - { "tpda_event_action",opt_stringptr | opt_public, - (void *)offsetof(transport_instance, tpda_event_action) }, -#endif { "transport_filter", opt_stringptr|opt_public, (void *)offsetof(transport_instance, filter_command) }, { "transport_filter_timeout", opt_time|opt_public, diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c index 6d3492295..6886fd518 100644 --- a/src/src/transports/smtp.c +++ b/src/src/transports/smtp.c @@ -640,7 +640,7 @@ msglog_line(host_item * host, uschar * message) -#ifdef EXPERIMENTAL_TPDA +#ifdef EXPERIMENTAL_EVENT /************************************************* * Post-defer action * *************************************************/ @@ -656,9 +656,9 @@ Returns: nothing */ static void -tpda_deferred(address_item *addr, host_item *host) +deferred_event_raise(address_item *addr, host_item *host) { -uschar * action = addr->transport->tpda_event_action; +uschar * action = addr->transport->event_action; uschar * save_domain; uschar * save_local; @@ -670,15 +670,15 @@ save_local = deliver_localpart; /*XXX would ip & port already be set up? */ deliver_host_address = string_copy(host->address); -deliver_host_port = (host->port == PORT_NONE)? 25 : host->port; -tpda_defer_errno = addr->basic_errno; +deliver_host_port = host->port == PORT_NONE ? 25 : host->port; +event_defer_errno = addr->basic_errno; router_name = addr->router->name; transport_name = addr->transport->name; deliver_domain = addr->domain; deliver_localpart = addr->local_part; -(void) tpda_raise_event(action, US"msg:host:defer", +(void) event_raise(action, US"msg:host:defer", addr->message ? addr->basic_errno > 0 ? string_sprintf("%s: %s", addr->message, strerror(addr->basic_errno)) @@ -1356,8 +1356,8 @@ if (continue_hostname == NULL) inblock.sock = outblock.sock = smtp_connect(host, host_af, port, interface, ob->connect_timeout, ob->keepalive, ob->dscp -#ifdef EXPERIMENTAL_TPDA - , tblock->tpda_event_action +#ifdef EXPERIMENTAL_EVENT + , tblock->event_action #endif ); @@ -1413,8 +1413,8 @@ if (continue_hostname == NULL) if (!smtp_read_response(&inblock, buffer, sizeof(buffer), '2', ob->command_timeout)) goto RESPONSE_FAILED; -#ifdef EXPERIMENTAL_TPDA - if (tpda_raise_event(tblock->tpda_event_action, US"smtp:connect", buffer) +#ifdef EXPERIMENTAL_EVENT + if (event_raise(tblock->event_action, US"smtp:connect", buffer) == DEFER) { uschar *message = US"deferred by smtp:connect event expansion"; @@ -2218,7 +2218,7 @@ if (!ok) ok = TRUE; else /* Set up confirmation if needed - applies only to SMTP */ if ( -#ifndef EXPERIMENTAL_TPDA +#ifndef EXPERIMENTAL_EVENT (log_extra_selector & LX_smtp_confirmation) != 0 && #endif !lmtp @@ -2659,8 +2659,8 @@ case continue_more won't get set. */ (void)close(inblock.sock); -#ifdef EXPERIMENTAL_TPDA -(void) tpda_raise_event(tblock->tpda_event_action, US"tcp:close", NULL); +#ifdef EXPERIMENTAL_EVENT +(void) event_raise(tblock->event_action, US"tcp:close", NULL); #endif continue_transport = NULL; @@ -3370,9 +3370,9 @@ for (cutoff_retry = 0; expired && first_addr->basic_errno != ERRNO_TLSFAILURE) write_logs(first_addr, host); -#ifdef EXPERIMENTAL_TPDA +#ifdef EXPERIMENTAL_EVENT if (rc == DEFER) - tpda_deferred(first_addr, host); + deferred_event_raise(first_addr, host); #endif /* If STARTTLS was accepted, but there was a failure in setting up the @@ -3399,9 +3399,9 @@ for (cutoff_retry = 0; expired && expanded_hosts != NULL, &message_defer, TRUE); if (rc == DEFER && first_addr->basic_errno != ERRNO_AUTHFAIL) write_logs(first_addr, host); -# ifdef EXPERIMENTAL_TPDA +# ifdef EXPERIMENTAL_EVENT if (rc == DEFER) - tpda_deferred(first_addr, host); + deferred_event_raise(first_addr, host); # endif } #endif /*SUPPORT_TLS*/ diff --git a/src/src/verify.c b/src/src/verify.c index db35aa575..dba09164e 100644 --- a/src/src/verify.c +++ b/src/src/verify.c @@ -538,8 +538,8 @@ else inblock.sock = outblock.sock = smtp_connect(host, host_af, port, interface, callout_connect, TRUE, NULL -#ifdef EXPERIMENTAL_TPDA - /*XXX tpda action? NULL for now. */ +#ifdef EXPERIMENTAL_EVENT + /*XXX event action? NULL for now. */ , NULL #endif ); @@ -581,8 +581,8 @@ else if (!(done= smtp_read_response(&inblock, responsebuffer, sizeof(responsebuffer), '2', callout))) goto RESPONSE_FAILED; -#ifdef EXPERIMENTAL_TPDA - if (tpda_raise_event(addr->transport->tpda_event_action, +#ifdef EXPERIMENTAL_EVENT + if (event_raise(addr->transport->event_action, US"smtp:connect", responsebuffer) == DEFER) { /* Logging? Debug? */ @@ -708,8 +708,8 @@ else ) { (void)close(inblock.sock); -#ifdef EXPERIMENTAL_TPDA - (void) tpda_raise_event(addr->transport->tpda_event_action, +#ifdef EXPERIMENTAL_EVENT + (void) event_raise(addr->transport->event_action, US"tcp:close", NULL); #endif log_write(0, LOG_MAIN, "TLS session failure: delivering unencrypted " @@ -1066,8 +1066,8 @@ else tls_close(FALSE, TRUE); #endif (void)close(inblock.sock); -#ifdef EXPERIMENTAL_TPDA - (void) tpda_raise_event(addr->transport->tpda_event_action, +#ifdef EXPERIMENTAL_EVENT + (void) event_raise(addr->transport->event_action, US"tcp:close", NULL); #endif } -- cgit v1.2.3