summaryrefslogtreecommitdiff
path: root/maidag
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2016-12-01 11:11:44 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2016-12-01 11:11:44 +0200
commited04bc837e353e61e4c43f6bdbd9a67859c61f61 (patch)
tree249cfbc3e5b08dd455d3eadd53a91e9912163482 /maidag
parent1186b695bc7c105b19e36bff4c7c9dc04fe30d8f (diff)
downloadmailutils-ed04bc837e353e61e4c43f6bdbd9a67859c61f61.tar.gz
mailutils-ed04bc837e353e61e4c43f6bdbd9a67859c61f61.tar.bz2
Fix delivery to MH and Maildir mailboxes
After successful delivery, maidag would switch back to root privileges too early, due to which the mailbox would be closed when running with root UID. I the property file (.mu-prop) did not exist, it would therefore be created by root. Subsequent attempts to open it by user would fail. One of consequences is that the UIDVALIDITY value would be recalculated each time the mailbox is opened. This would force imap4 clients to rescan mailboxes infinitely, as each scan would change the UIDVALIDITY again. This patch fixes the initialization of UIDVALIDITY and fixes maidag to switch back to root privileges only after closing the mailbox. It also makes sure MH and Maildir mailboxes write .mu-prop upon closing, not upon destroying the mailbox. * libmailutils/base/amd.c (amd_close): Save property. (_amd_scan0): Use mailbox modification time as initial uidvalidity value. * maidag/deliver.c (deliver_to_mailbox): Remove uselsess UID/GID transitions.
Diffstat (limited to 'maidag')
-rw-r--r--maidag/deliver.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/maidag/deliver.c b/maidag/deliver.c
index 043d4bf1d..d27b37e2f 100644
--- a/maidag/deliver.c
+++ b/maidag/deliver.c
@@ -225,7 +225,7 @@ deliver_to_mailbox (mu_mailbox_t mbox, mu_message_t msg,
}
#endif
- if (!failed && switch_user_id (auth, 1) == 0)
+ if (!failed)
{
status = mu_mailbox_append_message (mbox, msg);
if (status)
@@ -244,7 +244,6 @@ deliver_to_mailbox (mu_mailbox_t mbox, mu_message_t msg,
failed++;
}
}
- switch_user_id (auth, 0);
}
mu_mailbox_close (mbox);

Return to:

Send suggestions and report system problems to the System administrator.