if (username != NULL) {
if (set->imap_urlauth_submit_user != NULL &&
strcmp(set->imap_urlauth_submit_user, username) == 0) {
- if (set->mail_debug)
- i_debug("User %s has URLAUTH submit access", username);
+ e_debug(client->event, "User %s has URLAUTH submit access", username);
app = "submit+";
array_append(&client->access_apps, &app, 1);
}
if (set->imap_urlauth_stream_user != NULL &&
strcmp(set->imap_urlauth_stream_user, username) == 0) {
- if (set->mail_debug)
- i_debug("User %s has URLAUTH stream access", username);
+ e_debug(client->event, "User %s has URLAUTH stream access", username);
app = "stream";
array_append(&client->access_apps, &app, 1);
}
socket_path = t_strconcat(client->set->base_dir,
"/"IMAP_URLAUTH_WORKER_SOCKET, NULL);
- if (client->set->mail_debug)
- i_debug("Connecting to worker socket %s", socket_path);
+ e_debug(client->event, "Connecting to worker socket %s", socket_path);
client->fd_ctrl = net_connect_unix_with_retries(socket_path, 1000);
if (client->fd_ctrl < 0) {
return -1;
}
- if (client->set->mail_debug)
- i_debug("Worker finished successfully");
+ e_debug(client->event, "Worker finished successfully");
if (restart) {
/* connect to new worker for accessing different user */
if (target == NULL || conn->state != IMAP_URLAUTH_STATE_AUTHENTICATED)
return;
- if (conn->user->mail_debug)
- i_debug("imap-urlauth: Selecting target user `%s'", target->userid);
+ e_debug(conn->user->event,
+ "imap-urlauth: Selecting target user `%s'", target->userid);
conn->state = IMAP_URLAUTH_STATE_SELECTING_TARGET;
cmd = t_strdup_printf("USER\t%s\n", str_tabescape(target->userid));
(conn->targets_head->requests_head == NULL &&
conn->targets_head->next == NULL &&
conn->state == IMAP_URLAUTH_STATE_READY)) {
- if (conn->user->mail_debug)
- i_debug("imap-urlauth: No more requests pending; scheduling disconnect");
+ e_debug(conn->user->event,
+ "imap-urlauth: No more requests pending; scheduling disconnect");
timeout_remove(&conn->to_idle);
if (conn->idle_timeout_msecs > 0) {
conn->to_idle = timeout_add(conn->idle_timeout_msecs,
return;
}
- if (conn->user->mail_debug)
- i_debug("imap-urlauth: Fetching URL `%s'", urlreq->url);
+ e_debug(conn->user->event,
+ "imap-urlauth: Fetching URL `%s'", urlreq->url);
cmd = t_str_new(128);
str_append(cmd, "URL\t");
timeout_remove(&conn->to_idle);
- if (conn->user->mail_debug) {
- i_debug("imap-urlauth: Added request for URL `%s' from user `%s'",
- url, target_user);
- }
+ e_debug(conn->user->event,
+ "imap-urlauth: Added request for URL `%s' from user `%s'",
+ url, target_user);
imap_urlauth_connection_send_request(conn);
return urlreq;
return -1;
}
- if (conn->user->mail_debug) {
- if (conn->state == IMAP_URLAUTH_STATE_AUTHENTICATING)
- i_debug("imap-urlauth: Successfully authenticated to service");
- else
- i_debug("imap-urlauth: Successfully unselected target user");
+ if (conn->state == IMAP_URLAUTH_STATE_AUTHENTICATING) {
+ e_debug(conn->user->event,
+ "imap-urlauth: Successfully authenticated to service");
+ } else {
+ e_debug(conn->user->event,
+ "imap-urlauth: Successfully unselected target user");
}
conn->state = IMAP_URLAUTH_STATE_AUTHENTICATED;
i_assert(conn->targets_head != NULL);
if (strcasecmp(response, "NO") == 0) {
- if (conn->user->mail_debug) {
- i_debug("imap-urlauth: Failed to select target user %s",
- conn->targets_head->userid);
- }
+ e_debug(conn->user->event,
+ "imap-urlauth: Failed to select target user %s",
+ conn->targets_head->userid);
imap_urlauth_target_fail(conn, conn->targets_head, NULL);
conn->state = IMAP_URLAUTH_STATE_AUTHENTICATED;
return -1;
}
- if (conn->user->mail_debug) {
- i_debug("imap-urlauth: Successfully selected target user %s",
- conn->targets_head->userid);
- }
+ e_debug(conn->user->event,
+ "imap-urlauth: Successfully selected target user %s",
+ conn->targets_head->userid);
conn->state = IMAP_URLAUTH_STATE_READY;
imap_urlauth_connection_send_request(conn);
return 0;
return -1;
}
- if (conn->user->mail_debug)
- i_debug("imap-urlauth: Connecting to service at %s", conn->path);
+ e_debug(conn->user->event, "imap-urlauth: Connecting to service at %s", conn->path);
i_assert(conn->fd == -1);
fd = net_connect_unix(conn->path);
conn->state = IMAP_URLAUTH_STATE_DISCONNECTED;
if (conn->fd != -1) {
- if (conn->user->mail_debug) {
- if (reason == NULL)
- i_debug("imap-urlauth: Disconnecting from service");
- else
- i_debug("imap-urlauth: Disconnected: %s", reason);
- }
+ if (reason == NULL)
+ e_debug(conn->user->event, "imap-urlauth: Disconnecting from service");
+ else
+ e_debug(conn->user->event, "imap-urlauth: Disconnected: %s", reason);
io_remove(&conn->io);
i_stream_destroy(&conn->input);
}
if (ioloop_time - conn->last_reconnect < IMAP_URLAUTH_RECONNECT_MIN_SECS) {
- if (conn->user->mail_debug)
- i_debug("imap-urlauth: Scheduling reconnect");
+ e_debug(conn->user->event, "imap-urlauth: Scheduling reconnect");
timeout_remove(&conn->to_reconnect);
conn->to_reconnect =
timeout_add(IMAP_URLAUTH_RECONNECT_MIN_SECS*1000,
if (imap_url_parse(url, NULL, url_parse_flags, &imap_url, &error) < 0) {
errormsg = t_strdup_printf(
"Failed to fetch URLAUTH \"%s\": %s", url, error);
- if (mail_user->mail_debug)
- i_debug("%s", errormsg);
+ e_debug(mail_user->event, "%s", errormsg);
ufetch->pending_requests++;
imap_urlauth_fetch_ref(ufetch);
imap_urlauth_fetch_error(ufetch, url, url_flags, errormsg);
} else if (!imap_urlauth_check(uctx, imap_url, TRUE, &error)) {
errormsg = t_strdup_printf(
"Failed to fetch URLAUTH \"%s\": %s", url, error);
- if (mail_user->mail_debug)
- i_debug("%s", errormsg);
+ e_debug(mail_user->event, "%s", errormsg);
imap_urlauth_fetch_error(ufetch, url, url_flags, errormsg);
imap_url = NULL;
}