dovecot-2.2-pigeonhole: Sieve extprograms plugin: Fixed interact...
pigeonhole at rename-it.nl
pigeonhole at rename-it.nl
Mon May 20 22:20:12 EEST 2013
details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/d4e9ca7fddcf
changeset: 1775:d4e9ca7fddcf
user: Stephan Bosch <stephan at rename-it.nl>
date: Mon May 20 21:20:04 2013 +0200
description:
Sieve extprograms plugin: Fixed interaction between pipe command and remote script service.
The output from the script service was never read, causing a broken pipe error at the script service.
Apparently, this was broken since the I/O handling for extprograms was last revised.
diffstat:
src/plugins/sieve-extprograms/script-client-remote.c | 2 +-
src/plugins/sieve-extprograms/script-client.c | 20 +++++++++++---------
2 files changed, 12 insertions(+), 10 deletions(-)
diffs (52 lines):
diff -r 04ad3c2f0765 -r d4e9ca7fddcf src/plugins/sieve-extprograms/script-client-remote.c
--- a/src/plugins/sieve-extprograms/script-client-remote.c Wed May 15 21:59:32 2013 +0200
+++ b/src/plugins/sieve-extprograms/script-client-remote.c Mon May 20 21:20:04 2013 +0200
@@ -183,7 +183,7 @@
io_remove(&sclient->io);
script_client_init_streams(sclient);
- if ( sclient->output != NULL && !slclient->noreply ) {
+ if ( !slclient->noreply ) {
sclient->script_input = script_client_istream_create
(sclient, sclient->script_input);
}
diff -r 04ad3c2f0765 -r d4e9ca7fddcf src/plugins/sieve-extprograms/script-client.c
--- a/src/plugins/sieve-extprograms/script-client.c Wed May 15 21:59:32 2013 +0200
+++ b/src/plugins/sieve-extprograms/script-client.c Mon May 20 21:20:04 2013 +0200
@@ -145,7 +145,7 @@
if ( input == NULL ) {
o_stream_unref(&sclient->script_output);
- if ( sclient->output == NULL ) {
+ if ( sclient->script_input == NULL ) {
script_client_disconnect(sclient, FALSE);
} else {
sclient->close_output(sclient);
@@ -164,17 +164,19 @@
size_t size;
int ret = 0;
- if ( input != NULL && output != NULL ) {
+ if ( input != NULL ) {
+ while ( (ret=i_stream_read_data(input, &data, &size, 0)) > 0 ) {
+ if ( output != NULL ) {
+ ssize_t sent;
- while ( (ret=i_stream_read_data(input, &data, &size, 0)) > 0 ) {
- ssize_t sent;
-
- if ( (sent=o_stream_send(output, data, size)) < 0 ) {
- script_client_fail(sclient, SCRIPT_CLIENT_ERROR_IO);
- return;
+ if ( (sent=o_stream_send(output, data, size)) < 0 ) {
+ script_client_fail(sclient, SCRIPT_CLIENT_ERROR_IO);
+ return;
+ }
+ size = (size_t)sent;
}
- i_stream_skip(input, sent);
+ i_stream_skip(input, size);
}
if ( ret < 0 ) {
More information about the dovecot-cvs
mailing list