smtp-server-connection.c (dovecot-2.3.16) | : | smtp-server-connection.c (dovecot-2.3.17) | ||
---|---|---|---|---|
skipping to change at line 1119 | skipping to change at line 1119 | |||
smtp_server_connection_disconnect(conn, NULL); | smtp_server_connection_disconnect(conn, NULL); | |||
e_debug(conn->event, "Connection destroy"); | e_debug(conn->event, "Connection destroy"); | |||
if (conn->callbacks != NULL && conn->callbacks->conn_free != NULL) | if (conn->callbacks != NULL && conn->callbacks->conn_free != NULL) | |||
conn->callbacks->conn_free(conn->context); | conn->callbacks->conn_free(conn->context); | |||
connection_deinit(&conn->conn); | connection_deinit(&conn->conn); | |||
i_free(conn->proxy_helo); | ||||
i_free(conn->helo_domain); | i_free(conn->helo_domain); | |||
i_free(conn->username); | i_free(conn->username); | |||
event_unref(&conn->next_trans_event); | event_unref(&conn->next_trans_event); | |||
pool_unref(&conn->pool); | pool_unref(&conn->pool); | |||
return FALSE; | return FALSE; | |||
} | } | |||
void smtp_server_connection_send_line(struct smtp_server_connection *conn, | void smtp_server_connection_send_line(struct smtp_server_connection *conn, | |||
const char *fmt, ...) | const char *fmt, ...) | |||
{ | { | |||
skipping to change at line 1207 | skipping to change at line 1208 | |||
o_stream_cork(conn->conn.output); | o_stream_cork(conn->conn.output); | |||
} | } | |||
} | } | |||
void smtp_server_connection_login(struct smtp_server_connection *conn, | void smtp_server_connection_login(struct smtp_server_connection *conn, | |||
const char *username, const char *helo, | const char *username, const char *helo, | |||
const unsigned char *pdata, | const unsigned char *pdata, | |||
unsigned int pdata_len, bool ssl_secured) | unsigned int pdata_len, bool ssl_secured) | |||
{ | { | |||
i_assert(!conn->started); | i_assert(!conn->started); | |||
i_assert(conn->username == NULL); | ||||
i_assert(conn->helo_domain == NULL); | ||||
conn->set.capabilities &= ENUM_NEGATE(SMTP_CAPABILITY_STARTTLS); | conn->set.capabilities &= ENUM_NEGATE(SMTP_CAPABILITY_STARTTLS); | |||
i_free(conn->username); | ||||
conn->username = i_strdup(username); | conn->username = i_strdup(username); | |||
if (helo != NULL && *helo != '\0') { | if (helo != NULL && *helo != '\0') { | |||
i_free(conn->helo_domain); | ||||
conn->helo_domain = i_strdup(helo); | conn->helo_domain = i_strdup(helo); | |||
conn->helo.domain = conn->helo_domain; | conn->helo.domain = conn->helo_domain; | |||
conn->helo.domain_valid = TRUE; | conn->helo.domain_valid = TRUE; | |||
} | } | |||
conn->authenticated = TRUE; | conn->authenticated = TRUE; | |||
conn->ssl_secured = ssl_secured; | conn->ssl_secured = ssl_secured; | |||
if (pdata_len > 0) { | if (pdata_len > 0) { | |||
if (!i_stream_add_data(conn->conn.input, pdata, pdata_len)) | if (!i_stream_add_data(conn->conn.input, pdata, pdata_len)) | |||
i_panic("Couldn't add client input to stream"); | i_panic("Couldn't add client input to stream"); | |||
skipping to change at line 1520 | skipping to change at line 1521 | |||
return NULL; | return NULL; | |||
return conn->state.trans->id; | return conn->state.trans->id; | |||
} | } | |||
void smtp_server_connection_get_proxy_data(struct smtp_server_connection *conn, | void smtp_server_connection_get_proxy_data(struct smtp_server_connection *conn, | |||
struct smtp_proxy_data *proxy_data) | struct smtp_proxy_data *proxy_data) | |||
{ | { | |||
i_zero(proxy_data); | i_zero(proxy_data); | |||
proxy_data->source_ip = conn->conn.remote_ip; | proxy_data->source_ip = conn->conn.remote_ip; | |||
proxy_data->source_port = conn->conn.remote_port; | proxy_data->source_port = conn->conn.remote_port; | |||
if (conn->helo.domain_valid) | if (conn->proxy_helo != NULL) | |||
proxy_data->helo = conn->proxy_helo; | ||||
else if (conn->helo.domain_valid) | ||||
proxy_data->helo = conn->helo.domain; | proxy_data->helo = conn->helo.domain; | |||
proxy_data->login = conn->username; | proxy_data->login = conn->username; | |||
if (conn->proxy_proto != SMTP_PROXY_PROTOCOL_UNKNOWN) | if (conn->proxy_proto != SMTP_PROXY_PROTOCOL_UNKNOWN) | |||
proxy_data->proto = conn->proxy_proto; | proxy_data->proto = conn->proxy_proto; | |||
else if (conn->set.protocol == SMTP_PROTOCOL_LMTP) | else if (conn->set.protocol == SMTP_PROTOCOL_LMTP) | |||
proxy_data->proto = SMTP_PROXY_PROTOCOL_LMTP; | proxy_data->proto = SMTP_PROXY_PROTOCOL_LMTP; | |||
else if (conn->helo.old_smtp) | else if (conn->helo.old_smtp) | |||
proxy_data->proto = SMTP_PROXY_PROTOCOL_SMTP; | proxy_data->proto = SMTP_PROXY_PROTOCOL_SMTP; | |||
else | else | |||
skipping to change at line 1550 | skipping to change at line 1553 | |||
{ | { | |||
if (proxy_data->source_ip.family != 0) | if (proxy_data->source_ip.family != 0) | |||
conn->conn.remote_ip = proxy_data->source_ip; | conn->conn.remote_ip = proxy_data->source_ip; | |||
if (proxy_data->source_port != 0) | if (proxy_data->source_port != 0) | |||
conn->conn.remote_port = proxy_data->source_port; | conn->conn.remote_port = proxy_data->source_port; | |||
if (proxy_data->helo != NULL) { | if (proxy_data->helo != NULL) { | |||
i_free(conn->helo_domain); | i_free(conn->helo_domain); | |||
conn->helo_domain = i_strdup(proxy_data->helo); | conn->helo_domain = i_strdup(proxy_data->helo); | |||
conn->helo.domain = conn->helo_domain; | conn->helo.domain = conn->helo_domain; | |||
conn->helo.domain_valid = TRUE; | conn->helo.domain_valid = TRUE; | |||
if (conn->helo.domain_valid) { | ||||
i_free(conn->proxy_helo); | ||||
conn->proxy_helo = i_strdup(proxy_data->helo); | ||||
} | ||||
} | } | |||
if (proxy_data->login != NULL) { | if (proxy_data->login != NULL) { | |||
i_free(conn->username); | i_free(conn->username); | |||
conn->username = i_strdup(proxy_data->login); | conn->username = i_strdup(proxy_data->login); | |||
} | } | |||
if (proxy_data->proto != SMTP_PROXY_PROTOCOL_UNKNOWN) | if (proxy_data->proto != SMTP_PROXY_PROTOCOL_UNKNOWN) | |||
conn->proxy_proto = proxy_data->proto; | conn->proxy_proto = proxy_data->proto; | |||
if (proxy_data->ttl_plus_1 > 0) | if (proxy_data->ttl_plus_1 > 0) | |||
conn->proxy_ttl_plus_1 = proxy_data->ttl_plus_1; | conn->proxy_ttl_plus_1 = proxy_data->ttl_plus_1; | |||
if (conn->proxy_timeout_secs > 0) | if (conn->proxy_timeout_secs > 0) | |||
conn->proxy_timeout_secs = proxy_data->timeout_secs; | conn->proxy_timeout_secs = proxy_data->timeout_secs; | |||
if (conn->callbacks != NULL && | if (conn->callbacks != NULL && | |||
conn->callbacks->conn_proxy_data_updated != NULL) { | conn->callbacks->conn_proxy_data_updated != NULL) { | |||
struct smtp_proxy_data full_data; | struct smtp_proxy_data full_data; | |||
i_zero(&full_data); | smtp_server_connection_get_proxy_data(conn, &full_data); | |||
full_data.source_ip = conn->conn.remote_ip; | ||||
full_data.source_port = conn->conn.remote_port; | ||||
full_data.helo = conn->helo.domain; | ||||
full_data.login = conn->username; | ||||
full_data.proto = conn->proxy_proto; | ||||
full_data.ttl_plus_1 = conn->proxy_ttl_plus_1; | ||||
full_data.timeout_secs = conn->proxy_timeout_secs; | ||||
conn->callbacks-> | conn->callbacks-> | |||
conn_proxy_data_updated(conn->context, &full_data); | conn_proxy_data_updated(conn->context, &full_data); | |||
} | } | |||
} | } | |||
void smtp_server_connection_register_mail_param( | void smtp_server_connection_register_mail_param( | |||
struct smtp_server_connection *conn, const char *param) | struct smtp_server_connection *conn, const char *param) | |||
{ | { | |||
param = p_strdup(conn->pool, param); | param = p_strdup(conn->pool, param); | |||
End of changes. 7 change blocks. | ||||
11 lines changed or deleted | 11 lines changed or added |