Mercurial > dovecot > core-2.2
changeset 11698:2996ff9d2779 HEAD
dsync: More fixes to parsing proxied mailbox deletion records.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 01 Jul 2010 21:53:50 +0100 |
parents | 9605c74b1f19 |
children | 211aa7bab239 |
files | src/dsync/dsync-proxy.c |
diffstat | 1 files changed, 11 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/dsync/dsync-proxy.c Thu Jul 01 21:52:48 2010 +0100 +++ b/src/dsync/dsync-proxy.c Thu Jul 01 21:53:50 2010 +0100 @@ -184,6 +184,7 @@ const char **error_r) { unsigned int i = 0, count; + bool box_deleted; char *p; memset(box_r, 0, sizeof(*box_r)); @@ -199,7 +200,7 @@ box_r->name = p_strdup(pool, args[i++]); dsync_str_sha_to_guid(box_r->name, &box_r->name_sha1); - if (strlen(args[i]) != 1) { + if (strlen(args[i]) > 1) { *error_r = "Invalid mailbox name hierarchy separator"; return -1; } @@ -216,6 +217,12 @@ *error_r = "Invalid mailbox flags"; return -1; } + box_deleted = (box_r->flags & (DSYNC_MAILBOX_FLAG_DELETED_MAILBOX | + DSYNC_MAILBOX_FLAG_DELETED_DIR)) != 0; + if (box_r->name_sep == '\0' && !box_deleted) { + *error_r = "Missing mailbox name hierarchy separator"; + return -1; + } if (args[i] == NULL) { /* \noselect mailbox */ @@ -229,13 +236,14 @@ } box_r->uid_validity = strtoul(args[i++], &p, 10); - if (box_r->uid_validity == 0 || *p != '\0') { + if (*p != '\0' || (box_r->uid_validity == 0 && !box_deleted)) { + abort(); *error_r = "Invalid mailbox uid_validity"; return -1; } box_r->uid_next = strtoul(args[i++], &p, 10); - if (box_r->uid_validity == 0 || *p != '\0') { + if (*p != '\0' || (box_r->uid_next == 0 && !box_deleted)) { *error_r = "Invalid mailbox uid_next"; return -1; }