Bugfixes.
* mailbox/filter.c (filter_close): Do not close transport stream if the MU_STREAM_NO_CLOSE flag is set. * imap4d/fetch.c (fetch_io): Fix memory leak: open the filter with MU_STREAM_NO_CLOSE flag and destroy it after use. * include/mailutils/header.h (mu_header_set_stream): Comment out. There is no such function, but perhaps there should be? * libproto/mbox/folder.c (_folder_mbox_init): If there is no explicit path in the URL, use ".". This makes it possible to use URLs like: mbox:file. * mailbox/nls.c (mu_set_locale) [ENABLE_NLS]: Remove ifdef. Setlocale must be enabled whenever possible, otherwise we cannot relay on mu_strftime malfunctions in non-english locales. * mh/mh_whom.c (mh_alias_expand): Handle NULL or empty inputs.
Showing
6 changed files
with
30 additions
and
6 deletions
... | @@ -692,7 +692,8 @@ fetch_io (mu_stream_t stream, size_t start, size_t size, size_t max) | ... | @@ -692,7 +692,8 @@ fetch_io (mu_stream_t stream, size_t start, size_t size, size_t max) |
692 | size_t n = 0; | 692 | size_t n = 0; |
693 | mu_off_t offset; | 693 | mu_off_t offset; |
694 | 694 | ||
695 | mu_filter_create (&rfc, stream, "rfc822", MU_FILTER_ENCODE, MU_STREAM_READ); | 695 | mu_filter_create (&rfc, stream, "rfc822", MU_FILTER_ENCODE, |
696 | MU_STREAM_READ|MU_STREAM_NO_CHECK|MU_STREAM_NO_CLOSE); | ||
696 | 697 | ||
697 | if (start == 0 && size == (size_t) -1) | 698 | if (start == 0 && size == (size_t) -1) |
698 | { | 699 | { |
... | @@ -721,6 +722,7 @@ fetch_io (mu_stream_t stream, size_t start, size_t size, size_t max) | ... | @@ -721,6 +722,7 @@ fetch_io (mu_stream_t stream, size_t start, size_t size, size_t max) |
721 | } | 722 | } |
722 | else if (size + 2 < size) /* Check for integer overflow */ | 723 | else if (size + 2 < size) /* Check for integer overflow */ |
723 | { | 724 | { |
725 | mu_stream_destroy (&rfc, NULL); | ||
724 | return RESP_BAD; | 726 | return RESP_BAD; |
725 | } | 727 | } |
726 | else | 728 | else |
... | @@ -751,6 +753,7 @@ fetch_io (mu_stream_t stream, size_t start, size_t size, size_t max) | ... | @@ -751,6 +753,7 @@ fetch_io (mu_stream_t stream, size_t start, size_t size, size_t max) |
751 | util_send (" \"\""); | 753 | util_send (" \"\""); |
752 | free (buffer); | 754 | free (buffer); |
753 | } | 755 | } |
756 | mu_stream_destroy (&rfc, NULL); | ||
754 | return RESP_OK; | 757 | return RESP_OK; |
755 | } | 758 | } |
756 | 759 | ... | ... |
... | @@ -149,8 +149,9 @@ extern int mu_header_aget_field_value_unfold (mu_header_t header, size_t num, | ... | @@ -149,8 +149,9 @@ extern int mu_header_aget_field_value_unfold (mu_header_t header, size_t num, |
149 | char **pvalue); | 149 | char **pvalue); |
150 | 150 | ||
151 | extern int mu_header_get_stream (mu_header_t, mu_stream_t *); | 151 | extern int mu_header_get_stream (mu_header_t, mu_stream_t *); |
152 | extern int mu_header_set_stream (mu_header_t, mu_stream_t, void *); | 152 | /* FIXME: This function does not exist: |
153 | 153 | extern int mu_header_set_stream (mu_header_t, mu_stream_t, void *); | |
154 | */ | ||
154 | extern int mu_header_size (mu_header_t, size_t *); | 155 | extern int mu_header_size (mu_header_t, size_t *); |
155 | extern int mu_header_lines (mu_header_t, size_t *); | 156 | extern int mu_header_lines (mu_header_t, size_t *); |
156 | 157 | ... | ... |
... | @@ -159,11 +159,23 @@ _folder_mbox_init (mu_folder_t folder) | ... | @@ -159,11 +159,23 @@ _folder_mbox_init (mu_folder_t folder) |
159 | return ENOMEM; | 159 | return ENOMEM; |
160 | 160 | ||
161 | status = mu_url_aget_path (folder->url, &dfolder->dirname); | 161 | status = mu_url_aget_path (folder->url, &dfolder->dirname); |
162 | if (status == MU_ERR_NOENT) | ||
163 | { | ||
164 | dfolder->dirname = malloc (2); | ||
165 | if (dfolder->dirname == NULL) | ||
166 | status = ENOMEM; | ||
167 | else | ||
168 | { | ||
169 | strcpy (dfolder->dirname, "."); | ||
170 | status = 0; | ||
171 | } | ||
172 | } | ||
173 | |||
162 | if (status) | 174 | if (status) |
163 | { | 175 | { |
164 | free (dfolder); | 176 | free (dfolder); |
165 | folder->data = NULL; | 177 | folder->data = NULL; |
166 | return ENOMEM; | 178 | return status; |
167 | } | 179 | } |
168 | 180 | ||
169 | folder->_destroy = folder_mbox_destroy; | 181 | folder->_destroy = folder_mbox_destroy; | ... | ... |
... | @@ -35,7 +35,7 @@ First draft: Alain Magloire. | ... | @@ -35,7 +35,7 @@ First draft: Alain Magloire. |
35 | #endif | 35 | #endif |
36 | 36 | ||
37 | #include <filter0.h> | 37 | #include <filter0.h> |
38 | 38 | #include <stream0.h> | |
39 | #include <mailutils/iterator.h> | 39 | #include <mailutils/iterator.h> |
40 | #include <mailutils/stream.h> | 40 | #include <mailutils/stream.h> |
41 | #include <mailutils/errno.h> | 41 | #include <mailutils/errno.h> |
... | @@ -124,6 +124,8 @@ static int | ... | @@ -124,6 +124,8 @@ static int |
124 | filter_close (mu_stream_t stream) | 124 | filter_close (mu_stream_t stream) |
125 | { | 125 | { |
126 | mu_filter_t filter = mu_stream_get_owner (stream); | 126 | mu_filter_t filter = mu_stream_get_owner (stream); |
127 | if (stream->flags & MU_STREAM_NO_CLOSE) | ||
128 | return 0; | ||
127 | return mu_stream_close (filter->stream); | 129 | return mu_stream_close (filter->stream); |
128 | } | 130 | } |
129 | 131 | ... | ... |
... | @@ -36,7 +36,7 @@ char *mu_locale_set; | ... | @@ -36,7 +36,7 @@ char *mu_locale_set; |
36 | char * | 36 | char * |
37 | mu_set_locale (const char *locale) | 37 | mu_set_locale (const char *locale) |
38 | { | 38 | { |
39 | #if defined HAVE_SETLOCALE && defined ENABLE_NLS | 39 | #if defined HAVE_SETLOCALE |
40 | return setlocale (LC_ALL, locale); | 40 | return setlocale (LC_ALL, locale); |
41 | #else | 41 | #else |
42 | return NULL; | 42 | return NULL; | ... | ... |
... | @@ -59,6 +59,12 @@ mh_alias_expand (const char *str, mu_address_t *paddr, int *incl) | ... | @@ -59,6 +59,12 @@ mh_alias_expand (const char *str, mu_address_t *paddr, int *incl) |
59 | mu_address_t addr; | 59 | mu_address_t addr; |
60 | int status; | 60 | int status; |
61 | 61 | ||
62 | if (!str || !*str) | ||
63 | { | ||
64 | *paddr = NULL; | ||
65 | return 0; | ||
66 | } | ||
67 | |||
62 | if (incl) | 68 | if (incl) |
63 | *incl = 0; | 69 | *incl = 0; |
64 | status = mu_address_create_hint (&addr, str, NULL, 0); | 70 | status = mu_address_create_hint (&addr, str, NULL, 0); | ... | ... |
-
Please register or sign in to post a comment