summaryrefslogtreecommitdiff
path: root/mailbox
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2002-11-21 13:52:52 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2002-11-21 13:52:52 +0000
commitf76469cfddc4afd146bda016886dec6474a02b43 (patch)
tree297d868c9b0990c15e75e2d49266c8169760864a /mailbox
parent625b1f9da4b87856b5bc288003c72b535160994b (diff)
downloadmailutils-f76469cfddc4afd146bda016886dec6474a02b43.tar.gz
mailutils-f76469cfddc4afd146bda016886dec6474a02b43.tar.bz2
(mailbox_flush,mailbox_append_message)
(mailbox_save_attributes,mailbox_expunge): Return EACCES if mailbox was open readonly.
Diffstat (limited to 'mailbox')
-rw-r--r--mailbox/mailbox.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/mailbox/mailbox.c b/mailbox/mailbox.c
index 205622ab7..386484cbc 100644
--- a/mailbox/mailbox.c
+++ b/mailbox/mailbox.c
@@ -210,7 +210,9 @@ mailbox_flush (mailbox_t mbox, int expunge)
{
size_t i, total = 0;
int status = 0;
-
+
+ if (!(mbox->flags & (MU_STREAM_RDWR|MU_STREAM_WRITE|MU_STREAM_APPEND)))
+ return EACCES;
mailbox_messages_count (mbox, &total);
for (i = 1; i <= total; i++)
{
@@ -233,6 +235,8 @@ mailbox_append_message (mailbox_t mbox, message_t msg)
{
if (mbox == NULL || mbox->_append_message == NULL)
return MU_ERR_EMPTY_VFN;
+ if (!(mbox->flags & (MU_STREAM_RDWR|MU_STREAM_WRITE|MU_STREAM_APPEND)))
+ return EACCES;
return mbox->_append_message (mbox, msg);
}
@@ -272,6 +276,8 @@ mailbox_save_attributes (mailbox_t mbox)
{
if (mbox == NULL || mbox->_save_attributes == NULL)
return MU_ERR_EMPTY_VFN;
+ if (!(mbox->flags & (MU_STREAM_RDWR|MU_STREAM_WRITE|MU_STREAM_APPEND)))
+ return EACCES;
return mbox->_save_attributes (mbox);
}
@@ -280,6 +286,8 @@ mailbox_expunge (mailbox_t mbox)
{
if (mbox == NULL || mbox->_expunge == NULL)
return MU_ERR_EMPTY_VFN;
+ if (!(mbox->flags & (MU_STREAM_RDWR|MU_STREAM_WRITE|MU_STREAM_APPEND)))
+ return EACCES;
return mbox->_expunge (mbox);
}

Return to:

Send suggestions and report system problems to the System administrator.