diff options
author | Volker Lendecke <vl@samba.org> | 2019-02-20 11:55:01 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2019-02-22 21:48:11 +0100 |
commit | 5dd67797ca8025c13f55775c4a5892ecf1b53e3e (patch) | |
tree | b89240db738d14e2bd52c58180e7acbf959c8e59 /source3 | |
parent | 529c61d0c9db5cf1ce852b06e14b7f1b2e72150e (diff) | |
download | samba-5dd67797ca8025c13f55775c4a5892ecf1b53e3e.tar.gz |
libsmb: Fix a resource leak in cli_posix_mkdir
smbd does posix_mkdir if the wire flags are exactly
if (wire_open_mode == (SMB_O_CREAT|SMB_O_DIRECTORY))
open_flags_to_wire however adds a SMB_O_RDONLY, so that we enter the
normal open routine which happens to create a directory as well. The
main difference is that posix_mkdir does *NOT* return an open
handle. As we did not enter this code path due to the SMB_O_RDONLY we
leak a SMB1 fd per cli_posix_mkdir call.
Pretty hard to test automatically, this would be an interaction with
smbstatus.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3')
-rw-r--r-- | source3/libsmb/clifile.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index 61bc73effa2..ff98ba60034 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -5348,7 +5348,7 @@ struct tevent_req *cli_posix_mkdir_send(TALLOC_CTX *mem_ctx, state->ev = ev; state->cli = cli; - wire_flags = open_flags_to_wire(O_CREAT) | SMB_O_DIRECTORY; + wire_flags = SMB_O_CREAT | SMB_O_DIRECTORY; subreq = cli_posix_open_internal_send( mem_ctx, ev, cli, fname, wire_flags, mode); |