From 02bcdd109fb24a369c05dceabfdc1b5edd291aeb Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 3 Jul 2014 10:00:13 +0200 Subject: 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 Reviewed-by: Christof Schmitt Autobuild-User(master): Christof Schmitt Autobuild-Date(master): Sun Jul 13 11:26:58 CEST 2014 on sn-devel-104 --- source3/smbd/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- cgit