Skip to content

Commit

Permalink
s3: smbd: Fix possible directory fd leak if the underlying OS doesn't…
Browse files Browse the repository at this point in the history
… support fdopendir()

HPUX has this problem.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13270

Signed-off-by: Jeremy Allison <[email protected]>
Reviewed-by: Ralph Boehme <[email protected]>

Autobuild-User(master): Ralph Böhme <[email protected]>
Autobuild-Date(master): Fri Feb 23 22:56:35 CET 2018 on sn-devel-144
  • Loading branch information
jrasamba authored and slowfranklin committed Feb 23, 2018
1 parent 06601b3 commit 5ad5e79
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions source3/smbd/smb2_query_directory.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,11 +343,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;
Expand Down

0 comments on commit 5ad5e79

Please sign in to comment.