VFS open call intercept

Jeremy Allison jra at samba.org
Mon Mar 16 17:51:32 MDT 2015

On Sun, Mar 15, 2015 at 08:00:22AM +0000, Sharayu Mantri wrote:
> Sir,
> I wanted to intercept Open Vfs call and when file from shared folder is
> accessed from windows open call should update the increased frequency (no
> of times the file is accessed) of that file in database. Here i am using
> Berkeley DB . But I am not sure if the way i have intercepted the open call
> is correct. Or is it possible to that whenever i file is created in shared
> folder by server or windows client then VFS adding tht file in databse ? In
> such case which function call shou;d be interrupted because these functions
> keep on calling continoulsy.
> I have attached my skel_transparent code which intercepts Open vfs call ,
> If you could just lok into and advice me if it is correct or it could be
> done any better.
> Also I am encountering another problem that i have  berkeley db in my
> samba. And the close function is conflicted by some close function of vfs.
> Although my dbp->close() takes in DB_CLOSE takes 2 parameters it says error
> that  Close should  take one parameter. Is their a way where  i could
> resolve this conflict of vfs close and db close.

DEBUG statements are your friend when debugging things
like this.

But one comment I have to make:

> void string_cpy(char *a,char *b)
> {
>   while((*b)!='\0')
>   {
>      *a=*b;
>      a++;
>      b++;
>   }
>    *a='\0';
> }

The above re-implements strcpy(). Please don't
do that - ever. There's a reason strcpy() is
banned inside of Samba. It makes security holes.

More information about the samba-technical mailing list