]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-dict: Don't crash if init_legacy() isn't supported by dict driver
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 25 Aug 2023 19:59:32 +0000 (15:59 -0400)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 12 Feb 2025 10:34:10 +0000 (12:34 +0200)
src/lib-dict/dict.c

index fde113981384ddacaf6b8f88fb167b15b0c1c061..99e2e8e00d3b27d203e2ba420302217c3ee00773 100644 (file)
@@ -129,6 +129,11 @@ int dict_init_legacy(const char *uri, const struct dict_legacy_settings *set,
                *error_r = t_strdup_printf("Unknown dict module: %s", name);
                return -1;
        }
+       if (dict->v.init_legacy == NULL) {
+               *error_r = t_strdup_printf(
+                       "dict %s doesn't support legacy_init()", name);
+               return -1;
+       }
        struct event *event = event_create(set->event_parent);
        event_add_category(event, &event_category_dict);
        event_add_str(event, "driver", dict->name);