[PATCH 1/7] Samba-VirusFilter: add write_data_timeout ... version 3
Trever L. Adams
trever at middleearth.sapphiresunday.org
Mon Oct 31 23:33:46 UTC 2016
On 10/31/2016 04:26 PM, Jeremy Allison wrote:
> On Fri, Oct 21, 2016 at 11:57:11AM -0600, Trever L. Adams wrote:
>> Samba-VirusFilter: add write_data_timeout and write_data_iov_timeout.
>> This patch adds those functions to sys_rw_data.[ch].
>> Signed-off-by: Trever L. Adams <trever.adams at gmail.com>
> I'm trying to live with write_data_iov_timeout() but I can't. It
> just bugs me :-).
> int cont_eintr
> needs removing. All uses in the VirusFilter code pass
> '1' here, so it really shouldn't be there.
I was unaware of the tstream_context. I was trying to abstract this in a
way that would be useful where eintr shouldn't be ignored too. I see the
points you make below and you are correct. The timeout does need to be
decremented for the reason you were giving. I was mistakenly thinking
the user samba was running as (root, etc.) and the administrator could
be trusted and the system was semi-sane. Thank you for reminding me that
I shouldn't assume such.
> I think this code should connect using tstream_unix_socketpair(),
> create a temp event context to loop on, set a timer event to fire
> after msec_timeout, and then use tstream_writev_send()/tstream_writev_recv()
> to push the data down the socket.
tstream_unix_socketpair() requires two sockets, at least from my
reading. It also seems I would be duplicating a lot of code found in
I see the function tstream_bsd_existing_socket() exists. It would allow
a lot of the code already in place (util_sock.c) to be used. I do not
see it used in any VFS modules. Is this an acceptable choice for a VFS
> That way will correctly handle timeouts and errors in
> communication with the external anti-virus engine.
> If you can't get to this I can try and do this for you, but it'll require
> changes in the other anti-virus code as you won't just be
> storing an int io_h->socket anymore, but a struct tstream_context *.
Thank you for the input, Jeremy. Hopefully with the answers to these
questions I can have a correct version within a day or two.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 872 bytes
Desc: OpenPGP digital signature
More information about the samba-technical