From d08aa9639b8108bf10552bc25e4e1fc166dbdaf7 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Tue, 15 Aug 2023 13:03:21 -0400 Subject: [PATCH] mail-crypt: Remove fs-mail-crypt plugin After the following changes fs-crypt can do everything fs-mail-crypt could. --- src/plugins/mail-crypt/Makefile.am | 10 +--- src/plugins/mail-crypt/fs-mail-crypt.c | 75 -------------------------- 2 files changed, 1 insertion(+), 84 deletions(-) delete mode 100644 src/plugins/mail-crypt/fs-mail-crypt.c diff --git a/src/plugins/mail-crypt/Makefile.am b/src/plugins/mail-crypt/Makefile.am index a69a2de279..3c7b9d5c36 100644 --- a/src/plugins/mail-crypt/Makefile.am +++ b/src/plugins/mail-crypt/Makefile.am @@ -21,8 +21,7 @@ NOPLUGIN_LDFLAGS = module_LTLIBRARIES = \ lib10_mail_crypt_plugin.la \ lib05_mail_crypt_acl_plugin.la \ - libfs_crypt.la \ - libfs_mail_crypt.la + libfs_crypt.la doveadm_module_LTLIBRARIES = \ libdoveadm_mail_crypt_plugin.la @@ -57,13 +56,6 @@ libfs_crypt_la_LIBADD = $(LIBDOVECOT) libfs_crypt_la_DEPENDENCIES = $(LIBDOVECOT_DEPS) libfs_crypt_la_LDFLAGS = -module -avoid-version -libfs_mail_crypt_la_SOURCES = fs-mail-crypt.c \ - mail-crypt-global-key.c \ - mail-crypt-userenv.c -libfs_mail_crypt_la_LIBADD = $(LIBDOVECOT) -libfs_mail_crypt_la_DEPENDENCIES = $(LIBDOVECOT_DEPS) -libfs_mail_crypt_la_LDFLAGS = -module -avoid-version - libdoveadm_mail_crypt_plugin_la_SOURCES = \ doveadm-mail-crypt.c libdoveadm_mail_crypt_plugin_la_LIBADD = $(LIBDOVECOT) diff --git a/src/plugins/mail-crypt/fs-mail-crypt.c b/src/plugins/mail-crypt/fs-mail-crypt.c deleted file mode 100644 index 5669f254df..0000000000 --- a/src/plugins/mail-crypt/fs-mail-crypt.c +++ /dev/null @@ -1,75 +0,0 @@ -/* Copyright (c) 2015-2018 Dovecot authors, see the included COPYING file */ -#define FS_CLASS_CRYPT fs_class_mail_crypt -#include "fs-crypt-common.c" - -static -int fs_crypt_load_keys(struct crypt_fs *fs, const char **error_r) -{ - struct mailbox_list *list = mailbox_list_fs_get_list(&fs->fs); - const char *error; - - if (fs->keys_loaded) - return 0; - if (fs->public_key_path != NULL || fs->private_key_path != NULL) { - /* overrides using settings */ - if (fs_crypt_load_keys_from_path(fs, error_r) < 0) - return -1; - fs->keys_loaded = TRUE; - return 0; - } - if (list == NULL) { - *error_r = "fs-mail-crypt can be used only via lib-storage"; - return -1; - } - - struct mail_namespace *ns = mailbox_list_get_namespace(list); - if (null_strcmp(mail_user_plugin_getenv(ns->user, "mail_crypt_save_version"), "0") == 0) - fs->allow_missing_keys = TRUE; - if (mail_crypt_global_keys_load(ns->user, - fs->set_prefix, &fs->keys, FALSE, - &error) < 0) { - *error_r = t_strdup_printf("%s: %s", fs->set_prefix, error); - return -1; - } - fs->keys_loaded = TRUE; - return 0; -} - -const struct fs fs_class_mail_crypt = { - .name = "mail-crypt", - .v = { - .alloc = fs_crypt_alloc, - .legacy_init = fs_crypt_init, - .deinit = NULL, - .free = fs_crypt_free, - .get_properties = fs_wrapper_get_properties, - .file_alloc = fs_crypt_file_alloc, - .file_init = fs_crypt_file_init, - .file_deinit = fs_crypt_file_deinit, - .file_close = fs_crypt_file_close, - .get_path = fs_wrapper_file_get_path, - .set_async_callback = fs_wrapper_set_async_callback, - .wait_async = fs_wrapper_wait_async, - .set_metadata = fs_crypt_set_metadata, - .get_metadata = fs_wrapper_get_metadata, - .prefetch = fs_wrapper_prefetch, - .read = fs_read_via_stream, - .read_stream = fs_crypt_read_stream, - .write = fs_write_via_stream, - .write_stream = fs_crypt_write_stream, - .write_stream_finish = fs_crypt_write_stream_finish, - .lock = fs_wrapper_lock, - .unlock = fs_wrapper_unlock, - .exists = fs_wrapper_exists, - .stat = fs_wrapper_stat, - .copy = fs_wrapper_copy, - .rename = fs_wrapper_rename, - .delete_file = fs_wrapper_delete, - .iter_alloc = fs_wrapper_iter_alloc, - .iter_init = fs_wrapper_iter_init, - .iter_next = fs_wrapper_iter_next, - .iter_deinit = fs_wrapper_iter_deinit, - .switch_ioloop = NULL, - .get_nlinks = fs_wrapper_get_nlinks, - } -}; -- 2.47.3