Request for review of Samba VirusFilter preparation for merging with Samba

Trever L. Adams trever at middleearth.sapphiresunday.org
Sat Sep 10 19:08:23 UTC 2016


On 09/10/2016 03:41 AM, Volker Lendecke wrote:
>
> The virusfilter_io abstraction could see a lot of code re-use from our
> base libraries. We have for example write_data_iov that you could
> re-use. If that does not do what you need, can we share this code
> somehow?
There are 3 write functions in vfs_virusfilter_utils.c that seem to be
what you are referring to. There is also 1 read function.

The read function needs to be able to stop reading when a specific
string is found (EOL).

The write functions may not be able to be completely factored out, but
they all have code the write_data_iov could replace.

The problem with read_data, write_data and write_data_iov is the need
for a timeout. In the file in question this is done with a poll setup with:

pollfd.events = POLLIN or POLLOUT depending on whether read/write.

If poll returns 0 (time out) we need to know that and abort. If poll is
-1 and errno is anything other than EINTR, we have to abort.

If said functions can have an optional timeout or a timeout version that
does the poll and returns enough information to work on, then I believe
large parts of the write and read functions could be rewritten to use
them instead.

So 2 things needed:
Timeout capable versions.
read function stopping when the buffer in question contains a definable
EOL string. (This may always be a single byte, \x0A, but it may not
depending on the virus scanner.)

It appears that two of the write functions are actually copies of each
other. I will have to check that, but to my eyes they look identical.

Is it possible to get the two things? Or at least the timeout for the
write functions?

Thank you.
Trever


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 872 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160910/52088f1d/signature.sig>


More information about the samba-technical mailing list