aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-07-20 22:23:13 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-07-20 22:23:13 +0000
commit59288d0f49fadae31c47d8f752de8d25f64ac3a3 (patch)
treec3bd8625f12de5308468c59a65707530cc4bce01 /apps
parent3674ae02ec50cfda8e90bb6cbfcbda3806398e5c (diff)
Delete IMAP messages in reverse order, to ensure reordering after each expunge does not cause deletion of the wrong message.
(closes issue #16350) Reported by: noahisaac Patches: 20100623__issue16350.diff.txt uploaded by tilghman (license 14) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@278261 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r--apps/app_voicemail.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 4fd805fc7..a02ac78bf 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -5955,12 +5955,15 @@ static int close_mailbox(struct vm_state *vms, struct ast_vm_user *vmu)
DELETE(vms->curdir, x, vms->fn, vmu);
}
ast_unlock_path(vms->curdir);
-#else
+#else /* defined(IMAP_STORAGE) */
if (vms->deleted) {
- for (x=0;x < vmu->maxmsg;x++) {
- if (vms->deleted[x]) {
- if (option_debug > 2)
- ast_log(LOG_DEBUG,"IMAP delete of %d\n",x);
+ /* Since we now expunge after each delete, deleting in reverse order
+ * ensures that no reordering occurs between each step. */
+ for (x = vmu->maxmsg - 1; x >= 0; x--) {
+ if (vms->deleted[x]) {
+ if (option_debug > 2) {
+ ast_log(LOG_DEBUG, "IMAP delete of %d\n", x);
+ }
DELETE(vms->curdir, x, vms->fn, vmu);
}
}