[PATCH] Fix bug 9777 - vfs_dirsort uses non-stackable calls, dirfd(), malloc instead of talloc and doesn't cope with directories being modified whilst reading.
Andreas Schneider
asn at samba.org
Thu Apr 11 01:50:55 MDT 2013
On Tuesday 09 April 2013 17:00:21 Jeremy Allison wrote:
> (Re-submitted with correct [PATCH] in the Subject: header,
> sorry :-).
>
> This patchset fixes a number of issues in the vfs_dirsort
> module. Tested under valgrind. It's structured as a set
> of micro-patches so hopefully will be easy to follow and
> digest. It also adds vfs_dirsort into the test suite so
> it should not be broken in future.
>
> Please review and push to master if you're happy, then
> I'll get it into 4.0.next.
[PATCH 08/10] Remove the use of dirfd inside the vfs_dirsort.c.
+ struct timespec *pmtime;
+
+ if (data->fsp) {
+ ret = fsp_stat(data->fsp);
+ pmtime = &data->fsp->fsp_name->st.st_ex_mtime;
+ } else {
+ ret = SMB_VFS_STAT(handle->conn, data->smb_fname);
+ pmtime = &data->smb_fname->st.st_ex_mtime;
+ }
if (ret == -1) {
return false;
}
- ret_mtime->tv_sec = dir_stat.st_mtime;
- ret_mtime->tv_nsec = 0;
+ *ret_mtime = *pmtime;
If you don't want to use ret_mtime directly, then pmtime shouldn't be a
pointer. In the end you just copy the struct, right?
The rest looks fine to me.
-- andreas
--
Andreas Schneider GPG-ID: F33E3FC6
Samba Team asn at samba.org
www.samba.org
More information about the samba-technical
mailing list