VFS chroot

René Klomp rene.klomp at os3.nl
Fri Nov 16 07:48:09 MST 2012


Hi all,

I am developing a VFS module that modifies certain files in a specific
way that can be different each time that file is opened
To do this I want to use an external script that takes a file as input
and then changes it and writes those changes to a temporary file. The
temporary file then has to be served to the client.

How could I best do this?
I tried the following:
static int my_vfs_open(vfs_handle_struct *handle, struct smb_filename
*smb_fname,
             files_struct *fsp, int flags, mode_t mode)
{
    if(strcmp(smb_fname->base_name,"test.txt")==0){
        return open("test2.txt", flags, mode);
    }
    return SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);
}

This works, but it is not possible to open a file outside the current
share directory... So I wont be able to let a script write a file to
another directory so that it wont be visible in the share.
Another thing I thought about was piping the output of the external
script to the user. That would probably be more efficient? Is that
possible? If yes, how?

I hope someone can help me in the right direction.

Regards,
Rene

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 551 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20121116/b9fbcc7c/attachment.pgp>


More information about the samba-technical mailing list