diff options
author | Stefan Metzmacher <metze@samba.org> | 2021-02-09 13:48:36 +0100 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2021-02-16 16:20:18 +0000 |
commit | 5957cf2e2ca6265f233803c23212d307c3ccf530 (patch) | |
tree | 3785ef74f5a62cefbf2f4d5b39d45ca8b9980b14 | |
parent | 780fbc3004126175c66ec906910453aed866b163 (diff) | |
download | samba-5957cf2e2ca6265f233803c23212d307c3ccf530.tar.gz |
s3:pysmbd: fix fd leak in py_smbd_create_file()
Various 'samba-tool domain backup' commands use this and will
fail if there's over ~1000 files in the sysvol folder.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13898
Signed-off-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit d8fa464a2dfb11df4e1db4ebffe8bd28ff118c75)
-rw-r--r-- | source3/smbd/pysmbd.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/source3/smbd/pysmbd.c b/source3/smbd/pysmbd.c index dd4a70ca256..2081a75d52c 100644 --- a/source3/smbd/pysmbd.c +++ b/source3/smbd/pysmbd.c @@ -1144,9 +1144,12 @@ static PyObject *py_smbd_create_file(PyObject *self, PyObject *args, PyObject *k if (!NT_STATUS_IS_OK(status)) { DBG_ERR("init_files_struct failed: %s\n", nt_errstr(status)); + } else if (fsp != NULL) { + SMB_VFS_CLOSE(fsp); } TALLOC_FREE(frame); + PyErr_NTSTATUS_NOT_OK_RAISE(status); Py_RETURN_NONE; } |