The Samba copy file call flow

Richard Sharpe realrichardsharpe at
Mon May 5 07:51:48 MDT 2014

On Mon, May 5, 2014 at 5:16 AM, GongJinrong <jinronggong at> wrote:
> Hi, Richard
>    I have another question, samba VFS module doesn't allow to use strcpy/strcat/sprintf, and if I use
> the safe version such as fstrcpy, but I got __unsafe_string_function_usage_here__, how can I get
> safe string function for samba module using.

You probably should be using talloc for allocations in the VFS module
and then you should use the talloc versions of those functions, in
particular talloc_snprintf or whatever ... look in the talloc header

Alternatively, if they are strings on the stack, use
strlcpy/strlcat/slprintf if they are available under Linux else use

> -----Original Message-----
> From: samba-technical-bounces at [mailto:samba-technical-bounces at] On Behalf Of GongJinrong
> Sent: Monday, May 05, 2014 7:03 PM
> To: 'Richard Sharpe'
> Cc: 'samba-technical'
> Subject: RE: The Samba copy file call flow
> Hi, Richard
>    Thanks for your advice, and I will update it to a new version, with your excellent paper "Writing a Samba VFS", I wrote a VFS module, but when I debug the samba code, I found a strange thing, the close operation always is delayed about 15 seconds when I do a file copy, can the close operation be called just after writing all data immediately?
> -----Original Message-----
> From: samba-technical-bounces at [mailto:samba-technical-bounces at] On Behalf Of Richard Sharpe
> Sent: Monday, May 05, 2014 3:47 AM
> To: GongJinrong
> Cc: samba-technical
> Subject: Re: The Samba copy file call flow
> On Sun, May 4, 2014 at 1:50 AM, GongJinrong <jinronggong at> wrote:
>> Thanks Brad, my installed samba is really old, I installed it by yum
>> in CentOS 6.3, and now the yum version is updated to 3.6.9, I will
>> update it, thanks a lots for your advice^^.
> Hi,
> Even 3.6.9 is really old, and you should try to use something more recent. The SerNet folks were making source and binary RPMs available for more recent version of 3.6, so you should probably go with those if you want to stick with a 3.6.x version, and installing their RPMs is not so hard.
> I notice that the latest there is from March in 2014 which is quite recent:
> However, for Samba 4 you will need to register with them, as it says
> here:
> Building an RPM from their source RPM is also not that hard, especially as it seems you want to make some mods.
>> -----Original Message-----
>> From: samba-technical-bounces at
>> [mailto:samba-technical-bounces at] On Behalf Of Brad
>> Hards
>> Sent: Sunday, May 04, 2014 2:30 PM
>> To: samba-technical at
>> Subject: Re: The Samba copy file call flow
>> On Sun, 4 May 2014 02:15:21 PM GongJinrong wrote:
>>>  my samba version is 3.5.10,
>> This is almost three years old. Perhaps you could choose a newer
>> version - I'd recommend the latest 4.1 release, but even 3.6.23 (if
>> you really do not want to go to Samba 4) would be better - there are
>> quite a few security fixes since
>> 3.5.10 (see for
>> the release).
>> I don't know the details of the VFS question you are asking though.
>> Brad
> --
> Regards,
> Richard Sharpe
> (何以解憂?唯有杜康。--曹操)

Richard Sharpe

More information about the samba-technical mailing list