VFS open call intercept

Richard Sharpe realrichardsharpe at gmail.com
Tue Mar 17 08:00:34 MDT 2015


On Tue, Mar 17, 2015 at 12:08 AM, Sharayu Mantri <sm25541994 at gmail.com> wrote:
> Thank you but their is an issue with the DEBUG messages , I am not sure
> where they are stored. I checked most of the logs and  /var/log/debug but
> still didnt get where those debug messages are stored, Could u help me with
> it.

If you are using a build that uses the LFS? logs will be in
/var/log/samba other wise check /usr/local/samba/var ...

You should use strncpy or talloc_sprintf etc.

> and Can u suggest any other copy function that can be permitted by samba.
>
> Thanks and regards,
> Sharayu Mantri
>
> On Mon, Mar 16, 2015 at 11:51 PM, Jeremy Allison <jra at samba.org> wrote:
>>
>> 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.
>
>



-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)


More information about the samba-technical mailing list