diff --git a/src/managesieve-login/client.c b/src/managesieve-login/client.c index e3ee3e124bf833f79d6a7255cc3b9e987e645bf5..f792188220d6b040fe579616354b27f4c5b60857 100644 --- a/src/managesieve-login/client.c +++ b/src/managesieve-login/client.c @@ -11,7 +11,6 @@ #include "strescape.h" #include "base64.h" #include "master-service.h" -#include "master-auth.h" #include "auth-client.h" #include "managesieve-parser.h" diff --git a/src/managesieve/main.c b/src/managesieve/main.c index 4dc1c89d24164ce6036dedef309239c3989a6a59..e4414fab182798a5ce63ffef36e1d040c8217c7e 100644 --- a/src/managesieve/main.c +++ b/src/managesieve/main.c @@ -16,7 +16,7 @@ #include "master-interface.h" #include "master-admin-client.h" #include "master-service.h" -#include "master-login.h" +#include "login-server.h" #include "mail-user.h" #include "mail-storage-service.h" @@ -34,7 +34,7 @@ static bool verbose_proctitle = FALSE; static struct mail_storage_service_ctx *storage_service; -static struct master_login *master_login = NULL; +static struct login_server *login_server = NULL; void (*hook_client_created)(struct client **client) = NULL; @@ -224,35 +224,35 @@ static void main_stdio_run(const char *username) } static void -login_client_connected(const struct master_login_client *client, +login_request_finished(const struct login_server_request *request, const char *username, const char *const *extra_fields) { #define MSG_BYE_INTERNAL_ERROR "BYE \""CRITICAL_MSG"\"\r\n" struct mail_storage_service_input input; - enum mail_auth_request_flags flags = client->auth_req.flags; + enum login_request_flags flags = request->auth_req.flags; const char *error; buffer_t input_buf; i_zero(&input); input.module = "managesieve"; input.service = "sieve"; - input.local_ip = client->auth_req.local_ip; - input.remote_ip = client->auth_req.remote_ip; - input.local_port = client->auth_req.local_port; - input.remote_port = client->auth_req.remote_port; + input.local_ip = request->auth_req.local_ip; + input.remote_ip = request->auth_req.remote_ip; + input.local_port = request->auth_req.local_port; + input.remote_port = request->auth_req.remote_port; input.username = username; input.userdb_fields = extra_fields; - input.session_id = client->session_id; - if ((flags & MAIL_AUTH_REQUEST_FLAG_CONN_SECURED) != 0) + input.session_id = request->session_id; + if ((flags & LOGIN_REQUEST_FLAG_CONN_SECURED) != 0) input.conn_secured = TRUE; - if ((flags & MAIL_AUTH_REQUEST_FLAG_CONN_SSL_SECURED) != 0) + if ((flags & LOGIN_REQUEST_FLAG_CONN_SSL_SECURED) != 0) input.conn_ssl_secured = TRUE; - buffer_create_from_const_data(&input_buf, client->data, - client->auth_req.data_size); - if (client_create_from_input(&input, client->fd, client->fd, + buffer_create_from_const_data(&input_buf, request->data, + request->auth_req.data_size); + if (client_create_from_input(&input, request->fd, request->fd, &input_buf, &error) < 0) { - int fd = client->fd; + int fd = request->fd; if (write(fd, MSG_BYE_INTERNAL_ERROR, strlen(MSG_BYE_INTERNAL_ERROR)) < 0) { @@ -266,13 +266,13 @@ login_client_connected(const struct master_login_client *client, } static void -login_client_failed(const struct master_login_client *client, - const char *errormsg) +login_request_failed(const struct login_server_request *request, + const char *errormsg) { const char *msg; msg = t_strdup_printf("NO \"%s\"\r\n", errormsg); - if (write(client->fd, msg, strlen(msg)) < 0) { + if (write(request->fd, msg, strlen(msg)) < 0) { /* ignored */ } } @@ -300,10 +300,10 @@ static const struct master_admin_client_callback admin_callbacks = { static void client_connected(struct master_service_connection *conn) { /* when running standalone, we shouldn't even get here */ - i_assert(master_login != NULL); + i_assert(login_server != NULL); master_service_client_connection_accept(conn); - master_login_add(master_login, conn->fd); + login_server_add(login_server, conn->fd); } int main(int argc, char *argv[]) @@ -312,14 +312,15 @@ int main(int argc, char *argv[]) &managesieve_setting_parser_info, NULL }; - struct master_login_settings login_set; + struct login_server_settings login_set; enum master_service_flags service_flags = 0; enum mail_storage_service_flags storage_service_flags = 0; const char *username = NULL, *error = NULL; int c; i_zero(&login_set); - login_set.postlogin_timeout_secs = MASTER_POSTLOGIN_TIMEOUT_DEFAULT; + login_set.postlogin_timeout_secs = + LOGIN_SERVER_POSTLOGIN_TIMEOUT_DEFAULT; if (IS_STANDALONE() && getuid() == 0 && net_getpeername(1, NULL, NULL) == 0) { @@ -382,11 +383,11 @@ int main(int argc, char *argv[]) i_fatal("t_abspath(%s) failed: %s", argv[optind], error); } - login_set.callback = login_client_connected; - login_set.failure_callback = login_client_failed; + login_set.callback = login_request_finished; + login_set.failure_callback = login_request_failed; if (!IS_STANDALONE()) - master_login = master_login_init(master_service, &login_set); + login_server = login_server_init(master_service, &login_set); storage_service = mail_storage_service_init(master_service, @@ -411,8 +412,8 @@ int main(int argc, char *argv[]) master_service_run(master_service, client_connected); clients_destroy_all(); - if (master_login != NULL) - master_login_deinit(&master_login); + if (login_server != NULL) + login_server_deinit(&login_server); mail_storage_service_deinit(&storage_service); commands_deinit();