#include "master-service.h"
#include "master-login.h"
#include "master-interface.h"
+#include "master-admin-client.h"
#include "var-expand.h"
#include "mail-error.h"
#include "mail-user.h"
}
}
+static unsigned int
+master_admin_cmd_kick_user(const char *user, const guid_128_t conn_guid)
+{
+ struct client *client, *next;
+ unsigned int count = 0;
+
+ for (client = pop3_clients; client != NULL; client = next) {
+ next = client->next;
+ if (strcmp(client->user->username, user) == 0 &&
+ (guid_128_is_empty(conn_guid) ||
+ guid_128_cmp(client->anvil_conn_guid, conn_guid) == 0))
+ client_kick(client);
+ }
+ return count;
+}
+
+static const struct master_admin_client_callback admin_callbacks = {
+ .cmd_kick_user = master_admin_cmd_kick_user,
+};
+
static void client_connected(struct master_service_connection *conn)
{
/* when running standalone, we shouldn't even get here */
if (!IS_STANDALONE())
master_login = master_login_init(master_service, &login_set);
+ master_admin_clients_init(&admin_callbacks);
master_service_set_die_callback(master_service, pop3_die);
storage_service =
}
}
-void clients_destroy_all(void)
+void client_kick(struct client *client)
{
- while (pop3_clients != NULL) {
- mail_storage_service_io_activate_user(pop3_clients->service_user);
- if (pop3_clients->cmd == NULL) {
- client_send_line(pop3_clients,
- "-ERR [SYS/TEMP] Server shutting down.");
- }
- client_destroy(pop3_clients, "Server shutting down.");
+ mail_storage_service_io_activate_user(client->service_user);
+ if (client->cmd == NULL) {
+ client_send_line(client,
+ "-ERR [SYS/TEMP] Server shutting down.");
}
+ client_destroy(client, "Server shutting down.");
+}
+
+void clients_destroy_all(void)
+{
+ while (pop3_clients != NULL)
+ client_kick(pop3_clients);
}
struct pop3_client_vfuncs pop3_client_vfuncs = {
/* Disconnect client connection */
void client_disconnect(struct client *client, const char *reason);
+void client_kick(struct client *client);
/* Send a line of data to client */
void client_send_line(struct client *client, const char *fmt, ...)