File 0001-For-metadata-proxying-we-expect-to-have-as-maniy-ent.patch of Package cyrus-imapd-3

From c8fb932617612efb224d0c589082969be92f5018 Mon Sep 17 00:00:00 2001
From: Christian Mollekopf <mollekopf@apheleia-it.ch>
Date: Fri, 19 May 2023 14:06:42 +0200
Subject: [PATCH] For metadata proxying we expect to have as maniy entries in
 the attributes as for the values.

This might break metadata support in LIST, don't think the codepath is
used elsewhere.
---
 imap/imapd.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/imap/imapd.c b/imap/imapd.c
index 4abcd27dc..e57c7bfb6 100644
--- a/imap/imapd.c
+++ b/imap/imapd.c
@@ -10374,8 +10374,6 @@ static int _metadata_to_annotate(const strarray_t *entries,
                                  const char *tag, int depth)
 {
     int i;
-    int have_shared = 0;
-    int have_private = 0;
 
     /* we need to rewrite the entries and attribs to match the way that
      * the old annotation system works. */
@@ -10390,12 +10388,12 @@ static int _metadata_to_annotate(const strarray_t *entries,
         if (!strncmp(ent, "/private", 8) &&
             (ent[8] == '\0' || ent[8] == '/')) {
             xstrncpy(entry, ent + 8, MAX_MAILBOX_NAME);
-            have_private = 1;
+            strarray_append(newa, "value.priv");
         }
         else if (!strncmp(ent, "/shared", 7) &&
                  (ent[7] == '\0' || ent[7] == '/')) {
             xstrncpy(entry, ent + 7, MAX_MAILBOX_NAME);
-            have_shared = 1;
+            strarray_append(newa, "value.shared");
         }
         else {
             if (tag)
@@ -10415,8 +10413,6 @@ static int _metadata_to_annotate(const strarray_t *entries,
         }
     }
 
-    if (have_private) strarray_append(newa, "value.priv");
-    if (have_shared) strarray_append(newa, "value.shared");
 
     return 0;
 }
-- 
2.40.0