submission-client.c (dovecot-2.3.16) | : | submission-client.c (dovecot-2.3.17) | ||
---|---|---|---|---|
skipping to change at line 177 | skipping to change at line 177 | |||
"/"IMAP_URLAUTH_SOCKET_NAME, NULL); | "/"IMAP_URLAUTH_SOCKET_NAME, NULL); | |||
config.session_id = client->user->session_id; | config.session_id = client->user->session_id; | |||
config.access_anonymous = client->user->anonymous; | config.access_anonymous = client->user->anonymous; | |||
config.access_user = client->user->username; | config.access_user = client->user->username; | |||
config.access_service = "submission"; | config.access_service = "submission"; | |||
config.access_applications = access_apps; | config.access_applications = access_apps; | |||
client->urlauth_ctx = imap_urlauth_init(client->user, &config); | client->urlauth_ctx = imap_urlauth_init(client->user, &config); | |||
} | } | |||
struct client *client_create(int fd_in, int fd_out, | struct client * | |||
struct mail_user *user, | client_create(int fd_in, int fd_out, struct mail_user *user, | |||
struct mail_storage_service_user *service_user, | struct mail_storage_service_user *service_user, | |||
const struct submission_settings *set, | const struct submission_settings *set, const char *helo, | |||
const char *helo, | const struct smtp_proxy_data *proxy_data, | |||
const unsigned char *pdata, unsigned int pdata_len) | const unsigned char *pdata, unsigned int pdata_len) | |||
{ | { | |||
enum submission_client_workarounds workarounds = | enum submission_client_workarounds workarounds = | |||
set->parsed_workarounds; | set->parsed_workarounds; | |||
const struct mail_storage_settings *mail_set; | const struct mail_storage_settings *mail_set; | |||
struct smtp_server_settings smtp_set; | struct smtp_server_settings smtp_set; | |||
const char *ident; | const char *ident; | |||
struct client *client; | struct client *client; | |||
pool_t pool; | pool_t pool; | |||
/* always use nonblocking I/O */ | /* always use nonblocking I/O */ | |||
skipping to change at line 233 | skipping to change at line 233 | |||
SMTP_SERVER_WORKAROUND_MAILBOX_FOR_PATH; | SMTP_SERVER_WORKAROUND_MAILBOX_FOR_PATH; | |||
} | } | |||
client_parse_backend_capabilities(client); | client_parse_backend_capabilities(client); | |||
p_array_init(&client->module_contexts, client->pool, 5); | p_array_init(&client->module_contexts, client->pool, 5); | |||
client->conn = smtp_server_connection_create(smtp_server, | client->conn = smtp_server_connection_create(smtp_server, | |||
fd_in, fd_out, user->conn.remote_ip, user->conn.remote_port, | fd_in, fd_out, user->conn.remote_ip, user->conn.remote_port, | |||
FALSE, &smtp_set, &smtp_callbacks, client); | FALSE, &smtp_set, &smtp_callbacks, client); | |||
smtp_server_connection_login(client->conn, | smtp_server_connection_set_proxy_data(client->conn, proxy_data); | |||
client->user->username, helo, | smtp_server_connection_login(client->conn, client->user->username, helo, | |||
pdata, pdata_len, user->conn.ssl_secured); | pdata, pdata_len, user->conn.ssl_secured); | |||
client_create_backend_default(client, set); | client_create_backend_default(client, set); | |||
mail_set = mail_user_set_get_storage_set(user); | mail_set = mail_user_set_get_storage_set(user); | |||
if (*set->imap_urlauth_host != '\0' && | if (*set->imap_urlauth_host != '\0' && | |||
*mail_set->mail_attribute_dict != '\0') { | *mail_set->mail_attribute_dict != '\0') { | |||
/* Enable BURL capability only when urlauth dict is | /* Enable BURL capability only when urlauth dict is | |||
configured correctly */ | configured correctly */ | |||
client_init_urlauth(client); | client_init_urlauth(client); | |||
} | } | |||
submission_client_count++; | submission_client_count++; | |||
DLLIST_PREPEND(&submission_clients, client); | DLLIST_PREPEND(&submission_clients, client); | |||
ident = mail_user_get_anvil_userip_ident(client->user); | ident = mail_user_get_anvil_userip_ident(client->user); | |||
if (ident != NULL) { | if (ident != NULL) { | |||
master_service_anvil_send(master_service, t_strconcat( | master_service_anvil_send( | |||
"CONNECT\t", my_pid, "\tsubmission/", | master_service, t_strconcat( | |||
ident, "\n", NULL)); | "CONNECT\t", my_pid, "\tsubmission/", ident, | |||
"\n", NULL)); | ||||
client->anvil_sent = TRUE; | client->anvil_sent = TRUE; | |||
} | } | |||
if (hook_client_created != NULL) | if (hook_client_created != NULL) | |||
hook_client_created(&client); | hook_client_created(&client); | |||
if (user->anonymous && !client->anonymous_allowed) { | if (user->anonymous && !client->anonymous_allowed) { | |||
smtp_server_connection_abort( | smtp_server_connection_abort( | |||
&client->conn, 534, "5.7.9", | &client->conn, 534, "5.7.9", | |||
"Anonymous login is not allowed for submission"); | "Anonymous login is not allowed for submission"); | |||
skipping to change at line 294 | skipping to change at line 295 | |||
} | } | |||
void client_destroy(struct client **_client, const char *prefix, | void client_destroy(struct client **_client, const char *prefix, | |||
const char *reason) | const char *reason) | |||
{ | { | |||
struct client *client = *_client; | struct client *client = *_client; | |||
struct smtp_server_connection *conn = client->conn; | struct smtp_server_connection *conn = client->conn; | |||
*_client = NULL; | *_client = NULL; | |||
smtp_server_connection_terminate(&conn, | smtp_server_connection_terminate( | |||
(prefix == NULL ? "4.0.0" : prefix), reason); | &conn, (prefix == NULL ? "4.0.0" : prefix), reason); | |||
} | } | |||
static void | static void | |||
client_default_destroy(struct client *client) | client_default_destroy(struct client *client) | |||
{ | { | |||
i_assert(client->disconnected); | i_assert(client->disconnected); | |||
if (client->destroyed) | if (client->destroyed) | |||
return; | return; | |||
client->destroyed = TRUE; | client->destroyed = TRUE; | |||
submission_backends_destroy_all(client); | submission_backends_destroy_all(client); | |||
array_free(&client->pending_backends); | array_free(&client->pending_backends); | |||
array_free(&client->rcpt_to); | array_free(&client->rcpt_to); | |||
array_free(&client->rcpt_backends); | array_free(&client->rcpt_backends); | |||
submission_client_count--; | submission_client_count--; | |||
DLLIST_REMOVE(&submission_clients, client); | DLLIST_REMOVE(&submission_clients, client); | |||
if (client->anvil_sent) { | if (client->anvil_sent) { | |||
master_service_anvil_send(master_service, t_strconcat( | master_service_anvil_send( | |||
"DISCONNECT\t", my_pid, "\tsubmission/", | master_service, t_strconcat( | |||
mail_user_get_anvil_userip_ident(client->user), | "DISCONNECT\t", my_pid, "\tsubmission/", | |||
"\n", NULL)); | mail_user_get_anvil_userip_ident(client->user), | |||
"\n", NULL)); | ||||
} | } | |||
if (client->urlauth_ctx != NULL) | if (client->urlauth_ctx != NULL) | |||
imap_urlauth_deinit(&client->urlauth_ctx); | imap_urlauth_deinit(&client->urlauth_ctx); | |||
mail_user_deinit(&client->user); | mail_user_deinit(&client->user); | |||
mail_storage_service_user_unref(&client->service_user); | mail_storage_service_user_unref(&client->service_user); | |||
client_state_reset(client); | client_state_reset(client); | |||
End of changes. 5 change blocks. | ||||
18 lines changed or deleted | 20 lines changed or added |