{
struct login_proxy_settings proxy_set;
const struct dsasl_client_mech *sasl_mech = NULL;
+ struct event *event;
i_assert(reply->destuser != NULL);
i_assert(client->refcount > 1);
client->proxy_mech = NULL;
client->v.proxy_reset(client);
+ event = event_create(client->event);
+ event_set_append_log_prefix(event, t_strdup_printf(
+ "proxy(%s): ", client->virtual_user));
if (!proxy_check_start(client, reply, &sasl_mech)) {
client_proxy_error(client, PROXY_FAILURE_MSG);
+ event_unref(&event);
return -1;
}
proxy_set.notify_refresh_secs = reply->proxy_refresh_secs;
proxy_set.ssl_flags = reply->ssl_flags;
- if (login_proxy_new(client, &proxy_set, proxy_input) < 0) {
+ if (login_proxy_new(client, event, &proxy_set, proxy_input) < 0) {
+ event_unref(&event);
client_proxy_error(client, PROXY_FAILURE_MSG);
return -1;
}
+ event_unref(&event);
client->proxy_mech = sasl_mech;
client->proxy_user = i_strdup(reply->destuser);
struct login_proxy *prev, *next;
struct client *client;
+ struct event *event;
int server_fd;
struct io *client_wait_io, *server_io;
struct istream *client_input, *server_input;
return 0;
}
-int login_proxy_new(struct client *client,
+int login_proxy_new(struct client *client, struct event *event,
const struct login_proxy_settings *set,
proxy_callback_t *callback)
{
if (set->host == NULL || *set->host == '\0') {
e_error(client->event,
"proxy(%s): host not given", client->virtual_user);
+ event_unref(&event);
return -1;
}
e_error(client->event,
"proxy(%s): TTL reached zero - "
"proxies appear to be looping?", client->virtual_user);
+ event_unref(&event);
return -1;
}
proxy = i_new(struct login_proxy, 1);
proxy->client = client;
+ proxy->event = event;
proxy->server_fd = -1;
proxy->created = ioloop_timeval;
proxy->ip = set->ip;
proxy->state_rec = login_proxy_state_get(proxy_state, &proxy->ip,
proxy->port);
client_ref(client);
+ event_ref(proxy->event);
if (login_proxy_connect(proxy) < 0) {
login_proxy_free(&proxy);
i_stream_destroy(&proxy->client_input);
o_stream_destroy(&proxy->client_output);
client_unref(&proxy->client);
+ event_unref(&proxy->event);
i_free(proxy->host);
i_free(proxy);
}
/* Create a proxy to given host. Returns NULL if failed. Given callback is
called when new input is available from proxy. */
-int login_proxy_new(struct client *client,
+int login_proxy_new(struct client *client, struct event *event,
const struct login_proxy_settings *set,
proxy_callback_t *callback);
/* Free the proxy. This should be called if authentication fails. */