]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
mail-filter: If filter returns 0 bytes, treat it as EIO error.
authorTimo Sirainen <tss@iki.fi>
Tue, 17 Dec 2013 19:33:32 +0000 (21:33 +0200)
committerTimo Sirainen <tss@iki.fi>
Tue, 17 Dec 2013 19:33:32 +0000 (21:33 +0200)
src/plugins/mail-filter/istream-ext-filter.c
src/plugins/mail-filter/ostream-ext-filter.c

index 0af40e59ae60d4a409a2dab9604d333f3006cc31..9c2f26024136afb10af6b9952ce435cca9e2b640 100644 (file)
@@ -118,6 +118,13 @@ static ssize_t i_stream_mail_filter_read(struct istream_private *stream)
                if (!stream->istream.blocking)
                        break;
        }
+       if (ret == -1 && !i_stream_have_bytes_left(&stream->istream) &&
+           stream->istream.v_offset == 0) {
+               /* EOF without any input -> assume the script is repoting
+                  failure. pretty ugly way, but currently there's no error
+                  reporting channel. */
+               stream->istream.stream_errno = EIO;
+       }
        return ret;
 }
 
index 1afd7ba140eef07ca32ed7ec9a0530ff93d5a9d7..d0bbd1ec106e3208bc914e0d7d895b09e1f3e0e6 100644 (file)
@@ -93,6 +93,14 @@ static int o_stream_mail_filter_flush(struct ostream_private *stream)
        }
        i_assert(ret == -1);
 
+       if (!i_stream_have_bytes_left(mstream->ext_in) &&
+           mstream->ext_in->v_offset == 0) {
+               /* EOF without any input -> assume the script is repoting
+                  failure. pretty ugly way, but currently there's no error
+                  reporting channel. */
+               stream->ostream.stream_errno = EIO;
+               return -1;
+       }
        if (mstream->ext_in->stream_errno != 0) {
                stream->ostream.stream_errno = mstream->ext_in->stream_errno;
                return -1;