My own VFS module

Julien Thomas omnikron at free.fr
Mon May 2 14:11:50 GMT 2005


Hi all,

Before all, sorry for my bad english, and sorry again if this is not the 
adapted mailing list for my questions.

I am developing a VFS module to get some log informations. It is 
inspired of the vfs_audit.c

The goal is to trace SMB_VFS_OP_CONNECT and SMB_VFS_OP_DISCONNECT 
operations and to log some informations into an SQLite database.

With this, I want to write a connection counter. I log _the two_ 
operations (connect and disconnect) because I want also to calculate the 
connection time and because I want only to consider a connection if it 
has been _connected_ and after _disconnected_.

So, for those two operations, I want put the following informations in 
the database :
- *samba server process pid*
- *samba internal pid*
- *username*
- *service*
- *time*
- *operation* (connect or disconnect)

I get *operation* trivially.
I get *time* with the C library functions.
I get *service* and *user* with the vfs disk operations functions params.
I don't know how i will get *samba server process pid* but I think this 
will not be a problem.

But... I have no idea of how get the samba internal pid of a connection. 

I am looking for something like the *pid* field of a *struct 
connections_data*. I looked *struct connection_struct* (because a 
pointer to this struc is passed in te vfs functions params) in smb.h but 
  I didn't find any field that could give the internal smb pid of the 
operation.

If anyone could have a solution ?

My second question is about the vfs layers. For instant, I have declared 
my vfs tuples like that :
{SMB_VFS_OP(inra_connect), SMB_VFS_OP_CONNECT, SMB_VFS_LAYER_LOGGER}...

Is SMB_VFS_LAYER_LOGGER the best way to do what I want ? I took a look 
to the Samba Developers Guide but I don't really understood the 
differences there are between LOGGER, SCANNER, OPAQUE, TRANSPARENT, ...

Could you help me to understand this please ?

Thanks a lot in advance,
Julien Thomas


More information about the samba-technical mailing list