1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-02 09:47:23 +03:00

pysmbd: set_nt_acl() can raise FileNotFoundError

rather than an NTStatusError, which is harder to decipher, and which
carries less information (namely, not the name of the problematic file).

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

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Douglas Bagnall 2022-09-01 01:18:12 +00:00 committed by Douglas Bagnall
parent 1b4938c3b1
commit dc9f29e5c3

View File

@ -811,6 +811,14 @@ static PyObject *py_smbd_set_nt_acl(PyObject *self, PyObject *args, PyObject *kw
status = set_nt_acl_conn(fname, security_info_sent, sd, conn);
TALLOC_FREE(frame);
if (NT_STATUS_IS_ERR(status)) {
if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
/*
* This will show up as a FileNotFoundError in python.
*/
PyErr_SetFromErrnoWithFilename(PyExc_OSError, fname);
} else {
PyErr_SetNTSTATUS(status);
}
return NULL;
}