summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2014-07-03 10:00:13 +0200
committerChristof Schmitt <cs@samba.org>2014-07-13 11:26:57 +0200
commit02bcdd109fb24a369c05dceabfdc1b5edd291aeb (patch)
tree4198a20eace2afe4aafac204588c58a2c2c32a03
parent26290ba8a45d4caf935995284a111ec57f77cfd7 (diff)
downloadsamba-02bcdd109fb24a369c05dceabfdc1b5edd291aeb.tar.gz
samba-02bcdd109fb24a369c05dceabfdc1b5edd291aeb.tar.xz
samba-02bcdd109fb24a369c05dceabfdc1b5edd291aeb.zip
s3:smbd: initialize stat_ex buffer in smbd_dirptr_get_entry()
This prevents random garbage in the vfs_private member. Usually it should not be a problem to leave initialization of the vfs_private to the vfs module who wants to use it, but further down in the directory listing code, in vfswrap_readdir, there is in optimization introduced with 2a65e8befef004fd18d17853a1b72155752346c8, to call fstatat if possible to already fill stat info in the readdir call. The problem is that this calls fstatat directly, not going through VFS, but still making the stat buffer valid, leaving vfs_private with random garbage. Hence a vfs module using vfs_private, like vfs_gpfs does for offline info (and winAttrs in general) does not have a chance to tell whether the vfs_private is valid if the stat buffer is marked valid. This is a reason for the "flapping offline flag" problem of the vfs_gpfs module. Initializing the vfs_private to 0 here will for the vfs_gpfs module result in files being marked online always in a directory listing. So this is not a real fix but it does at least make the problem less random. A real general fix might be to implement SMB_VFS_FSTATAT() and use it here. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Christof Schmitt <cs@samba.org> Autobuild-User(master): Christof Schmitt <cs@samba.org> Autobuild-Date(master): Sun Jul 13 11:26:58 CEST 2014 on sn-devel-104
-rw-r--r--source3/smbd/dir.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index 038281e599..818f77895e 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -1126,7 +1126,7 @@ bool smbd_dirptr_get_entry(TALLOC_CTX *ctx,
while (true) {
long cur_offset;
long prev_offset;
- SMB_STRUCT_STAT sbuf;
+ SMB_STRUCT_STAT sbuf = { 0 };
char *dname = NULL;
bool isdots;
char *fname = NULL;