return &imap_client->common;
}
-static void imap_client_create(struct client *client, void **other_sets)
+static int imap_client_create(struct client *client, void **other_sets)
{
struct imap_client *imap_client = (struct imap_client *)client;
if (imap_client->set->imap_literal_minus)
imap_parser_enable_literal_minus(imap_client->parser);
client->io = io_add_istream(client->input, client_input, client);
+ return 0;
}
static void imap_client_destroy(struct client *client)
return &uauth_client->common;
}
-static void imap_urlauth_client_create
+static int imap_urlauth_client_create
(struct client *client, void **other_sets)
{
struct imap_urlauth_client *uauth_client =
uauth_client->set = other_sets[0];
client->io = io_add_istream(client->input, client_input, client);
+ return 0;
}
static void imap_urlauth_client_notify_auth_ready(struct client *client)
return client;
}
-void client_init(struct client *client, void **other_sets)
+int client_init(struct client *client, void **other_sets)
{
if (last_client == NULL)
last_client = client;
client_idle_disconnect_timeout, client);
hook_login_client_allocated(client);
- client->v.create(client, other_sets);
+ if (client->v.create(client, other_sets) < 0)
+ return -1;
client->create_finished = TRUE;
if (auth_client_is_connected(auth_client))
client_set_auth_waiting(client);
login_refresh_proctitle();
+ return 0;
}
static void client_disconnected_log(struct event *event, const char *reason,
struct client_vfuncs {
struct client *(*alloc)(pool_t pool);
- void (*create)(struct client *client, void **other_sets);
+ int (*create)(struct client *client, void **other_sets);
void (*destroy)(struct client *client);
void (*notify_auth_ready)(struct client *client);
void (*notify_disconnect)(struct client *client,
const struct login_settings *set,
const struct master_service_ssl_settings *ssl_set,
const struct master_service_ssl_server_settings *ssl_server_set);
-void client_init(struct client *client, void **other_sets);
+int client_init(struct client *client, void **other_sets);
void client_disconnect(struct client *client, const char *reason,
bool add_disconnected_prefix);
void client_destroy(struct client *client, const char *reason);
return;
}
}
- client_init(client, other_sets);
+ if (client_init(client, other_sets) < 0) {
+ client_destroy(client, "Failed to initialize client");
+ return;
+ }
client->event_auth = event_create(client->event);
event_add_category(client->event_auth, &event_category_auth);
event_set_min_log_level(client->event_auth, set->auth_verbose ?
return &pop3_client->common;
}
-static void pop3_client_create(struct client *client ATTR_UNUSED,
- void **other_sets ATTR_UNUSED)
+static int pop3_client_create(struct client *client ATTR_UNUSED,
+ void **other_sets ATTR_UNUSED)
{
+ return 0;
}
static void pop3_client_destroy(struct client *client)
return &subm_client->common;
}
-static void submission_client_create(struct client *client,
- void **other_sets)
+static int submission_client_create(struct client *client,
+ void **other_sets)
{
static const char *const xclient_extensions[] =
{ "FORWARD", NULL };
smtp_server, client->input, client->output,
&client->real_remote_ip, client->real_remote_port,
&smtp_set, &smtp_callbacks, subm_client);
+ return 0;
}
static void submission_client_destroy(struct client *client)