]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Add MAIL_ERROR_LIMIT
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 17 Feb 2017 16:56:23 +0000 (18:56 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Sun, 19 Feb 2017 20:07:40 +0000 (22:07 +0200)
src/doveadm/doveadm-mail.c
src/imap/imap-commands-util.c
src/lib-storage/index/dbox-multi/mdbox-map.c
src/lib-storage/index/imapc/imapc-storage.c
src/lib-storage/mail-error.h

index bd3ceb16346e8a32e1d4948ac10af97dd984cc31..54fcca1ccb8255a64ae6df7e5c76df40547a6283 100644 (file)
@@ -53,13 +53,12 @@ int doveadm_killed_signo(void)
 void doveadm_mail_failed_error(struct doveadm_mail_cmd_context *ctx,
                               enum mail_error error)
 {
-       int exit_code = 0;
+       int exit_code = EX_TEMPFAIL;
 
        switch (error) {
        case MAIL_ERROR_NONE:
                i_unreached();
        case MAIL_ERROR_TEMP:
-               exit_code = EX_TEMPFAIL;
                break;
        case MAIL_ERROR_NOTPOSSIBLE:
        case MAIL_ERROR_EXISTS:
@@ -81,7 +80,9 @@ void doveadm_mail_failed_error(struct doveadm_mail_cmd_context *ctx,
                break;
        case MAIL_ERROR_EXPUNGED:
        case MAIL_ERROR_INUSE:
-               exit_code = EX_TEMPFAIL;
+               break;
+       case MAIL_ERROR_LIMIT:
+               exit_code = DOVEADM_EX_NOTPOSSIBLE;
                break;
        }
        /* tempfail overrides all other exit codes, otherwise use whatever
index 6886f4f43fb7ecaf8920a2b3adc741ca07415fc9..d724077231c2bcfbe46836c16dee632688303404 100644 (file)
@@ -169,6 +169,9 @@ imap_get_error_string(struct client_command_context *cmd,
        case MAIL_ERROR_CONVERSION:
        case MAIL_ERROR_INVALIDDATA:
                break;
+       case MAIL_ERROR_LIMIT:
+               resp_code = IMAP_RESP_CODE_LIMIT;
+               break;
        }
        if (resp_code == NULL || *error_string == '[')
                return t_strconcat("NO ", error_string, NULL);
index ba0396590d5dadc616bd0bb9f9b159a457cd19b0..9dac3ef1f06f73d5188f8e71075fde3bb6c1bbf6 100644 (file)
@@ -674,7 +674,7 @@ int mdbox_map_update_refcount(struct mdbox_map_transaction_context *ctx,
                /* we're getting close to the 64k limit. fail early
                   to make it less likely that two processes increase
                   the refcount enough times to cross the limit */
-               mail_storage_set_error(MAP_STORAGE(map), MAIL_ERROR_NOTPOSSIBLE,
+               mail_storage_set_error(MAP_STORAGE(map), MAIL_ERROR_LIMIT,
                        t_strdup_printf("Message has been copied too many times (%d + %d)",
                                        old_diff, new_diff));
                return -1;
index b916bc4440bb9c8ff78e4347dce4c5d414a2ff18..b2df83daf8504fa876427026313344a78a600519 100644 (file)
@@ -45,7 +45,7 @@ static struct imapc_resp_code_map imapc_resp_code_map[] = {
        { IMAP_RESP_CODE_SERVERBUG, MAIL_ERROR_TEMP },
        /* { IMAP_RESP_CODE_CLIENTBUG, 0 }, */
        { IMAP_RESP_CODE_CANNOT, MAIL_ERROR_NOTPOSSIBLE },
-       { IMAP_RESP_CODE_LIMIT, MAIL_ERROR_NOTPOSSIBLE },
+       { IMAP_RESP_CODE_LIMIT, MAIL_ERROR_LIMIT },
        { IMAP_RESP_CODE_OVERQUOTA, MAIL_ERROR_NOQUOTA },
        { IMAP_RESP_CODE_ALREADYEXISTS, MAIL_ERROR_EXISTS },
        { IMAP_RESP_CODE_NONEXISTENT, MAIL_ERROR_NOTFOUND }
index fb62a3bfe60b232c3a5662798210b7020e0ba82b..276d2079b743d076a2070388533ead0a3f124607 100644 (file)
@@ -49,6 +49,8 @@ enum mail_error {
        /* Can't do the requested data conversion because the original data
           isn't valid. */
        MAIL_ERROR_INVALIDDATA,
+       /* Operation ran against some kind of a limit. */
+       MAIL_ERROR_LIMIT,
 
        /* FIXME: Obsolete - remove in v2.3 */
        MAIL_ERROR_NOSPACE = MAIL_ERROR_NOQUOTA