]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
config: old_settings_handle_path() - Handle case where path/<x>/ has x other than 0
authorMarco Bettini <marco.bettini@open-xchange.com>
Mon, 27 Jun 2022 12:40:47 +0000 (14:40 +0200)
committerMarco Bettini <marco.bettini@open-xchange.com>
Mon, 27 Jun 2022 12:44:55 +0000 (12:44 +0000)
src/config/old-set-parser.c

index 81258f24d2b1f3ce02de0aaea724db7c37e4a4e7..a24c13b9563d939fa1c050210d65a4c76b2187b8 100644 (file)
@@ -7,6 +7,7 @@
 #include "old-set-parser.h"
 #include "istream.h"
 #include "base64.h"
+#include <stdio.h>
 
 #define config_apply_line (void)config_apply_line
 
@@ -659,11 +660,14 @@ static bool
 old_settings_handle_path(struct config_parser_context *ctx,
                         const char *key, const char *value)
 {
-       if (strcmp(str_c(ctx->str), "plugin/0/") == 0) {
+       char end;
+       int index;
+       if (sscanf(str_c(ctx->str), "plugin/%d%c]", &index, &end) == 2 && end == '/') {
                if (strcmp(key, "imap_zlib_compress_level") == 0) {
                        obsolete(ctx, "%s has been replaced by imap_compress_deflate_level", key);
-                       config_apply_line(ctx, key,
-                               t_strdup_printf("plugin/0/imap_compress_deflate_level=%s", value), NULL);
+                       config_apply_line(ctx, key, t_strdup_printf(
+                               "plugin/%d/imap_compress_deflate_level=%s",
+                               index, value), NULL);
                        return TRUE;
                }
        }