Commit 85032d0e 85032d0e724bcba34a61458c44034336e15b9cbe by Sergey Poznyakoff

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.
1 parent 5e5b68fd
...@@ -369,6 +369,11 @@ amd_open (mu_mailbox_t mailbox, int flags) ...@@ -369,6 +369,11 @@ amd_open (mu_mailbox_t mailbox, int flags)
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;
......
1 ;; Default components file for GNU MH.
2 ;; Lines beginning with ; are ignored. Rest of lines is copied verbatim.
3 To: 1 To:
4 cc: 2 cc:
5 Subject: 3 Subject:
......
1 ;; Default forward components file for GNU MH.
2 ;; Lines beginning with ; are ignored. Rest of lines is copied verbatim.
3 To: 1 To:
4 cc: 2 cc:
5 Subject: 3 Subject:
......
...@@ -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 {
......