[SCM] Samba Shared Repository - branch v3-6-test updated
Jeremy Allison
jra at samba.org
Tue Feb 8 17:52:10 MST 2011
The branch, v3-6-test has been updated
via e58ac20 Add fdopendir to the VFS. We will use this to reuse a directory fd already open by NtCreateX.
via d0e5477 Pass fsp to dptr_CloseDir(). Cope with setting the fd if we're closing an fd that opendir knows about. (cherry picked from commit 224fc03cb56b0d76f6ad7f18dd0528d6b0e57fb1)
via 07fa270 Add configure checks for fdopendir. (cherry picked from commit ad3d1adea3cdf42aee644dd853193b53a142c2f1)
via 6bbd85d Add fdopendir(). (cherry picked from commit 1911d483e552a6ec73b2c107b968268e7e9111e5)
via 84b98e5 s3: Fix some nonempty blank lines and some typos
from c7cb524 selftest: remove make oldtest.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test
- Log -----------------------------------------------------------------
commit e58ac20a8ac5ae4cf717f7f8f9fb4679a8106068
Author: Jeremy Allison <jra at samba.org>
Date: Tue Feb 8 15:07:48 2011 -0800
Add fdopendir to the VFS. We will use this to reuse a directory fd already open by NtCreateX.
Autobuild-User: Jeremy Allison <jra at samba.org>
Autobuild-Date: Wed Feb 9 00:55:22 CET 2011 on sn-devel-104
(cherry picked from commit a674a56a97c78a44bf43f1c175d106fbe70c7485)
commit d0e5477d89f3e0f8c06ebb3c2345ae4e0896b475
Author: Jeremy Allison <jra at samba.org>
Date: Tue Feb 8 15:05:00 2011 -0800
Pass fsp to dptr_CloseDir(). Cope with setting the fd if we're closing an fd that opendir knows about.
(cherry picked from commit 224fc03cb56b0d76f6ad7f18dd0528d6b0e57fb1)
commit 07fa270bc016e4f81b1e1c675a965081b340287a
Author: Jeremy Allison <jra at samba.org>
Date: Tue Feb 8 15:04:47 2011 -0800
Add configure checks for fdopendir.
(cherry picked from commit ad3d1adea3cdf42aee644dd853193b53a142c2f1)
commit 6bbd85d00ac0399a6f1021ebb089a85000db05ef
Author: Jeremy Allison <jra at samba.org>
Date: Tue Feb 8 14:43:07 2011 -0800
Add fdopendir().
(cherry picked from commit 1911d483e552a6ec73b2c107b968268e7e9111e5)
commit 84b98e548e27bfaf01cdceddc97dd37cc508d6fa
Author: Volker Lendecke <vl at samba.org>
Date: Tue Feb 8 23:08:21 2011 +0100
s3: Fix some nonempty blank lines and some typos
Autobuild-User: Volker Lendecke <vlendec at samba.org>
Autobuild-Date: Wed Feb 9 00:01:45 CET 2011 on sn-devel-104
(cherry picked from commit 5a0ee95b95d22f8eee7cc86d350fb0e60ab54b69)
-----------------------------------------------------------------------
Summary of changes:
examples/VFS/skel_opaque.c | 6 ++++
examples/VFS/skel_transparent.c | 6 ++++
source3/configure.in | 1 +
source3/include/packet.h | 6 ++--
source3/include/proto.h | 3 +-
source3/include/smbprofile.h | 4 ++
source3/include/vfs.h | 6 ++++
source3/include/vfs_macros.h | 5 +++
source3/lib/packet.c | 6 ++--
source3/lib/system.c | 16 ++++++++++
source3/lib/util_sock.c | 2 +-
source3/modules/vfs_default.c | 14 +++++++++
source3/modules/vfs_dirsort.c | 43 ++++++++++++++++++++++++++
source3/modules/vfs_full_audit.c | 16 ++++++++++
source3/modules/vfs_netatalk.c | 26 ++++++++++++++++
source3/modules/vfs_scannedonly.c | 30 ++++++++++++++++++
source3/modules/vfs_shadow_copy.c | 53 +++++++++++++++++++++++++++++++++
source3/modules/vfs_time_audit.c | 21 +++++++++++++
source3/rpc_server/srv_spoolss_util.c | 2 +-
source3/smbd/close.c | 4 --
source3/smbd/dir.c | 12 +++++--
source3/smbd/open.c | 3 ++
source3/smbd/smb2_find.c | 5 +--
source3/smbd/vfs.c | 9 +++++
source3/utils/smbfilter.c | 14 ++++----
source3/utils/status_profile.c | 2 +
source3/winbindd/winbindd_samr.c | 2 +-
source3/wscript | 1 +
28 files changed, 290 insertions(+), 28 deletions(-)
Changeset truncated at 500 lines:
diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c
index e506a20..da126e3 100644
--- a/examples/VFS/skel_opaque.c
+++ b/examples/VFS/skel_opaque.c
@@ -87,6 +87,11 @@ static SMB_STRUCT_DIR *skel_opendir(vfs_handle_struct *handle, const char *fnam
return NULL;
}
+static SMB_STRUCT_DIR *skel_fdopendir(vfs_handle_struct *handle, files_struct *fsp, const char *mask, uint32 attr)
+{
+ return NULL;
+}
+
static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle,
SMB_STRUCT_DIR *dirp,
SMB_STRUCT_STAT *sbuf)
@@ -784,6 +789,7 @@ struct vfs_fn_pointers skel_transparent_fns = {
/* Directory operations */
.opendir = skel_opendir,
+ .fdopendir = skel_fdopendir,
.readdir = skel_readdir,
.seekdir = skel_seekdir,
.telldir = skel_telldir,
diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c
index 3ab3b63..0ffdc11 100644
--- a/examples/VFS/skel_transparent.c
+++ b/examples/VFS/skel_transparent.c
@@ -84,6 +84,11 @@ static SMB_STRUCT_DIR *skel_opendir(vfs_handle_struct *handle, const char *fnam
return SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr);
}
+static SMB_STRUCT_DIR *skel_fdopendir(vfs_handle_struct *handle, files_struct *fsp, const char *mask, uint32 attr)
+{
+ return SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask, attr);
+}
+
static SMB_STRUCT_DIRENT *skel_readdir(vfs_handle_struct *handle,
SMB_STRUCT_DIR *dirp,
SMB_STRUCT_STAT *sbuf)
@@ -728,6 +733,7 @@ struct vfs_fn_pointers skel_transparent_fns = {
/* Directory operations */
.opendir = skel_opendir,
+ .fdopendir = skel_fdopendir,
.readdir = skel_readdir,
.seekdir = skel_seekdir,
.telldir = skel_telldir,
diff --git a/source3/configure.in b/source3/configure.in
index f0d8de7..363fbac 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -1099,6 +1099,7 @@ AC_CHECK_FUNCS(lstat64 fopen64 atexit grantpt lseek64 ftruncate64 posix_fallocat
AC_CHECK_FUNCS(fallocate fallocate64)
AC_CHECK_FUNCS(fseek64 fseeko64 ftell64 ftello64 setluid getpwanam)
AC_CHECK_FUNCS(opendir64 readdir64 seekdir64 telldir64 rewinddir64 closedir64)
+AC_CHECK_FUNCS(fdopendir fdopendir64)
AC_CHECK_FUNCS(getpwent_r)
AC_CHECK_FUNCS(getdents64)
AC_CHECK_FUNCS(setenv strcasecmp fcvt fcvtl)
diff --git a/source3/include/packet.h b/source3/include/packet.h
index 45a9bc2..a77a1a7 100644
--- a/source3/include/packet.h
+++ b/source3/include/packet.h
@@ -2,17 +2,17 @@
Unix SMB/CIFS implementation.
Packet handling
Copyright (C) Volker Lendecke 2007
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 2f2c627..00e9de4 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -890,6 +890,7 @@ int sys_open(const char *path, int oflag, mode_t mode);
FILE *sys_fopen(const char *path, const char *type);
void kernel_flock(int fd, uint32 share_mode, uint32 access_mask);
SMB_STRUCT_DIR *sys_opendir(const char *name);
+SMB_STRUCT_DIR *sys_fdopendir(int fd);
SMB_STRUCT_DIRENT *sys_readdir(SMB_STRUCT_DIR *dirp);
void sys_seekdir(SMB_STRUCT_DIR *dirp, long offset);
long sys_telldir(SMB_STRUCT_DIR *dirp);
@@ -4547,7 +4548,7 @@ void dptr_closepath(struct smbd_server_connection *sconn,
char *path,uint16 spid);
NTSTATUS dptr_create(connection_struct *conn, const char *path, bool old_handle, bool expect_close,uint16 spid,
const char *wcard, bool wcard_has_wild, uint32 attr, struct dptr_struct **dptr_ret);
-int dptr_CloseDir(struct dptr_struct *dptr);
+void dptr_CloseDir(files_struct *fsp);
void dptr_SeekDir(struct dptr_struct *dptr, long offset);
long dptr_TellDir(struct dptr_struct *dptr);
bool dptr_has_wild(struct dptr_struct *dptr);
diff --git a/source3/include/smbprofile.h b/source3/include/smbprofile.h
index ff8ab90..3041f6c 100644
--- a/source3/include/smbprofile.h
+++ b/source3/include/smbprofile.h
@@ -43,6 +43,10 @@ enum profile_stats_values
#define syscall_opendir_count __profile_stats_value(PR_VALUE_SYSCALL_OPENDIR, count)
#define syscall_opendir_time __profile_stats_value(PR_VALUE_SYSCALL_OPENDIR, time)
+ PR_VALUE_SYSCALL_FDOPENDIR,
+#define syscall_fdopendir_count __profile_stats_value(PR_VALUE_SYSCALL_FDOPENDIR, count)
+#define syscall_fdopendir_time __profile_stats_value(PR_VALUE_SYSCALL_FDOPENDIR, time)
+
PR_VALUE_SYSCALL_READDIR,
#define syscall_readdir_count __profile_stats_value(PR_VALUE_SYSCALL_READDIR, count)
#define syscall_readdir_time __profile_stats_value(PR_VALUE_SYSCALL_READDIR, time)
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index 72d61e3..45193d2 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -132,6 +132,7 @@
where it belongs. JRA. */
/* Leave at 28 - not yet released. Rename posix_fallocate to fallocate
to split out the two possible uses. JRA. */
+/* Leave at 28 - not yet released. Add fdopendir. JRA. */
#define SMB_VFS_INTERFACE_VERSION 28
@@ -198,6 +199,7 @@ struct vfs_fn_pointers {
/* Directory operations */
SMB_STRUCT_DIR *(*opendir)(struct vfs_handle_struct *handle, const char *fname, const char *mask, uint32 attributes);
+ SMB_STRUCT_DIR *(*fdopendir)(struct vfs_handle_struct *handle, files_struct *fsp, const char *mask, uint32 attributes);
SMB_STRUCT_DIRENT *(*readdir)(struct vfs_handle_struct *handle,
SMB_STRUCT_DIR *dirp,
SMB_STRUCT_STAT *sbuf);
@@ -526,6 +528,10 @@ uint32_t smb_vfs_call_fs_capabilities(struct vfs_handle_struct *handle,
SMB_STRUCT_DIR *smb_vfs_call_opendir(struct vfs_handle_struct *handle,
const char *fname, const char *mask,
uint32 attributes);
+SMB_STRUCT_DIR *smb_vfs_call_fdopendir(struct vfs_handle_struct *handle,
+ struct files_struct *fsp,
+ const char *mask,
+ uint32 attributes);
SMB_STRUCT_DIRENT *smb_vfs_call_readdir(struct vfs_handle_struct *handle,
SMB_STRUCT_DIR *dirp,
SMB_STRUCT_STAT *sbuf);
diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h
index bb6428e..c0fbe38 100644
--- a/source3/include/vfs_macros.h
+++ b/source3/include/vfs_macros.h
@@ -74,6 +74,11 @@
#define SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr) \
smb_vfs_call_opendir((handle)->next, (fname), (mask), (attr))
+#define SMB_VFS_FDOPENDIR(conn, fsp, mask, attr) \
+ smb_vfs_call_fdopendir((conn)->vfs_handles, (fsp), (mask), (attr))
+#define SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask, attr) \
+ smb_vfs_call_fdopendir((handle)->next, (fsp), (mask), (attr))
+
#define SMB_VFS_READDIR(conn, dirp, sbuf) \
smb_vfs_call_readdir((conn)->vfs_handles, (dirp), (sbuf))
#define SMB_VFS_NEXT_READDIR(handle, dirp, sbuf) \
diff --git a/source3/lib/packet.c b/source3/lib/packet.c
index fefb74a..1abf35c 100644
--- a/source3/lib/packet.c
+++ b/source3/lib/packet.c
@@ -2,17 +2,17 @@
Unix SMB/CIFS implementation.
Packet handling
Copyright (C) Volker Lendecke 2007
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
diff --git a/source3/lib/system.c b/source3/lib/system.c
index 4cf6a29..57434f2 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -867,6 +867,22 @@ SMB_STRUCT_DIR *sys_opendir(const char *name)
}
/*******************************************************************
+ An fdopendir wrapper that will deal with 64 bit filesizes.
+********************************************************************/
+
+SMB_STRUCT_DIR *sys_fdopendir(int fd)
+{
+#if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_FDOPENDIR64)
+ return fdopendir64(fd);
+#elif defined(HAVE_FDOPENDIR)
+ return fdopendir(fd);
+#else
+ errno = ENOSYS;
+ return NULL;
+#endif
+}
+
+/*******************************************************************
A readdir wrapper that will deal with 64 bit filesizes.
********************************************************************/
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index 8b25e01..d0ff960 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -111,7 +111,7 @@ char *print_canonical_sockaddr(TALLOC_CTX *ctx,
} else {
dest = talloc_asprintf(ctx, "%s", addr);
}
-
+
return dest;
}
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 698e745..eb5a2a4 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -167,6 +167,20 @@ static SMB_STRUCT_DIR *vfswrap_opendir(vfs_handle_struct *handle, const char *f
return result;
}
+static SMB_STRUCT_DIR *vfswrap_fdopendir(vfs_handle_struct *handle,
+ files_struct *fsp,
+ const char *mask,
+ uint32 attr)
+{
+ SMB_STRUCT_DIR *result;
+
+ START_PROFILE(syscall_fdopendir);
+ result = sys_fdopendir(fsp->fh->fd);
+ END_PROFILE(syscall_fdopendir);
+ return result;
+}
+
+
static SMB_STRUCT_DIRENT *vfswrap_readdir(vfs_handle_struct *handle,
SMB_STRUCT_DIR *dirp,
SMB_STRUCT_STAT *sbuf)
diff --git a/source3/modules/vfs_dirsort.c b/source3/modules/vfs_dirsort.c
index 4869bc0..82a3a4b 100644
--- a/source3/modules/vfs_dirsort.c
+++ b/source3/modules/vfs_dirsort.c
@@ -122,6 +122,48 @@ static SMB_STRUCT_DIR *dirsort_opendir(vfs_handle_struct *handle,
return data->source_directory;
}
+static SMB_STRUCT_DIR *dirsort_fdopendir(vfs_handle_struct *handle,
+ files_struct *fsp,
+ const char *mask,
+ uint32 attr)
+{
+ struct dirsort_privates *data = NULL;
+
+ /* set up our private data about this directory */
+ data = (struct dirsort_privates *)SMB_MALLOC(
+ sizeof(struct dirsort_privates));
+
+ if (!data) {
+ return NULL;
+ }
+
+ data->directory_list = NULL;
+ data->pos = 0;
+
+ /* Open the underlying directory and count the number of entries */
+ data->source_directory = SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask,
+ attr);
+
+ if (data->source_directory == NULL) {
+ SAFE_FREE(data);
+ return NULL;
+ }
+
+ data->fd = dirfd(data->source_directory);
+
+ SMB_VFS_HANDLE_SET_DATA(handle, data, free_dirsort_privates,
+ struct dirsort_privates, return NULL);
+
+ if (!open_and_sort_dir(handle)) {
+ SMB_VFS_NEXT_CLOSEDIR(handle,data->source_directory);
+ /* fd is now closed. */
+ fsp->fh->fd = -1;
+ return NULL;
+ }
+
+ return data->source_directory;
+}
+
static SMB_STRUCT_DIRENT *dirsort_readdir(vfs_handle_struct *handle,
SMB_STRUCT_DIR *dirp,
SMB_STRUCT_STAT *sbuf)
@@ -179,6 +221,7 @@ static void dirsort_rewinddir(vfs_handle_struct *handle, SMB_STRUCT_DIR *dirp)
static struct vfs_fn_pointers vfs_dirsort_fns = {
.opendir = dirsort_opendir,
+ .fdopendir = dirsort_fdopendir,
.readdir = dirsort_readdir,
.seekdir = dirsort_seekdir,
.telldir = dirsort_telldir,
diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c
index 10422fc..a81f3b5 100644
--- a/source3/modules/vfs_full_audit.c
+++ b/source3/modules/vfs_full_audit.c
@@ -87,6 +87,7 @@ typedef enum _vfs_op_type {
/* Directory operations */
SMB_VFS_OP_OPENDIR,
+ SMB_VFS_OP_FDOPENDIR,
SMB_VFS_OP_READDIR,
SMB_VFS_OP_SEEKDIR,
SMB_VFS_OP_TELLDIR,
@@ -229,6 +230,7 @@ static struct {
{ SMB_VFS_OP_STATVFS, "statvfs" },
{ SMB_VFS_OP_FS_CAPABILITIES, "fs_capabilities" },
{ SMB_VFS_OP_OPENDIR, "opendir" },
+ { SMB_VFS_OP_FDOPENDIR, "fdopendir" },
{ SMB_VFS_OP_READDIR, "readdir" },
{ SMB_VFS_OP_SEEKDIR, "seekdir" },
{ SMB_VFS_OP_TELLDIR, "telldir" },
@@ -735,6 +737,19 @@ static SMB_STRUCT_DIR *smb_full_audit_opendir(vfs_handle_struct *handle,
return result;
}
+static SMB_STRUCT_DIR *smb_full_audit_fdopendir(vfs_handle_struct *handle,
+ files_struct *fsp, const char *mask, uint32 attr)
+{
+ SMB_STRUCT_DIR *result;
+
+ result = SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask, attr);
+
+ do_log(SMB_VFS_OP_FDOPENDIR, (result != NULL), handle, "%s",
+ fsp_str_do_log(fsp));
+
+ return result;
+}
+
static SMB_STRUCT_DIRENT *smb_full_audit_readdir(vfs_handle_struct *handle,
SMB_STRUCT_DIR *dirp, SMB_STRUCT_STAT *sbuf)
{
@@ -2201,6 +2216,7 @@ static struct vfs_fn_pointers vfs_full_audit_fns = {
.statvfs = smb_full_audit_statvfs,
.fs_capabilities = smb_full_audit_fs_capabilities,
.opendir = smb_full_audit_opendir,
+ .fdopendir = smb_full_audit_fdopendir,
.readdir = smb_full_audit_readdir,
.seekdir = smb_full_audit_seekdir,
.telldir = smb_full_audit_telldir,
diff --git a/source3/modules/vfs_netatalk.c b/source3/modules/vfs_netatalk.c
index d5a85b3..734c603 100644
--- a/source3/modules/vfs_netatalk.c
+++ b/source3/modules/vfs_netatalk.c
@@ -198,6 +198,31 @@ static SMB_STRUCT_DIR *atalk_opendir(struct vfs_handle_struct *handle, const cha
return ret;
}
+static SMB_STRUCT_DIR *atalk_fdopendir(struct vfs_handle_struct *handle, files_struct *fsp, const char *mask, uint32 attr)
+{
+ SMB_STRUCT_DIR *ret = 0;
+
+ ret = SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask, attr);
+
+ if (ret == NULL) {
+ return ret;
+ }
+
+ /*
+ * when we try to perform delete operation upon file which has fork
+ * in ./.AppleDouble and this directory wasn't hidden by Samba,
+ * MS Windows explorer causes the error: "Cannot find the specified file"
+ * There is some workaround to avoid this situation, i.e. if
+ * connection has not .AppleDouble entry in either veto or hide
+ * list then it would be nice to add one.
+ */
+
+ atalk_add_to_list(&handle->conn->hide_list);
+ atalk_add_to_list(&handle->conn->veto_list);
+
+ return ret;
+}
+
static int atalk_rmdir(struct vfs_handle_struct *handle, const char *path)
{
bool add = False;
@@ -432,6 +457,7 @@ exit_lchown:
static struct vfs_fn_pointers vfs_netatalk_fns = {
.opendir = atalk_opendir,
+ .fdopendir = atalk_fdopendir,
.rmdir = atalk_rmdir,
.rename = atalk_rename,
.unlink = atalk_unlink,
diff --git a/source3/modules/vfs_scannedonly.c b/source3/modules/vfs_scannedonly.c
index 123bf65..fd6c3e2 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,
diff --git a/source3/modules/vfs_shadow_copy.c b/source3/modules/vfs_shadow_copy.c
index 6bad168..b597644 100644
--- a/source3/modules/vfs_shadow_copy.c
+++ b/source3/modules/vfs_shadow_copy.c
@@ -118,6 +118,58 @@ static SMB_STRUCT_DIR *shadow_copy_opendir(vfs_handle_struct *handle, const char
return((SMB_STRUCT_DIR *)dirp);
}
+static SMB_STRUCT_DIR *shadow_copy_fdopendir(vfs_handle_struct *handle, files_struct *fsp, const char *mask, uint32 attr)
+{
+ shadow_copy_Dir *dirp;
+ SMB_STRUCT_DIR *p = SMB_VFS_NEXT_FDOPENDIR(handle,fsp,mask,attr);
+
+ if (!p) {
+ DEBUG(10,("shadow_copy_opendir: SMB_VFS_NEXT_FDOPENDIR() failed for [%s]\n",
+ smb_fname_str_dbg(fsp->fsp_name)));
+ return NULL;
+ }
+
+ dirp = SMB_MALLOC_P(shadow_copy_Dir);
+ if (!dirp) {
+ DEBUG(0,("shadow_copy_fdopendir: Out of memory\n"));
+ SMB_VFS_NEXT_CLOSEDIR(handle,p);
+ /* We have now closed the fd in fsp. */
+ fsp->fh->fd = -1;
+ return NULL;
+ }
+
+ ZERO_STRUCTP(dirp);
+
+ while (True) {
+ SMB_STRUCT_DIRENT *d;
+
+ d = SMB_VFS_NEXT_READDIR(handle, p, NULL);
+ if (d == NULL) {
+ break;
+ }
+
+ if (shadow_copy_match_name(d->d_name)) {
+ DEBUG(8,("shadow_copy_fdopendir: hide [%s]\n",d->d_name));
+ continue;
--
Samba Shared Repository
More information about the samba-cvs
mailing list