directory path info in vfs readdir
jk at zg.cz
Sun Apr 9 03:41:25 GMT 2006
you don't need to use the SMB_STRUCT_DIR structure, if you
override all the directory calls (opendir/readdir/closedir/
seekdir/telldir). Samba does not care so much about the
structure in that case. I for example have a custom structure
that also has a database result handle. And it works fine.
So you can make a custom structure in opendir that you return
typed as (DIR *) and then retype the pointer back in readdir
to extract the values you need from it. For example the path
that you can set at the opendir time when it is available.
I hope this helps. I am working on a full opaque module now
that will serve as a good example for this.
On Fri 07-04-06 10:32:35, Philip de Nier wrote:
> >> The smbd version is 3.0.13-1.1-SUSE, on Suse 9.3, Linux
> >This code has changed since that release. I'd suggest using the latest
> >version and seeing if the problem still occurs.
> I tried it with the latest version and the problem is still there.
> It seems the problem arises from Samba code initiating calls to the
> underlying file system via VFS without following the same route as calls
> initiated by client code. The issue I was experiencing arose when a Windows
> client was doing a "dir" on a non-existent directory and the Samba code at
> some point calls "scan_directory" in smbd/filename.c, which calls "OpenDir"
> in smbd/dir.c, which then gets routed to the VFS. This process does not use
> the code to create a new directory pointer, namely "dptr_create" in
> smbd/dir.c, and subsequently the connection struct is not updated with the
> directory path.
> Ideally I would want to filter directory listings in the VFS "opendir"
> function, but unfortunately the DIR (aka SMB_STRUCT_DIR) data stream is
> opaque and cannot be modified. The work-around was to do the filtering in
> the VFS "readdir" function, but as it turns out the directory path
> information is not available in the current code setup (it is hidden away
> in the "smb_Dir" struct defined in smbd/dir.c). I guess this is a reason
> why the veto files and hide files configuration options only support names
> and not paths, because the filtering is done at the "readdir" stage.
> Filtering files using directory path information was something to make my
> application more robust and was not a hard requirement, so I'll stick with
> the pre installed Samba code rather than require users to patch and
Jiri Klouda <jk at zg.cz>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 191 bytes
Desc: Digital signature
Url : http://lists.samba.org/archive/samba-technical/attachments/20060408/705daa58/attachment.bin
More information about the samba-technical