VFS module in Samba 3.0 (read and write files doesn't work)

Simo Sorce idra at samba.org
Tue Jul 13 09:33:50 GMT 2004

On Tue, 2004-07-13 at 09:47, Alejandro Sánchez Acosta wrote:
> Hello,
> I'm making a VFS module for Samba 3.0 and I intercept at this moment the
> connect/disconnect/open/close calls.
> If I try to intercept the read and write calls, I don't register
> anything. In almost all situations I usually use syslog to register the
> messages in the /var/log/messages.
> I think is because all the files are mapped in memory, so the regions
> are protected with PROT_READ and PROT_WRITE and that is the reason
> because I can't intercept that calls.

I don't think so, you "intercept" them by wrapping them before they are
actually called inside the vfs layer.
If you coded your module the right way there's no way for samba to reach
the file system except by passing through your own read and write calls

> I know I can disable mmap in Samba, but is going to affect in the
> performance.

No need to disable mmap, and that's not used to read/write files anyway.

> The reason because I intercept reads and writes is only because I want
> to know if you are reading or writting a file with Samba, so I don't
> know if it is a better way to do it.
> Any clue?

You may have made something wrong, try to modify the example audit
module and see what you get.

> P.D: I don't know if I have to intercept other calls to know if you are
> reading or writting a file, like sendfile(), pread() or pwrite().

If you're unsure what calls you need to intercept, just run samba as
single instance and strace it.


Simo Sorce    -  idra at samba.org
Samba Team    -  http://www.samba.org
Italian Site  -  http://samba.xsec.it

More information about the samba-technical mailing list