summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2018-02-14 13:23:12 -0800
committerKarolin Seeger <kseeger@samba.org>2018-04-11 12:56:12 +0200
commit94d91c990630c157bc162c2baf600a97c359af51 (patch)
tree6186de917bf25da031cea14a2a4243b89805c663
parent8f4202e0d98bd497286dc2dea63883bf880d811b (diff)
downloadsamba-94d91c990630c157bc162c2baf600a97c359af51.tar.gz
s3: smbd: Fix possible directory fd leak if the underlying OS doesn't support fdopendir()
HPUX has this problem. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13270 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Ralph Böhme <slow@samba.org> Autobuild-Date(master): Fri Feb 23 22:56:35 CET 2018 on sn-devel-144 (cherry picked from commit 5ad5e7966f555b1d2b39d276646934a2cd2535e6)
-rw-r--r--source3/smbd/smb2_query_directory.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/source3/smbd/smb2_query_directory.c b/source3/smbd/smb2_query_directory.c
index 2af029bc613..2c6aa51aa12 100644
--- a/source3/smbd/smb2_query_directory.c
+++ b/source3/smbd/smb2_query_directory.c
@@ -325,11 +325,14 @@ static struct tevent_req *smbd_smb2_query_directory_send(TALLOC_CTX *mem_ctx,
if (in_flags & SMB2_CONTINUE_FLAG_REOPEN) {
int flags;
- dptr_CloseDir(fsp);
+ status = fd_close(fsp);
+ if (tevent_req_nterror(req, status)) {
+ return tevent_req_post(req, ev);
+ }
/*
- * dptr_CloseDir() will close and invalidate the fsp's file
- * descriptor, we have to reopen it.
+ * fd_close() will close and invalidate the fsp's file
+ * descriptor. So we have to reopen it.
*/
flags = O_RDONLY;