sieve: bugfixes
* include/mailutils/sieve.h (mu_sieve_debug_handle): New declaration. (mu_sieve_debug_init): New prototype. * libmu_sieve/conf.c (mu_sieve_debug_handle): New global. (mu_sieve_module_init): Call mu_sieve_debug_init. * libmu_sieve/extensions/spamd.c (spamd_connect_tcp) (spamd_connect_socket): Fix stream creation. (spamd_send_message): Switch to full buffering on the transport stream and indicate it is a payload (in case transcript is enabled), before copying data. Restore things to their original state afterwards. (spamd_read_line): Rewrite using mu_stream_getline. (decode_float): Additional argument endp. Unless NULL, store there the position in the input string where the parsing has stopped. (parse_response_line): New function. (spamd_test): Rewrite using new API. * sieve/sieve.c (parser): --dry-run implies --verbose. * libmailutils/filter/base64.c (_base64_decoder): when not enough data are available and cmd is not mu_filter_lastbuf, return mu_filter_lastbuf. * libmailutils/stream/stream.c (mu_stream_shutdown): Flush the buffers before shutting the transport down. * libmailutils/tests/fltst.c (main): New option bufsize=
Showing
1 changed file
with
10 additions
and
1 deletions
... | @@ -82,7 +82,7 @@ usage (const char *diag) | ... | @@ -82,7 +82,7 @@ usage (const char *diag) |
82 | fp = stdout; | 82 | fp = stdout; |
83 | 83 | ||
84 | fprintf (fp, "%s", | 84 | fprintf (fp, "%s", |
85 | "usage: fltst FILTER {encode|decode} {read|write} [shift=N] [verbose] [printable] [nl] [-- args]\n"); | 85 | "usage: fltst FILTER {encode|decode} {read|write} [shift=N] [verbose] [printable] [nl] [bufsize=N] [-- args]\n"); |
86 | exit (diag ? 1 : 0); | 86 | exit (diag ? 1 : 0); |
87 | } | 87 | } |
88 | 88 | ||
... | @@ -96,6 +96,7 @@ main (int argc, char * argv []) | ... | @@ -96,6 +96,7 @@ main (int argc, char * argv []) |
96 | char *fltname; | 96 | char *fltname; |
97 | mu_off_t shift = 0; | 97 | mu_off_t shift = 0; |
98 | int newline_option = 0; | 98 | int newline_option = 0; |
99 | size_t bufsize = 0; | ||
99 | 100 | ||
100 | if (argc == 1) | 101 | if (argc == 1) |
101 | usage (NULL); | 102 | usage (NULL); |
... | @@ -122,6 +123,8 @@ main (int argc, char * argv []) | ... | @@ -122,6 +123,8 @@ main (int argc, char * argv []) |
122 | { | 123 | { |
123 | if (strncmp (argv[i], "shift=", 6) == 0) | 124 | if (strncmp (argv[i], "shift=", 6) == 0) |
124 | shift = strtoul (argv[i] + 6, NULL, 0); | 125 | shift = strtoul (argv[i] + 6, NULL, 0); |
126 | else if (strncmp (argv[i], "bufsize=", 8) == 0) | ||
127 | bufsize = strtoul (argv[i] + 8, NULL, 0); | ||
125 | else if (strcmp (argv[i], "verbose") == 0) | 128 | else if (strcmp (argv[i], "verbose") == 0) |
126 | verbose++; | 129 | verbose++; |
127 | else if (strcmp (argv[i], "printable") == 0) | 130 | else if (strcmp (argv[i], "printable") == 0) |
... | @@ -141,6 +144,8 @@ main (int argc, char * argv []) | ... | @@ -141,6 +144,8 @@ main (int argc, char * argv []) |
141 | argv += i; | 144 | argv += i; |
142 | 145 | ||
143 | MU_ASSERT (mu_stdio_stream_create (&in, MU_STDIN_FD, 0)); | 146 | MU_ASSERT (mu_stdio_stream_create (&in, MU_STDIN_FD, 0)); |
147 | if (bufsize) | ||
148 | mu_stream_set_buffer (in, mu_buffer_full, bufsize); | ||
144 | MU_ASSERT (mu_stdio_stream_create (&out, MU_STDOUT_FD, 0)); | 149 | MU_ASSERT (mu_stdio_stream_create (&out, MU_STDOUT_FD, 0)); |
145 | 150 | ||
146 | if (flags == MU_STREAM_READ) | 151 | if (flags == MU_STREAM_READ) |
... | @@ -150,6 +155,8 @@ main (int argc, char * argv []) | ... | @@ -150,6 +155,8 @@ main (int argc, char * argv []) |
150 | mode, | 155 | mode, |
151 | MU_STREAM_READ|MU_STREAM_SEEK)); | 156 | MU_STREAM_READ|MU_STREAM_SEEK)); |
152 | mu_stream_unref (in); | 157 | mu_stream_unref (in); |
158 | if (bufsize) | ||
159 | mu_stream_set_buffer (flt, mu_buffer_full, bufsize); | ||
153 | if (shift) | 160 | if (shift) |
154 | MU_ASSERT (mu_stream_seek (flt, shift, MU_SEEK_SET, NULL)); | 161 | MU_ASSERT (mu_stream_seek (flt, shift, MU_SEEK_SET, NULL)); |
155 | c_copy (out, flt); | 162 | c_copy (out, flt); |
... | @@ -160,6 +167,8 @@ main (int argc, char * argv []) | ... | @@ -160,6 +167,8 @@ main (int argc, char * argv []) |
160 | argc, (const char **)argv, | 167 | argc, (const char **)argv, |
161 | mode, | 168 | mode, |
162 | MU_STREAM_WRITE)); | 169 | MU_STREAM_WRITE)); |
170 | if (bufsize) | ||
171 | mu_stream_set_buffer (flt, mu_buffer_full, bufsize); | ||
163 | if (shift) | 172 | if (shift) |
164 | MU_ASSERT (mu_stream_seek (in, shift, MU_SEEK_SET, NULL)); | 173 | MU_ASSERT (mu_stream_seek (in, shift, MU_SEEK_SET, NULL)); |
165 | c_copy (flt, in); | 174 | c_copy (flt, in); | ... | ... |
-
Please register or sign in to post a comment