int smtp_stream_except(SMTP_STATE *state, int code, const char *description) { SMTP_SESSION *session = state->session; DSN_BUF *why = state->why; /* * Sanity check. */ if (session == 0) msg_panic("smtp_stream_except: no session"); /* * Initialize. */ switch (code) { default: msg_panic("smtp_stream_except: unknown exception %d", code); case SMTP_ERR_EOF: dsb_simple(why, "4.4.2", "lost connection with %s while %s", session->namaddr, description); break; case SMTP_ERR_TIME: dsb_simple(why, "4.4.2", "conversation with %s timed out while %s", session->namaddr, description); break; case SMTP_ERR_DATA: session->error_mask |= MAIL_ERROR_DATA; dsb_simple(why, "4.3.0", "local data error while talking to %s", session->namaddr); } return (smtp_bulk_fail(state, SMTP_THROTTLE)); }
int smtp_sess_fail(SMTP_STATE *state) { /* * We can't avoid copying copying lots of strings into VSTRING buffers, * because this error information is collected by a routine that * terminates BEFORE the error is reported. */ return (smtp_bulk_fail(state, SMTP_THROTTLE)); }
int smtp_stream_except(SMTP_STATE *state, int code, const char *description) { SMTP_SESSION *session = state->session; DSN_BUF *why = state->why; /* * Sanity check. */ if (session == 0) msg_panic("smtp_stream_except: no session"); /* * Initialize. */ switch (code) { default: msg_panic("smtp_stream_except: unknown exception %d", code); case SMTP_ERR_EOF: dsb_simple(why, "4.4.2", "lost connection with %s while %s", session->namaddr, description); #ifdef USE_TLS if (PLAINTEXT_FALLBACK_OK_AFTER_TLS_SESSION_FAILURE) RETRY_AS_PLAINTEXT; #endif break; case SMTP_ERR_TIME: dsb_simple(why, "4.4.2", "conversation with %s timed out while %s", session->namaddr, description); #ifdef USE_TLS if (PLAINTEXT_FALLBACK_OK_AFTER_TLS_SESSION_FAILURE) RETRY_AS_PLAINTEXT; #endif break; case SMTP_ERR_DATA: session->error_mask |= MAIL_ERROR_DATA; dsb_simple(why, "4.3.0", "local data error while talking to %s", session->namaddr); } /* * The smtp_bulk_fail() call below will not throttle the destination when * falling back to plaintext, because RETRY_AS_PLAINTEXT clears the * FINAL_SERVER flag. */ return (smtp_bulk_fail(state, SMTP_THROTTLE)); }
int smtp_mesg_fail(SMTP_STATE *state, const char *mta_name, SMTP_RESP *resp, const char *format,...) { va_list ap; /* * Initialize. */ va_start(ap, format); vsmtp_fill_dsn(state, mta_name, resp->dsn, resp->str, format, ap); va_end(ap); if (state->session && mta_name) smtp_check_code(state->session, resp->code); /* * Skip, defer or bounce recipients, but don't throttle this queue. */ return (smtp_bulk_fail(state, SMTP_NOTHROTTLE)); }