]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
SEARCH=CONTEXT error checking fix / changes.
authorTimo Sirainen <tss@iki.fi>
Fri, 6 Jun 2008 21:29:05 +0000 (00:29 +0300)
committerTimo Sirainen <tss@iki.fi>
Fri, 6 Jun 2008 21:29:05 +0000 (00:29 +0300)
--HG--
branch : HEAD

src/imap/cmd-search.c

index 19e526302b68184f988f90c4093ba8edfb5bd24c..614e3c1cdb55363ac0779b885266cd5a0c3f0b45 100644 (file)
@@ -75,17 +75,22 @@ search_parse_return_options(struct imap_search_context *ctx,
                else if (strcmp(name, "UPDATE") == 0)
                        ctx->return_options |= SEARCH_RETURN_UPDATE;
                else if (strcmp(name, "PARTIAL") == 0) {
+                       if (ctx->seq1 != 0) {
+                               client_send_command_error(cmd,
+                                       "PARTIAL can be used only once.");
+                               return FALSE;
+                       }
                        ctx->return_options |= SEARCH_RETURN_PARTIAL;
                        if (args->type != IMAP_ARG_ATOM) {
                                client_send_command_error(cmd,
-                                       "SEARCH PARTIAL range missing.");
+                                       "PARTIAL range missing.");
                                return FALSE;
                        }
                        str = IMAP_ARG_STR_NONULL(args);
                        if (imap_seq_range_parse(str, &ctx->seq1,
                                                 &ctx->seq2) < 0) {
                                client_send_command_error(cmd,
-                                       "SEARCH PARTIAL range broken.");
+                                       "PARTIAL range broken.");
                                return FALSE;
                        }
                        args++;
@@ -103,8 +108,7 @@ search_parse_return_options(struct imap_search_context *ctx,
        }
        if ((ctx->return_options & SEARCH_RETURN_PARTIAL) != 0 &&
            (ctx->return_options & SEARCH_RETURN_ALL) != 0) {
-               client_send_command_error(cmd,
-                       "SEARCH PARTIAL conflicts with ALL");
+               client_send_command_error(cmd, "PARTIAL conflicts with ALL");
                return FALSE;
        }