]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm: Change doveadm_allowed_commands to BOOLLIST.
authorsergey.kitov <sergey.kitov@open-xchange.com>
Wed, 25 Oct 2023 13:49:36 +0000 (16:49 +0300)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Fri, 17 Jan 2025 08:39:59 +0000 (10:39 +0200)
src/doveadm/client-connection.c
src/doveadm/doveadm-settings.c
src/doveadm/doveadm-settings.h

index 4825eebba16dc31cc60751d3dbf9972f469e61c7..831b409d85cdc22a6608b32cf430356feb059b2a 100644 (file)
@@ -1,6 +1,7 @@
 /* Copyright (c) 2010-2018 Dovecot authors, see the included COPYING file */
 
 #include "lib.h"
+#include "array.h"
 #include "process-title.h"
 #include "settings.h"
 #include "master-service.h"
@@ -13,12 +14,12 @@ bool doveadm_client_is_allowed_command(const struct doveadm_settings *set,
 {
        bool ret = FALSE;
 
-       if (*set->doveadm_allowed_commands == '\0')
+       if (array_is_empty(&set->doveadm_allowed_commands))
                return TRUE;
 
        T_BEGIN {
                const char *const *cmds =
-                       t_strsplit(set->doveadm_allowed_commands, ",");
+                       settings_boollist_get(&set->doveadm_allowed_commands);
                for (; *cmds != NULL; cmds++) {
                        if (strcmp(*cmds, cmd_name) == 0) {
                                ret = TRUE;
index 8ee4ebb6c1c8e0e69d5ecfabab8a705694216ff1..90569750315db315362506d0ffd753390f4c9219 100644 (file)
@@ -68,7 +68,7 @@ static const struct setting_define doveadm_setting_defines[] = {
        DEF(ENUM, doveadm_ssl),
        DEF(STR, doveadm_username),
        DEF(STR, doveadm_password),
-       DEF(STR, doveadm_allowed_commands),
+       DEF(BOOLLIST, doveadm_allowed_commands),
        DEF(STR, dsync_alt_char),
        DEF(STR_NOVARS, dsync_remote_cmd),
        DEF(STR, doveadm_api_key),
@@ -98,7 +98,7 @@ const struct doveadm_settings doveadm_default_settings = {
        .doveadm_ssl = "no:ssl:starttls",
        .doveadm_username = "doveadm",
        .doveadm_password = "",
-       .doveadm_allowed_commands = "",
+       .doveadm_allowed_commands = ARRAY_INIT,
        .dsync_alt_char = "_",
        .dsync_remote_cmd = "ssh -l%{login} %{host} doveadm dsync-server -u%u -U",
        .dsync_features = "",
index bb7c773843ce9c0ea1bcaa1e7ee850ba5c3155d3..1f67fe6f0902f972521c8c0e00b4ef338f399c89 100644 (file)
@@ -29,7 +29,7 @@ struct doveadm_settings {
        const char *doveadm_ssl;
        const char *doveadm_username;
        const char *doveadm_password;
-       const char *doveadm_allowed_commands;
+       ARRAY_TYPE(const_string) doveadm_allowed_commands;
        const char *dsync_alt_char;
        const char *dsync_remote_cmd;
        const char *doveadm_api_key;