]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
fs-crypt: Rename crypt_plain_fallback setting fs_crypt_read_plain_fallback
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Sat, 26 Aug 2023 21:19:01 +0000 (17:19 -0400)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 12 Feb 2025 10:34:11 +0000 (12:34 +0200)
This is now consistent with fs_compress_read_plain_fallback setting.

src/plugins/mail-crypt/crypt-settings.c
src/plugins/mail-crypt/crypt-settings.h
src/plugins/mail-crypt/fs-crypt.c
src/plugins/mail-crypt/test-fs-crypt.c

index 7fef5833b941997eaee54d22910550ee5e24179e..652775a7c49fe7af57b844dd2184526d23ce95e7 100644 (file)
@@ -35,6 +35,8 @@ const struct setting_parser_info crypt_private_key_setting_parser_info = {
 #define DEF(type, name) \
        SETTING_DEFINE_STRUCT_##type(#name, name, struct crypt_settings)
 static const struct setting_define crypt_setting_defines[] = {
+       DEF(BOOL, fs_crypt_read_plain_fallback),
+
        DEF(STR, crypt_global_public_key),
        { .type = SET_FILTER_ARRAY, .key = "crypt_global_private_key",
           .offset = offsetof(struct crypt_settings, crypt_global_private_keys),
@@ -42,7 +44,6 @@ static const struct setting_define crypt_setting_defines[] = {
 
        DEF(STR, crypt_write_algorithm),
        DEF(UINT, crypt_write_version),
-       DEF(BOOL, crypt_plain_fallback),
 
        { .type = SET_FILTER_ARRAY, .key = "crypt_user_key_encryption_key",
           .offset = offsetof(struct crypt_settings, crypt_user_key_encryption_keys),
@@ -55,12 +56,13 @@ static const struct setting_define crypt_setting_defines[] = {
 };
 
 static const struct crypt_settings crypt_default_settings = {
+       .fs_crypt_read_plain_fallback = FALSE,
+
        .crypt_global_public_key = "",
        .crypt_global_private_keys = ARRAY_INIT,
 
        .crypt_write_algorithm = "aes-256-gcm-sha256",
        .crypt_write_version = UINT_MAX,
-       .crypt_plain_fallback = FALSE,
 
        .crypt_user_key_encryption_keys = ARRAY_INIT,
        .crypt_user_key_password = "",
index 9ee57d9dbdb1b6198a9677b46932653c02c47820..7934b6d62a21b047ffd9299bb48d0b12ade9d575 100644 (file)
@@ -12,12 +12,13 @@ struct crypt_private_key_settings {
 struct crypt_settings {
        pool_t pool;
 
+       bool fs_crypt_read_plain_fallback;
+
        const char *crypt_global_public_key;
        ARRAY_TYPE(const_string) crypt_global_private_keys;
 
        const char *crypt_write_algorithm;
        unsigned int crypt_write_version;
-       bool crypt_plain_fallback;
 
        /* for user-specific keys: */
        ARRAY_TYPE(const_string) crypt_user_key_encryption_keys;
index 92eb5a6fc0a5760f82783cd95025a9c4057a0aa6..018028a75d9a1393dcd2165f7dee4617e1ec138f 100644 (file)
@@ -187,7 +187,7 @@ fs_crypt_read_stream(struct fs_file *_file, size_t max_buffer_size)
        input = fs_read_stream(file->super_read,
                I_MAX(FS_CRYPT_ISTREAM_MIN_BUFFER_SIZE, max_buffer_size));
 
-       if (file->fs->set->crypt_plain_fallback) {
+       if (file->fs->set->fs_crypt_read_plain_fallback) {
                struct istream *decrypted_input =
                        i_stream_create_decrypt_callback(input,
                                        fs_crypt_istream_get_key, file);
index 34203902ae47ba5e7e0599e96ed8e48752f14cae..7b8e23f12371fcc783047e294f310f35aebdfb85 100644 (file)
@@ -157,7 +157,7 @@ static void test_fs_crypt_read_write_unencrypted(void)
        const char *const test_settings[] = {
                "fs_parent/fs_driver", "posix",
                "fs_driver", "crypt",
-               "crypt_plain_fallback", "yes",
+               "fs_crypt_read_plain_fallback", "yes",
                "crypt_write_algorithm", "",
                "crypt_global_private_key", "main",
                "crypt_global_private_key/main/crypt_private_key", PRIVATE_KEY_PEM,
@@ -208,7 +208,7 @@ static void test_fs_crypt_read_write_unencrypted(void)
        const char *const test_settings2[] = {
                "fs_parent/fs_driver", "posix",
                "fs_driver", "crypt",
-               "crypt_plain_fallback", "yes",
+               "fs_crypt_read_plain_fallback", "yes",
                "crypt_write_algorithm", "",
                "crypt_global_public_key", PUBLIC_KEY_PEM,
                "crypt_global_private_key", "main",