From 89424485619585cc7f27a37e6efcd83e3eb2ab4e Mon Sep 17 00:00:00 2001 From: Florent Daigniere Date: Sat, 29 Oct 2022 11:40:14 +0200 Subject: [PATCH 1/5] Upgrade to alpine 3.16.2 This may fix the build issues on arm --- core/base/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/base/Dockerfile b/core/base/Dockerfile index 2cade640..721b5db1 100644 --- a/core/base/Dockerfile +++ b/core/base/Dockerfile @@ -1,7 +1,7 @@ # syntax=docker/dockerfile-upstream:1.4.3 # base system image (intermediate) -ARG DISTRO=alpine:3.14.5 +ARG DISTRO=alpine:3.16.2 FROM $DISTRO as system ENV TZ=Etc/UTC LANG=C.UTF-8 From a63bad6bf2c7d070bc3f7507f44633cc8c67c2cb Mon Sep 17 00:00:00 2001 From: Florent Daigniere Date: Sat, 29 Oct 2022 12:30:38 +0200 Subject: [PATCH 2/5] towncrier --- towncrier/newsfragments/2497.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 towncrier/newsfragments/2497.bugfix diff --git a/towncrier/newsfragments/2497.bugfix b/towncrier/newsfragments/2497.bugfix new file mode 100644 index 00000000..67752060 --- /dev/null +++ b/towncrier/newsfragments/2497.bugfix @@ -0,0 +1 @@ +Upgrade to alpine 3.16.2 From 2e467092a2a61e585e890815fa16374c16fee765 Mon Sep 17 00:00:00 2001 From: Florent Daigniere Date: Sat, 29 Oct 2022 15:53:55 +0200 Subject: [PATCH 3/5] The newer dovecot sends data podop should ignore --- core/base/libs/podop/podop/dovecot.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/base/libs/podop/podop/dovecot.py b/core/base/libs/podop/podop/dovecot.py index 68bfa172..b1319f51 100644 --- a/core/base/libs/podop/podop/dovecot.py +++ b/core/base/libs/podop/podop/dovecot.py @@ -75,10 +75,10 @@ class DictProtocol(asyncio.Protocol): logging.debug("Client {}.{} type {}, user {}, dict {}".format( self.major, self.minor, self.value_type, self.user, dict_name)) - async def process_lookup(self, key): + async def process_lookup(self, key, user=None): """ Process a dict lookup message """ - logging.debug("Looking up {}".format(key)) + logging.debug("Looking up {} for {}".format(key, user)) # Priv and shared keys are handled slighlty differently key_type, key = key.decode("utf8").split("/", 1) try: @@ -95,7 +95,7 @@ class DictProtocol(asyncio.Protocol): except KeyError: return self.reply(b"N") - def process_begin(self, transaction_id): + def process_begin(self, transaction_id, user=None): """ Process a dict begin message """ self.transactions[transaction_id] = {} From 076d67b51331efbac9cbb7685f34e6dbacfbc30c Mon Sep 17 00:00:00 2001 From: Florent Daigniere Date: Sat, 29 Oct 2022 17:02:52 +0200 Subject: [PATCH 4/5] follow the protocol --- core/base/libs/podop/podop/dovecot.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/base/libs/podop/podop/dovecot.py b/core/base/libs/podop/podop/dovecot.py index b1319f51..c90e188d 100644 --- a/core/base/libs/podop/podop/dovecot.py +++ b/core/base/libs/podop/podop/dovecot.py @@ -33,6 +33,8 @@ class DictProtocol(asyncio.Protocol): self.dict = None # Dictionary of active transaction lists per transaction id self.transactions = {} + # Dictionary of user per transaction id + self.transactions_user = {} super(DictProtocol, self).__init__() def connection_made(self, transport): @@ -83,7 +85,7 @@ class DictProtocol(asyncio.Protocol): key_type, key = key.decode("utf8").split("/", 1) try: result = await self.dict.get( - key, ns=(self.user if key_type == "priv" else None) + key, ns=((user if user else self.user) if key_type == "priv" else None) ) if type(result) is str: response = result.encode("utf8") @@ -99,6 +101,7 @@ class DictProtocol(asyncio.Protocol): """ Process a dict begin message """ self.transactions[transaction_id] = {} + self.transactions_user[transaction_id] = user if user else self.user def process_set(self, transaction_id, key, value): """ Process a dict set message @@ -116,10 +119,11 @@ class DictProtocol(asyncio.Protocol): key_type, key = key.decode("utf8").split("/", 1) result = await self.dict.set( key, json.loads(value), - ns=(self.user if key_type == "priv" else None) + ns=(self.transactions_user[transaction_id] if key_type == "priv" else None) ) # Remove stored transaction del self.transactions[transaction_id] + del self.transactions_user[transaction_id] return self.reply(b"O", transaction_id) def reply(self, command, *args): From 340e35909627577d10ca304ebd3362116d3aefdf Mon Sep 17 00:00:00 2001 From: Florent Daigniere Date: Sat, 29 Oct 2022 17:13:58 +0200 Subject: [PATCH 5/5] doh --- core/base/libs/podop/podop/dovecot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/base/libs/podop/podop/dovecot.py b/core/base/libs/podop/podop/dovecot.py index c90e188d..40b48eef 100644 --- a/core/base/libs/podop/podop/dovecot.py +++ b/core/base/libs/podop/podop/dovecot.py @@ -85,7 +85,7 @@ class DictProtocol(asyncio.Protocol): key_type, key = key.decode("utf8").split("/", 1) try: result = await self.dict.get( - key, ns=((user if user else self.user) if key_type == "priv" else None) + key, ns=((user.decode("utf8") if user else self.user) if key_type == "priv" else None) ) if type(result) is str: response = result.encode("utf8") @@ -101,7 +101,7 @@ class DictProtocol(asyncio.Protocol): """ Process a dict begin message """ self.transactions[transaction_id] = {} - self.transactions_user[transaction_id] = user if user else self.user + self.transactions_user[transaction_id] = user.decode("utf8") if user else self.user def process_set(self, transaction_id, key, value): """ Process a dict set message