Upgrading old VFS modules

Jeremy Allison jra at samba.org
Wed Apr 2 20:22:48 GMT 2008


On Wed, Apr 02, 2008 at 07:59:35PM +0100, Paul Weaver wrote:
> Hi all,
> 
> I'm currently trying to update a few VFS modules to compile under a
> later version of samba (3.0.26a, then on to 3.0.28a and 3.2 -- I dread
> to consider samba 4 at this stage!). They were written for 3.0.23d, I
> believe, expecting SMB_VFS_INTERFACE_VERSION 16. The latest interface,
> as far as I can tell, is version 21  (unchanged since at least 3.0.26a)
> (22 in 3.2)
> 
> These are transparent vfs modules. 
> 
> Now I'm happy about removing the connection_struct from each method
> (v17), and move to using ntimes (v20), but I'm currently stuck on the
> change that were brought in in version 18 -- the addition of a
> file_struct to SMB_VFS_NEXT_OPEN
> 
> The simplest module basically renames a certain file name from "foo.txt"
> to "foo_ip_user.txt", while presenting foo.txt to each client.
> 
> It does this by changing the "const char *path" in calls like NEXT_OPEN,
> effectively :
> if (is_a_bad_file($name)) =~ s/$name/$ip_$user_$name/;
> 
> It all seems to work when I pass through the files_struct and only
> change the fname char, but I'm not 100% convinced that everything is
> playing nice. Looking in smb.h, I can see a files_struct is a fairly
> complicated struct, so changing it with fsp->fsp_name will probably
> cause major problems. 

What is going wrong ? Changing the name passed to the underlying
"open" call would work, you shouldn't need to change anything in
the fsp struct (you shouldn't need to change fsp->fsp_name) -
the one thing you'll need to catch is the readdir() call, you
need to do the name substitution there as well.

Let me know how I can help (I owe you guys big time for commissioning
"Life on Mars" and the new "Dr. Who" :-).

Jeremy.


More information about the samba-technical mailing list