return t_strconcat(t_strdup_until(line, p), PASSWORD_HIDDEN_STR, NULL);
}
+static bool
+auth_client_cancel(struct auth_client_connection *conn, const char *line)
+{
+ unsigned int client_id;
+
+ if (str_to_uint(line, &client_id) < 0) {
+ i_error("BUG: Authentication client sent broken CANCEL");
+ return FALSE;
+ }
+
+ auth_request_handler_cancel_request(conn->request_handler, client_id);
+ return TRUE;
+}
+
static bool
auth_client_handle_line(struct auth_client_connection *conn, const char *line)
{
return auth_request_handler_auth_continue(conn->request_handler,
line + 5);
}
+ if (strncmp(line, "CANCEL\t", 7) == 0) {
+ if (conn->auth->set->debug)
+ i_debug("client in: %s", line);
+ return auth_client_cancel(conn, line + 7);
+ }
i_error("BUG: Authentication client sent unknown command: %s",
str_sanitize(line, 80));
return TRUE;
}
+void auth_request_handler_cancel_request(struct auth_request_handler *handler,
+ unsigned int client_id)
+{
+ struct auth_request *request;
+
+ request = hash_table_lookup(handler->requests, POINTER_CAST(client_id));
+ if (request != NULL)
+ auth_request_handler_remove(handler, request);
+}
+
void auth_request_handler_flush_failures(bool flush_all)
{
struct auth_request **auth_requests, *auth_request;
struct auth_master_connection *master,
unsigned int id,
unsigned int client_id);
+void auth_request_handler_cancel_request(struct auth_request_handler *handler,
+ unsigned int client_id);
void auth_request_handler_flush_failures(bool flush_all);
void auth_client_request_abort(struct auth_client_request **_request)
{
struct auth_client_request *request = *_request;
+ const char *str = t_strdup_printf("CANCEL\t%u\n", request->id);
*_request = NULL;
+ if (o_stream_send_str(request->conn->output, str) < 0)
+ i_error("Error sending request to auth server: %m");
+
request->callback(request, AUTH_REQUEST_STATUS_FAIL, NULL, NULL,
request->context);
request->callback = NULL;
if (status != AUTH_REQUEST_STATUS_CONTINUE)
pool_unref(&request->pool);
}
+
+void auth_client_send_cancel(struct auth_client *client, unsigned int id)
+{
+ const char *str = t_strdup_printf("CANCEL\t%u\n", id);
+
+ if (o_stream_send_str(client->conn->output, str) < 0)
+ i_error("Error sending request to auth server: %m");
+}
/* Return cookie of the server that handled this request. */
const char *auth_client_request_get_cookie(struct auth_client_request *request);
+/* Tell auth process to drop specified request from memory */
+void auth_client_send_cancel(struct auth_client *client, unsigned int id);
+
#endif
master_auth_callback, client, &client->master_tag);
}
+static void master_abort_request(struct anvil_request *anvil_request)
+{
+ const char *cookie;
+
+ cookie = binary_to_hex(anvil_request->cookie,
+ sizeof(anvil_request->cookie));
+ auth_client_send_cancel(auth_client, anvil_request->auth_id);
+}
+
static void anvil_lookup_callback(const char *reply, void *context)
{
struct anvil_request *req = context;
set->mail_max_userip_connections);
call_client_callback(client, SASL_SERVER_REPLY_MASTER_FAILED,
errmsg, NULL);
+ master_abort_request(req);
}
i_free(req);
}