Bugfixes.
* libmailutils/base/amd.c (amd_open): Return error if the mailbox cannot be opened for the required access permissions. (amd_message_stream_open): Fix condition for determining r/w access. * mh/mh_list.c (eval_extras): Break the loop if mu_header_aget_field_name fails.
Showing
4 changed files
with
9 additions
and
7 deletions
... | @@ -365,10 +365,15 @@ amd_open (mu_mailbox_t mailbox, int flags) | ... | @@ -365,10 +365,15 @@ amd_open (mu_mailbox_t mailbox, int flags) |
365 | else | 365 | else |
366 | return errno; | 366 | return errno; |
367 | } | 367 | } |
368 | 368 | ||
369 | if (!S_ISDIR (st.st_mode)) | 369 | if (!S_ISDIR (st.st_mode)) |
370 | return EINVAL; | 370 | return EINVAL; |
371 | 371 | ||
372 | if (access (amd->name, | ||
373 | (flags & (MU_STREAM_WRITE|MU_STREAM_APPEND)) ? | ||
374 | W_OK : R_OK | X_OK)) | ||
375 | return errno; | ||
376 | |||
372 | if (mailbox->locker == NULL) | 377 | if (mailbox->locker == NULL) |
373 | mu_locker_create (&mailbox->locker, "/dev/null", 0); | 378 | mu_locker_create (&mailbox->locker, "/dev/null", 0); |
374 | 379 | ||
... | @@ -1674,7 +1679,7 @@ amd_message_stream_open (struct _amd_message *mhm) | ... | @@ -1674,7 +1679,7 @@ amd_message_stream_open (struct _amd_message *mhm) |
1674 | } | 1679 | } |
1675 | 1680 | ||
1676 | /* The message should be at least readable */ | 1681 | /* The message should be at least readable */ |
1677 | if (amd->mailbox->flags & (MU_STREAM_RDWR|MU_STREAM_WRITE|MU_STREAM_APPEND)) | 1682 | if (amd->mailbox->flags & (MU_STREAM_WRITE|MU_STREAM_APPEND)) |
1678 | flags |= MU_STREAM_RDWR; | 1683 | flags |= MU_STREAM_RDWR; |
1679 | else | 1684 | else |
1680 | flags |= MU_STREAM_READ; | 1685 | flags |= MU_STREAM_READ; | ... | ... |
... | @@ -755,7 +755,8 @@ eval_extras (struct eval_env *env) | ... | @@ -755,7 +755,8 @@ eval_extras (struct eval_env *env) |
755 | mu_header_get_field_count (hdr, &num); | 755 | mu_header_get_field_count (hdr, &num); |
756 | for (i = 1; i <= num; i++) | 756 | for (i = 1; i <= num; i++) |
757 | { | 757 | { |
758 | mu_header_aget_field_name (hdr, i, &str); | 758 | if (mu_header_aget_field_name (hdr, i, &str)) |
759 | break; | ||
759 | if (want_header (env, str) | 760 | if (want_header (env, str) |
760 | && !header_is_printed (env, str)) | 761 | && !header_is_printed (env, str)) |
761 | { | 762 | { | ... | ... |
-
Please register or sign in to post a comment