Creating a VFS backend

Matthew DeVore matvore at google.com
Wed Aug 12 21:10:47 UTC 2020


On Wed, Aug 12, 2020 at 12:44 AM Stefan Metzmacher <metze at samba.org> wrote:
>
> My guess should be hello_create_dfs_pathat or hello_get_dfs_referrals.
>
> > Here is the output of smbd:
> >
> > $ sudo ~/samba_build/sbin/smbd  --foreground --port 8111 --debuglevel=1 -S
>
> Add debug messages to all the calls, btw. you should use
> DBG_{ERR,WARNING,DEBUG,...}() instead of the raw DEBUG() macro.

Nice, thanks for the tip.

>
> And let it run with log level 10, I'd also skip the -S option.
>
> Also look take network captures on the server side
> (because the timestamps of the capture and log files come from the same clock).
> and check what requests are sent on the wire.

Last time I tried using WireShark to capture SMB traffic, the data was
correct since I could see unencrypted filenames in the hex dumps, but
the binary data of the requests were not annotated with field names
and such, though this worked for NFS automatically earlier. Maybe I'm
missing some knob on WireShark...

>
> With that you should be able to make progress.

Fortunately I was able to figure this out because of a private reply
(which I only just now realized was private). The salient advise of
that reply was to set the debuglevel to 10 and look for
STATUS_NOT_IMPLEMENTED in the log output. After I did that, I manually
traced some code path from the log message to see it was attempting to
invoke createfile. I didn't instrument or log createfile calls at all,
but had them return NOT_IMPLEMENTED, because I thought createfile only
referred to making a file on disk. But that's actually used to open
files as well. So after I replaced my createfile function pointer with
NULL in my struct vfs_fn_pointers, my backend's get_dos_attributes fn
got invoked, since the default implementation of createfile does that,
apparently, when a file is being opened. So I'll proceed by
implementing get_dos_attributes.

- Matt



More information about the samba-technical mailing list