HTTP DoveAdm API - Possible bug?

Aki Tuomi aki.tuomi at dovecot.fi
Wed Sep 19 09:57:33 EEST 2018


Yeah. This is a bug, there is a fix pending.

>From bb200128c83610d213b2ff2e59f1e0440ecbd2c9 Mon Sep 17 00:00:00 2001
From: Aki Tuomi <aki.tuomi at dovecot.fi>
Date: Tue, 18 Sep 2018 20:37:38 +0300
Subject: [PATCH] doveadm: Fix doveadm user output when called from server

Was forgotten in a13b1245bee0b6524b4aeb3c8fd9e34af648b746
---
 src/doveadm/doveadm-auth-server.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/doveadm/doveadm-auth-server.c b/src/doveadm/doveadm-auth-server.c
index 44278e467e..d9e4e01c74 100644
--- a/src/doveadm/doveadm-auth-server.c
+++ b/src/doveadm/doveadm-auth-server.c
@@ -170,6 +170,10 @@ cmd_user_list(struct auth_master_connection *conn,
 	const char *username, *user_mask = "*";
 	unsigned int i;
 
+	doveadm_print_init(DOVEADM_PRINT_TYPE_FORMATTED);
+	doveadm_print_formatted_set_format("%{username}\n");
+	doveadm_print_header_simple("username");
+
 	if (users[0] != NULL && users[1] == NULL)
 		user_mask = users[0];
 
@@ -180,7 +184,7 @@ cmd_user_list(struct auth_master_connection *conn,
 				break;
 		}
 		if (users[i] != NULL)
-			printf("%s\n", username);
+			doveadm_print(username);
 	}
 	if (auth_master_user_list_deinit(&ctx) < 0)
 		i_fatal("user listing failed");
-- 
2.18.0

Aki


On 18.09.2018 17:09, Chris Malton wrote:
> Hi all,
>
> It seems that setting userMask in the doveadm http api's "user"
> command to anything involving wildcards ?s or *s causes the API to fail.
>
> When using the API with a userMask set to the fully qualified email
> address, I get the expected fields back.
>
> From a python shell, with an asterisk causes the following behaviour
> (note that doveadm is a python module that wrappers the dovecot API
> into Python's requests module).
>
> >>> doveadm.do_query("http://[xxxx:xxxx:xxxx:xxxx::ffff]:24280",
> "API_KEY_HERE", [ ["user", { "userMask": ["*"] }, "c01"] ])
> '[["doveadmResponse",,"c01"]]'
>
> If I run the same command with a valid mailbox in the userMask Field,
> I get the response I expect:
>
> >>> doveadm.do_query("http://[[xxxx:xxxx:xxxx:xxxx::ffff]:24280",
> "API_KEY_HERE", [ ["user", { "userMask": ["test at test.mydomain.com"] },
> "c01"] ])
> '[["doveadmResponse",{"test at test.mydomain.com":{"uid":"x","gid":"y","home":"/mail/test.mydomain.com/users/test","mail":"maildir:/mail/test.mydomain.com/users/test/Maildir/:INDEX=/indexes/test.mydomain.com/test","nice":"10"}},"c01"]]'
>
>
>
> Chatting with people in #dovecot revealed similar behaviour elsewhere
> so it doesn't appear to be just me.  I've also selectively edited the
> above to avoid leaking data.
>
> We're running on the following
>
> # 2.2.34 (874deae): /etc/dovecot/dovecot.conf
> # Pigeonhole version 0.4.22 (22940fb7)
> # OS: Linux 4.9.0-7-amd64 x86_64 Debian 9.5 ext4
>
> If you need a full copy of the config, please let me know and I'll
> talk to my client, however, I don't think this is config related.
>
> Thanks in advance.
>
> Regards,
>
> Chris Malton
>



More information about the dovecot mailing list