dovecot-2.0: dsync: More fixes to parsing proxied mailbox deleti...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Jul 1 23:53:53 EEST 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/2996ff9d2779
changeset: 11698:2996ff9d2779
user: Timo Sirainen <tss at iki.fi>
date: Thu Jul 01 21:53:50 2010 +0100
description:
dsync: More fixes to parsing proxied mailbox deletion records.
diffstat:
src/dsync/dsync-proxy.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diffs (50 lines):
diff -r 9605c74b1f19 -r 2996ff9d2779 src/dsync/dsync-proxy.c
--- 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;
}
More information about the dovecot-cvs
mailing list