void smtpd_state_reset(SMTPD_STATE *state) { /* * When cleaning up, touch only those fields that smtpd_state_init() * filled in. The other fields are taken care of by their own * "destructor" functions. */ if (state->buffer) vstring_free(state->buffer); if (state->protocol) myfree(state->protocol); smtpd_peer_reset(state); /* * Buffers that are created on the fly and that may be shared among mail * deliveries within the same SMTP session. */ if (state->defer_if_permit.reason) vstring_free(state->defer_if_permit.reason); if (state->defer_if_reject.reason) vstring_free(state->defer_if_reject.reason); if (state->expand_buf) vstring_free(state->expand_buf); if (state->proxy_buffer) vstring_free(state->proxy_buffer); if (state->instance) vstring_free(state->instance); #ifdef USE_SASL_AUTH if (var_smtpd_sasl_enable) smtpd_sasl_disconnect(state); #endif }
static void smtpd_peer_no_client(SMTPD_STATE *state) { smtpd_peer_reset(state); state->name = mystrdup(CLIENT_NAME_UNKNOWN); state->reverse_name = mystrdup(CLIENT_NAME_UNKNOWN); state->addr = mystrdup(CLIENT_ADDR_UNKNOWN); state->rfc_addr = mystrdup(CLIENT_ADDR_UNKNOWN); state->addr_family = AF_UNSPEC; state->name_status = SMTPD_PEER_CODE_PERM; state->reverse_name_status = SMTPD_PEER_CODE_PERM; state->port = mystrdup(CLIENT_PORT_UNKNOWN); }