bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch/* Copyright (c) 2011-2018 Dovecot authors, see the included COPYING file */
d9e404180ff26dbbaea68534a5f176765022b76bTimo Sirainenstatic struct mail_storage_service_ctx *storage_service;
d9e404180ff26dbbaea68534a5f176765022b76bTimo Sirainenstatic void client_connected(struct master_service_connection *conn)
d9e404180ff26dbbaea68534a5f176765022b76bTimo Sirainen i_error("indexer-worker must be configured with client_limit=1");
d9e404180ff26dbbaea68534a5f176765022b76bTimo Sirainen master_service_client_connection_accept(conn);
d9e404180ff26dbbaea68534a5f176765022b76bTimo Sirainen master_conn = master_connection_create(conn->fd, storage_service);
d9e404180ff26dbbaea68534a5f176765022b76bTimo Sirainen /* by default we don't drop any privileges, but keep running as root. */
d9e404180ff26dbbaea68534a5f176765022b76bTimo Sirainen /* open config connection before dropping privileges */
d9e404180ff26dbbaea68534a5f176765022b76bTimo Sirainen (void)master_service_settings_read(master_service,
816d20be0cf95fc4eb1a8aa716639e73b8ba525eMartti Rannanjärvi restrict_access_by_env(RESTRICT_ACCESS_FLAG_ALLOW_ROOT, NULL);
d9e404180ff26dbbaea68534a5f176765022b76bTimo Sirainen enum mail_storage_service_flags storage_service_flags =
5cba8fd913459269b521513e16e3afcbbd030ac5Timo Sirainen master_service = master_service_init("indexer-worker", service_flags,
9a4e08ad8a4cd4ee70e0c47e3e2eb1ee9f9a818dTimo Sirainen while ((c = master_getopt(master_service)) > 0) {
d9e404180ff26dbbaea68534a5f176765022b76bTimo Sirainen master_service_init_log(master_service, "indexer-worker: ");
d9e404180ff26dbbaea68534a5f176765022b76bTimo Sirainen storage_service = mail_storage_service_init(master_service, NULL,
d9e404180ff26dbbaea68534a5f176765022b76bTimo Sirainen master_service_run(master_service, client_connected);