From a674a56a97c78a44bf43f1c175d106fbe70c7485 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 8 Feb 2011 15:07:48 -0800 Subject: Add fdopendir to the VFS. We will use this to reuse a directory fd already open by NtCreateX. Autobuild-User: Jeremy Allison Autobuild-Date: Wed Feb 9 00:55:22 CET 2011 on sn-devel-104 --- source3/modules/vfs_scannedonly.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'source3/modules/vfs_scannedonly.c') diff --git a/source3/modules/vfs_scannedonly.c b/source3/modules/vfs_scannedonly.c index 123bf65fd4..fd6c3e2077 100644 --- a/source3/modules/vfs_scannedonly.c +++ b/source3/modules/vfs_scannedonly.c @@ -526,6 +526,35 @@ static SMB_STRUCT_DIR *scannedonly_opendir(vfs_handle_struct * handle, return (SMB_STRUCT_DIR *) sDIR; } +static SMB_STRUCT_DIR *scannedonly_fdopendir(vfs_handle_struct * handle, + files_struct *fsp, + const char *mask, uint32 attr) +{ + SMB_STRUCT_DIR *DIRp; + struct scannedonly_DIR *sDIR; + const char *fname; + + DIRp = SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask, attr); + if (!DIRp) { + return NULL; + } + + fname = (const char *)fsp->fsp_name->base_name; + + sDIR = TALLOC_P(NULL, struct scannedonly_DIR); + if (fname[0] != '/') { + sDIR->base = construct_full_path(sDIR,handle, fname, true); + } else { + sDIR->base = name_w_ending_slash(sDIR, fname); + } + DEBUG(SCANNEDONLY_DEBUG, + ("scannedonly_fdopendir, fname=%s, base=%s\n",fname,sDIR->base)); + sDIR->DIR = DIRp; + sDIR->notify_loop_done = 0; + return (SMB_STRUCT_DIR *) sDIR; +} + + static SMB_STRUCT_DIRENT *scannedonly_readdir(vfs_handle_struct *handle, SMB_STRUCT_DIR * dirp, SMB_STRUCT_STAT *sbuf) @@ -986,6 +1015,7 @@ static int scannedonly_connect(struct vfs_handle_struct *handle, /* VFS operations structure */ static struct vfs_fn_pointers vfs_scannedonly_fns = { .opendir = scannedonly_opendir, + .fdopendir = scannedonly_fdopendir, .readdir = scannedonly_readdir, .seekdir = scannedonly_seekdir, .telldir = scannedonly_telldir, -- cgit