]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: SETMETADATA - Explicitly support using atoms for values
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 25 Mar 2020 14:00:08 +0000 (16:00 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Fri, 22 Jan 2021 07:18:07 +0000 (07:18 +0000)
Required to keep atoms working (and especially not assert-crashing) after
the following imap_arg_get_nstring() change.

src/imap/cmd-setmetadata.c

index eb18dfd578bad3bb3a6533333aa752eac9b28ab5..a0ae56e0271e70bb951649b1f90f05d34c2a82d9 100644 (file)
@@ -177,7 +177,12 @@ cmd_setmetadata_entry(struct imap_setmetadata_context *ctx,
                if (ctx->failed)
                        return 1;
                i_zero(&value);
-               value.value = imap_arg_as_nstring(entry_value);
+               /* NOTE: The RFC doesn't allow atoms as value, but since
+                  Dovecot has traditionally supported it this is kept for
+                  backwards compatibility just in case some client is
+                  using it. */
+               if (!imap_arg_get_atom(entry_value, &value.value))
+                       value.value = imap_arg_as_nstring(entry_value);
                ret = imap_metadata_set(ctx->trans, entry_name, &value);
                if (ret < 0) {
                        /* delay reporting the failure so we'll finish