vfs_xattr_tdb: don't leak the fd into the caller
authorRalph Boehme <slow@samba.org>
Tue, 24 Nov 2020 15:16:10 +0000 (16:16 +0100)
committerRalph Boehme <slow@samba.org>
Wed, 16 Dec 2020 09:08:31 +0000 (09:08 +0000)
commit4bcb3d7a03db4c3346bcb4cb62752aa9930cd3b4
tree6677c5eb7e57c4f7ae528e44141631d19383b378
parentd00d09fdcf73a5839ae4f82cf8e953bb761bfbfb
vfs_xattr_tdb: don't leak the fd into the caller

This is subtle: generally fsp_set_fd(fd) is called in the caller of
SMB_VFS_OPENAT() in non_widelink_open().

fsp_set_fd() has a check that asserts certain combindations of the existing
fsp->fh->fd and the new fd. Both being valid fds is not allowed.

Therefor inside the VFS we must reset fsp->fh->fd if we've set it.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/modules/vfs_xattr_tdb.c