summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2021-07-13 01:02:54 +0300
committerSergey Poznyakoff <gray@gnu.org>2021-07-13 01:02:54 +0300
commit68d9a35c007eda5de8e2aafd1434b7a8f9b06604 (patch)
treef3b8a421f0fbdbcb17b18e999edce1d9ae6c7bb4
parent0014b117d9657b92f6b2c41df2387d158cc36c7c (diff)
downloadmailutils-68d9a35c007eda5de8e2aafd1434b7a8f9b06604.tar.gz
mailutils-68d9a35c007eda5de8e2aafd1434b7a8f9b06604.tar.bz2
Bugfixes
* libproto/imap/fetch.c (_fill_response): Tolerate NIL date field. * libproto/imap/mailbox.c (__imap_msg_get_stream): Seek to the end, instead of computing stream size. * libproto/mbox/mboxrd.c (mailbox_append_message): If all methods of determining envelope size fail, assume epoch instead of bailing out.
-rw-r--r--libproto/imap/fetch.c8
-rw-r--r--libproto/imap/mailbox.c2
-rw-r--r--libproto/mbox/mboxrd.c8
3 files changed, 14 insertions, 4 deletions
diff --git a/libproto/imap/fetch.c b/libproto/imap/fetch.c
index e9020c55d..ad1f849bb 100644
--- a/libproto/imap/fetch.c
+++ b/libproto/imap/fetch.c
@@ -870,9 +870,7 @@ _fill_response (void *item, void *data)
switch (env->n++)
{
case env_date:
- if (elt->type != imap_eltype_string)
- rc = MU_ERR_FAILURE;
- else
+ if (elt->type == imap_eltype_string)
{
if (mu_scan_datetime (elt->v.string,
MU_DATETIME_SCAN_RFC822,
@@ -882,6 +880,10 @@ _fill_response (void *item, void *data)
else
rc = 0;
}
+ else if (_mu_imap_list_element_is_nil (elt))
+ rc = 0;
+ else
+ rc = MU_ERR_FAILURE;
break;
case env_subject:
diff --git a/libproto/imap/mailbox.c b/libproto/imap/mailbox.c
index 733fc8c4b..529fadf24 100644
--- a/libproto/imap/mailbox.c
+++ b/libproto/imap/mailbox.c
@@ -174,7 +174,7 @@ __imap_msg_get_stream (struct _mu_imap_message *imsg, size_t msgno,
mu_stream_set_buffer (imbx->cache, mu_buffer_full, 8192);
}
- rc = mu_stream_size (imbx->cache, &imsg->offset);
+ rc = mu_stream_seek (imbx->cache, 0, MU_SEEK_END, &imsg->offset);
if (rc)
return rc;
diff --git a/libproto/mbox/mboxrd.c b/libproto/mbox/mboxrd.c
index 6357bbbc7..43c370dc9 100644
--- a/libproto/mbox/mboxrd.c
+++ b/libproto/mbox/mboxrd.c
@@ -1141,6 +1141,14 @@ mailbox_append_message (mu_mailbox_t mailbox, mu_message_t msg)
if (rc == 0)
{
rc = mu_envelope_aget_date (env, &date);
+ if (rc == MU_ERR_NOENT)
+ {
+ date = strdup ("Thu Jan 1 00:00:00 1970");
+ if (date)
+ rc = 0;
+ else
+ rc = ENOMEM;
+ }
}
mu_envelope_destroy (&env, msg);

Return to:

Send suggestions and report system problems to the System administrator.