void cleanup_addr_bcc_dsn(CLEANUP_STATE *state, const char *bcc, const char *dsn_orcpt, int dsn_notify) { VSTRING *clean_addr = vstring_alloc(100); /* * Note: BCC addresses are supplied locally, and must be rewritten in the * local address rewriting context. */ cleanup_rewrite_internal(MAIL_ATTR_RWR_LOCAL, clean_addr, bcc); if (state->flags & CLEANUP_FLAG_MAP_OK) { if (cleanup_rcpt_canon_maps && (cleanup_rcpt_canon_flags & CLEANUP_CANON_FLAG_ENV_RCPT)) cleanup_map11_internal(state, clean_addr, cleanup_rcpt_canon_maps, cleanup_ext_prop_mask & EXT_PROP_CANONICAL); if (cleanup_comm_canon_maps && (cleanup_comm_canon_flags & CLEANUP_CANON_FLAG_ENV_RCPT)) cleanup_map11_internal(state, clean_addr, cleanup_comm_canon_maps, cleanup_ext_prop_mask & EXT_PROP_CANONICAL); if (cleanup_masq_domains && (cleanup_masq_flags & CLEANUP_MASQ_FLAG_ENV_RCPT)) cleanup_masquerade_internal(state, clean_addr, cleanup_masq_domains); } cleanup_out_recipient(state, dsn_orcpt, dsn_notify, STR(clean_addr), STR(clean_addr)); vstring_free(clean_addr); }
void cleanup_addr_recipient(CLEANUP_STATE *state, const char *buf) { VSTRING *clean_addr = vstring_alloc(100); const char *bcc; /* * Note: an unqualified envelope address is for all practical purposes * equivalent to a fully qualified local address, both for delivery and * for replying. Having to support both forms is error prone, therefore * an incomplete envelope address is rewritten to fully qualified form in * the local domain context. */ cleanup_rewrite_internal(MAIL_ATTR_RWR_LOCAL, clean_addr, *buf ? buf : var_empty_addr); if (state->flags & CLEANUP_FLAG_MAP_OK) { if (cleanup_rcpt_canon_maps && (cleanup_rcpt_canon_flags & CLEANUP_CANON_FLAG_ENV_RCPT)) cleanup_map11_internal(state, clean_addr, cleanup_rcpt_canon_maps, cleanup_ext_prop_mask & EXT_PROP_CANONICAL); if (cleanup_comm_canon_maps && (cleanup_comm_canon_flags & CLEANUP_CANON_FLAG_ENV_RCPT)) cleanup_map11_internal(state, clean_addr, cleanup_comm_canon_maps, cleanup_ext_prop_mask & EXT_PROP_CANONICAL); if (cleanup_masq_domains && (cleanup_masq_flags & CLEANUP_MASQ_FLAG_ENV_RCPT)) cleanup_masquerade_internal(state, clean_addr, cleanup_masq_domains); } cleanup_out_recipient(state, state->dsn_orcpt, state->dsn_notify, state->orig_rcpt, STR(clean_addr)); if (state->recip) /* This can happen */ myfree(state->recip); state->recip = mystrdup(STR(clean_addr)); /* Used by Milter client */ if ((state->flags & CLEANUP_FLAG_BCC_OK) && *STR(clean_addr) && cleanup_rcpt_bcc_maps) { if ((bcc = mail_addr_find(cleanup_rcpt_bcc_maps, STR(clean_addr), IGNORE_EXTENSION)) != 0) { cleanup_addr_bcc(state, bcc); } else if (cleanup_rcpt_bcc_maps->error) { msg_warn("%s: %s map lookup problem -- " "message not accepted, try again later", state->queue_id, cleanup_rcpt_bcc_maps->title); state->errs |= CLEANUP_STAT_WRITE; } } vstring_free(clean_addr); }