directory path info in vfs readdir

Philip de Nier philip.denier at
Fri Apr 7 09:32:35 GMT 2006

> > 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 reinstall.


More information about the samba-technical mailing list