]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dict: Remove support for legacy dict API
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 27 Nov 2024 14:06:49 +0000 (16:06 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Fri, 17 Jan 2025 08:40:01 +0000 (10:40 +0200)
src/dict/dict-connection.c
src/dict/dict-expire.c
src/dict/dict-init-cache.c
src/dict/dict-init-cache.h
src/dict/dict-settings.c
src/dict/dict-settings.h

index 37b2ff69c345e6de4998188ac7a6c58e4fea070c..cba93e01429fc3686680ce15d9346add9d2cac45 100644 (file)
@@ -63,41 +63,6 @@ static int dict_connection_handshake_line(struct connection *conn,
        return dict_connection_handshake_args(conn, args);
 }
 
-static int dict_connection_dict_init_legacy(struct dict_connection *conn)
-{
-       struct dict_legacy_settings dict_set;
-       const char *const *strlist;
-       unsigned int i, count;
-       const char *uri, *error;
-
-       if (!array_is_created(&server_settings->legacy_dicts))
-               return 0;
-       strlist = array_get(&server_settings->legacy_dicts, &count);
-       for (i = 0; i < count; i += 2) {
-               if (strcmp(strlist[i], conn->name) == 0)
-                       break;
-       }
-
-       if (i == count)
-               return 0;
-       event_set_append_log_prefix(conn->conn.event,
-                                   t_strdup_printf("%s: ", conn->name));
-       event_add_str(conn->conn.event, "dict_name", conn->name);
-       uri = strlist[i+1];
-
-       i_zero(&dict_set);
-       dict_set.base_dir = server_settings->base_dir;
-       dict_set.event_parent = conn->conn.event;
-       if (dict_init_cache_get_legacy(conn->name, uri, &dict_set,
-                                      &conn->dict, &error) < 0) {
-               /* dictionary initialization failed */
-               e_error(conn->conn.event, "Failed to initialize dictionary '%s': %s",
-                       conn->name, error);
-               return -1;
-       }
-       return 1;
-}
-
 static int dict_connection_dict_init_name(struct dict_connection *conn)
 {
        struct event *event;
@@ -137,10 +102,6 @@ static int dict_connection_dict_init(struct dict_connection *conn)
                }
        }
 
-       if (ret == 0) {
-               if ((ret = dict_connection_dict_init_legacy(conn)) < 0)
-                       return -1;
-       }
        if (ret == 0) {
                e_error(conn->conn.event, "Unconfigured dictionary name '%s'",
                        conn->name);
index aaa313854f6a37f4fbe4fad40ab63cdcaa371d74..b114a5b5bfb1fc5b0e32d7377a8153a6bba7cdeb 100644 (file)
@@ -63,38 +63,9 @@ static void client_connected(struct master_service_connection *conn ATTR_UNUSED)
        dict_expire_run();
 }
 
-static void dict_expire_init_legacy(void)
-{
-       struct dict_legacy_settings dict_set = {
-               .base_dir = server_settings->base_dir,
-       };
-       struct dict *dict;
-       const char *const *strlist, *error;
-       unsigned int i, count;
-
-       if (!array_is_created(&server_settings->legacy_dicts))
-               return;
-       strlist = array_get(&server_settings->legacy_dicts, &count);
-       for (i = 0; i < count; i += 2) {
-               const char *name = strlist[i];
-               const char *uri = strlist[i+1];
-
-               if (dict_init_legacy(uri, &dict_set, &dict, &error) < 0) {
-                       i_error("Failed to initialize dictionary '%s': %s - skipping",
-                               name, error);
-               } else {
-                       struct expire_dict *expire_dict =
-                               array_append_space(&expire_dicts);
-                       expire_dict->name = name;
-                       expire_dict->dict = dict;
-               }
-       }
-}
-
 static void dict_expire_init(struct event *event)
 {
        i_array_init(&expire_dicts, 16);
-       dict_expire_init_legacy();
 
        if (!array_is_created(&dict_settings->dicts))
                return;
index 146ec26e8af3d435111ea8b72c9a2a8587aa3bef..dae2b0fe0028a180d0cbc23ff0872a7917c98fd3 100644 (file)
@@ -94,26 +94,6 @@ int dict_init_cache_get(struct event *event, const char *dict_name,
        return ret;
 }
 
-int dict_init_cache_get_legacy(const char *dict_name, const char *uri,
-                              const struct dict_legacy_settings *set,
-                              struct dict **dict_r, const char **error_r)
-{
-       struct dict_init_cache_list *match;
-       int ret = 0;
-
-       match = dict_init_cache_find(dict_name);
-       if (match == NULL) {
-               if (dict_init_legacy(uri, set, dict_r, error_r) < 0)
-                       return -1;
-               match = dict_init_cache_add(dict_name, *dict_r);
-       } else {
-               match->refcount++;
-               *dict_r = match->dict;
-       }
-       i_assert(match->dict != NULL);
-       return ret;
-}
-
 static void destroy_unrefed(void)
 {
        struct dict_init_cache_list *listp, *next = NULL;
index afd438508428abf39a1e4de9df811a3ccc49b0d1..26bc0967e61edfdaefa32ae3382e83087f1fb856 100644 (file)
@@ -3,9 +3,6 @@
 
 int dict_init_cache_get(struct event *event, const char *dict_name,
                        struct dict **dict_r, const char **error_r);
-int dict_init_cache_get_legacy(const char *dict_name, const char *uri,
-                              const struct dict_legacy_settings *set,
-                              struct dict **dict_r, const char **error_r);
 void dict_init_cache_unref(struct dict **dict);
 
 void dict_init_cache_wait_all(void);
index 0224fc083ddf9a456938f87d9122e0cd1dc873a9..3d2033b69f6ef310a4b213b5855403b6ea386ef6 100644 (file)
@@ -94,8 +94,6 @@ static const struct setting_define dict_setting_defines[] = {
 
        DEF(STR_HIDDEN, base_dir),
        DEF(BOOL, verbose_proctitle),
-       { .type = SET_STRLIST, .key = "dict_legacy",
-         .offset = offsetof(struct dict_server_settings, legacy_dicts) },
 
        SETTING_DEFINE_LIST_END
 };
@@ -103,7 +101,6 @@ static const struct setting_define dict_setting_defines[] = {
 const struct dict_server_settings dict_default_settings = {
        .base_dir = PKG_RUNDIR,
        .verbose_proctitle = FALSE,
-       .legacy_dicts = ARRAY_INIT
 };
 
 const struct setting_parser_info dict_server_setting_parser_info = {
index 9930cbe275d4c69528d7ecf2006e89256278a1f7..87e009385a5b4ed012fb34f5035d88afa2bae891 100644 (file)
@@ -5,7 +5,6 @@ struct dict_server_settings {
        pool_t pool;
        const char *base_dir;
        bool verbose_proctitle;
-       ARRAY(const char *) legacy_dicts;
 };
 
 extern const struct setting_parser_info dict_server_setting_parser_info;