"Failed to initialize SSL server context: %s", error);
return -1;
}
- if (io_stream_create_ssl_server(ssl_ctx, &ssl_set,
- &client->input, &client->output,
- &client->ssl_iostream, &error) < 0) {
+ if (client->v.iostream_change_pre != NULL)
+ client->v.iostream_change_pre(client);
+ int ret = io_stream_create_ssl_server(ssl_ctx, &ssl_set,
+ &client->input, &client->output,
+ &client->ssl_iostream, &error);
+ if (client->v.iostream_change_post != NULL)
+ client->v.iostream_change_post(client);
+ if (ret < 0) {
e_error(client->event,
"Failed to initialize SSL connection: %s", error);
ssl_iostream_context_unref(&ssl_ctx);
void (*notify_starttls)(struct client *client,
bool success, const char *text);
void (*starttls)(struct client *client);
+
+ /* Called just before client iostreams are changed (e.g. STARTTLS).
+ iostream_change_post() is guaranteed to be called. */
+ void (*iostream_change_pre)(struct client *client);
+ /* Called just after client iostreams may have changed. Nothing may
+ have happened in case of unexpected errors. */
+ void (*iostream_change_post)(struct client *client);
+
void (*input)(struct client *client);
bool (*sasl_filter_mech)(struct client *client,
struct auth_mech_desc *mech);